In SX Microcontrollers, SX/B Compiler and SX-Key Tool, lt222 wrote: Hello Zoot, Thank you for your quick reply. I checked out the List file, and I saw the extra instructions at the beginning and end of the ISR you mentioned. It looks like at the most there will be 10 clock cycles delay added at the beginning of the ISR from these instructions, so I am still not sure if this is where the huge latency is coming from. I did try your suggestion of using the NOCODE option, and I had some interesting results. Changing nothing in the above code except for adding NOCODE, the latency was drastically reduced, but there are now two interrupts triggered for each rising edge on pin RB.0. The first pulse generated by the ISR occurs 0.4us after the rising edge of RB.0, and the second occurs 1us after the same rising edge. I figured that something other than the RB.0 interrupt must be causing the interrupt, so I added in code for checking the WKPND_B register (which was commented out in the code pasted above). So, the code for the ISR is now... [code] ' ========================================================================= INTERRUPT NOCODE ' ========================================================================= ISR_Start: Int_Check = WKPND_B If Int_Check <>%00000001 Then ISR_Exit 'Check to make sure that interrupt due to pin RB.0 SX_CLK = 1 SX_CLK = 0 ISR_Exit: WKPND_B = 0 'Reset Port B interrupt flags RETURNINT [/code] I now only have one interrupt per RB.0 rising edge, but the latency is back to 1us and for some reason it misses every third edge. It consistently triggers for two edges and then skips one. My input signal is a clean square wave without ringing, so I don't believe the input is the source of the problem. Do you know how this could be caused just by adding "NOCODE"? Or have I just set my interrupt up incorrectly? Again, thank you very much for your help!! ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=446826#m446866 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2010 (http://www.dotNetBB.com)