interrupt on change bug explained

Status
Not open for further replies.

3v0

Coop Build Coordinator
Forum Supporter
Have you ever wondered about the warning not to read from pins use with interrupt-on-change.
 
I just skimmed it, but is this still an issue with the enhanced mid range core? I don't want to read up on this if it doesn't effect me.
 
Yep on PIC16 and PIC18.

Generally I don't use interrupt on change, it's better to use a timer interrupt and manually poll the inputs you need. Especially with a button etc that will have contact bounce, int on change is a pain.
 
Yep on PIC16 and PIC18.

Generally I don't use interrupt on change, it's better to use a timer interrupt and manually poll the inputs you need.

Where it can be handy is reading electronic (clean pulses) quadrature encoder A/B channel inputs. I have a user interface that uses several encoders for the selection and control of several motors in a tool assembly test box I'm building for a tech at work. The A/B input bits generate an interrupt for any change in position (at 4X resolution) of the encoders so the ISR only has to look at one flag to see control adjustments. Polling also works but if you also have to read other asynchronous events at high speed (motor position , power and serial communication channels) it starts to eat up the minimum sampling window time.
 
I just skimmed it, but is this still an issue with the enhanced mid range core? I don't want to read up on this if it doesn't effect me.

From the linked page
This issue has been corrected in the PIC30 core by using the output of the input latch as the input to the change latch. It has also been corrected in the enhanced midrange line (PIC16F1xxx).
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…