In SX Microcontrollers, SX/B Compiler and SX-Key Tool, verobel wrote: Hi Bean & Jon; (thanks Sparks..for ideas) The sensor is Melexis 90217 from Parallax (magnet detection). It is mounted on a 27" bicycle wheel near the central bearing. There are 2 magnets 180degrees apart provide 2 pulses per revolution. I don't know what the signal looks like but I speculate that it is like a square wave with a 20% duty cyle. (as long as the magnet is in range the pulse stays high?). I wouldn't say that the pulses are quick, just that if they come at the wrong time ( when interupt is running, and it runs alot ) the SX28 could miss them. I was thinking I would miss pulses because the SX/28 could not detect pulses while it was busy on the interupt routine. But looking at your code again, it looks like the SX can latch a pulse, while other code is running. Then, as long as some code 'counts' the pulse and resets the latch before the next pulse arrives, it should work ok. That code is DELAY_MS. If I understand Jon's extra code, it looks like the MAIN program should loop, updating display LEDs values while the interupt routine multiplexes the display cathodes. The MAIN calls DELAY_MS at some unknown interval ( when interupt is not running and other code in MAIN is not running). During that time 'JNB isrFlag' would check if say RB.0 is high and then branch somewhere where a counter could be incremented. That counter could be inspected every so often in the main program, used in a calculation and then reset. This seems to require input RB.0 be set to act like a latch? I think I just need some help mixing some assembler code in SX/B to get the job done. respectfully, John ps. Bean, I like the idea of doing as much as possible on one SX/28 chip (for this project) to keep the parts count and cost as low as possible. Just show me how.. ps. Jon, If the pulse stayed high long enough wouldn't it retrigger the latch and give more than 1 count per pulse? ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=230552#m231030 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2007 (http://www.dotNetBB.com)