In SX Microcontrollers, SX/B Compiler and SX-Key Tool, kmonsx wrote: [quote="pjv"] Instead, I believe (and this is how my code is written) that the ISR should sample 3 Usec after detection of a falling edge to put it in the middle of the next cell, allowing for maximum cell timing jitter. Then subsequent ISR's must each fire in 2 USec, staying in the middle of each subsequent cell. Each time a falling edge occurs, then the next ISR must again fire in 3 Usec. This way each falling edge "resyncs" the whole process. Also, the maximum number of consecutive zeros read may only be three, so if 4 are detected, an "end of sequence" is assumed, and the process is restarted. I think you are entirely correct. Yup 3us for the first, 2 for each one after. What's wierd is that I knew this, but I don't take it into consideration in my code in my latest version of the code. At one point, I had separate RTCC=xxx and retiw commands for processing an edge vs processing a high. [quote="pjv"] [b][/b] Furthermore the ISR responds to the falling edge in 60 nSec; 3 instructions at 50 MHz. so I don't know where you are getting your numbers from. Is something slow happening in the ISR under SX/B ??? Perhaps I'll do an SX/B compile on your code tomorrow and see what assembler code that produces. I read those times on the datasheet, in the manual, etc too. I'm not sure why it's taking so long either. I have a bit set on entry/cleared on exit to the ISR for debugging. If I measure on my scope from the time the edge falls to the time that bit is set, it's a lot longer. Now there is some ringing at the bottom of the pulse, but with schmitt triggering, I really should be ok there. But the pulse isn't square, and so there are multiple (albeit really smaller) falling edges on each pulse. Maybe I need to put a cap on the input line to help clean this up. I was thinking that maybe the SX is waiting for last "edge" before it triggers the ISR. and in this case, that happens hundreds of ns later. I'm still rearranging my code, and I just moved the edge detection to the main, and turned off edge-ISR-triggers. So this might be a moot point right now anyways. I did look at your code in detail, and I understand it. I see that you turn off interrupts while waiting for the next edge. I had a version of my code where I did that too. I wasn't sure of what the ramifications of doing that were, if I needed to reset RTCC manually, etc so I pulled it out. I'm working on my code now...... Keith [/quote] ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=2&m=78490#m79324 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2005 (http://www.dotNetBB.com)