change output falling edge to rising

Technical questions regarding the XTC tools and programming with XMOS.
Post Reply
ENGHK
Member++
Posts: 16
Joined: Fri Feb 19, 2010 7:03 am

change output falling edge to rising

Post by ENGHK »

is there any function that I can make the output port to be sampled by rising edge rather than the falling edge ?


User avatar
Woody
XCore Addict
Posts: 165
Joined: Wed Feb 10, 2010 2:32 pm

Post by Woody »

Are you clocking the port off a clock block driven from an external port pin?
richard
Respected Member
Posts: 318
Joined: Tue Dec 15, 2009 12:46 am

Post by richard »

Assuming the port is clocked off a clock block driven from an external port pin the you can invert the 1-bit port used as a clock source. Use the set_port_inv() function from xs1.h. Inverting the clock source has the effect of swapping the rising and falling edges of the clock.
ENGHK
Member++
Posts: 16
Joined: Fri Feb 19, 2010 7:03 am

Post by ENGHK »

yes, i am using external clock. But once i use set_port_inv(INCLK) (INCLK is the input port from the clock). Although the clock is inverted, i.e. 0 becomes 1 and 1 becomes 0, I still get a wrong output. Please see the attached photos.

What my output I want is 0x12AB56D4.
i.e. 0001 0010 1010 1011 0101 0110 1101 0100

The first one is the output using falling edge. But my device counts as rising edge and so the output is 15B56AA4. It is correct if we count the falling edge in this photo and will get the result right.

The second one is the output after using set_port_inv. The result is quite near to what I want. However, the result is 0x1B6Ad548.

i.e. 0001 1011 0110 1010 1101 0101 0100 1000

It is the reverse of 0x12AB56D4. But the first 0001 is wrong. What's the problem?
Attachments
output 2.JPG
(118.57 KiB) Not downloaded yet
output 2.JPG
(118.57 KiB) Not downloaded yet
output 1.JPG
(119.09 KiB) Not downloaded yet
output 1.JPG
(119.09 KiB) Not downloaded yet
ENGHK
Member++
Posts: 16
Joined: Fri Feb 19, 2010 7:03 am

Post by ENGHK »

another question, how can I make the data1 line to be put 1 cycle before ?

make from output 3.JPG to output 4.JPG
Attachments
output 4.JPG
(115.78 KiB) Not downloaded yet
output 4.JPG
(115.78 KiB) Not downloaded yet
output 3.JPG
(116.2 KiB) Not downloaded yet
output 3.JPG
(116.2 KiB) Not downloaded yet
Post Reply