> Hello friends, > Suppose I initialize PortB (RB4) as interrupt on change, and I need to > be interrupted on every rising edge only and during my high to low > transition, I should not get interrupted. I am using limit switch as an > interrupt source. But my program behaves erratically during emulation. > What could be the reason. MPLAB simulation is perfectly ok. > > thanks > rams > Probably switch contact bounce. Switches do not open and close like the text books say. Is your software behaving like it sees many contact closures/openings instead of just one? Normal practice is to write a software debounce routine that rejects rapid input changes of less than say 20-30ms duration. Hardware debounce circuits are also possible but it is usually preferable to do it in software which is more flexible and does not require extra components. Brent Brown Electronic Design Solutions 16 English Street Hamilton, New Zealand Ph/fax: +64 7 849 0069 Mobile: 025 334 069 eMail: brent.brown@clear.net.nz