Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Interrupt on pin change

Status
Not open for further replies.

phaedrus

Member
Hi ,

In the datasheet of 16F819,it is mentioned :

The interrupt-on-change feature is recommended for
wake-up on key depression operation and operations
where PORTB is only used for the interrupt-on-change
feature. Polling of PORTB is not recommended while
using the interrupt-on-change feature.

I am unable to understand the reason for this condition.
In my application,RB0 is used as an edge triggered interrupt,while RB1~RB3 are used as polled inputs.I wish to use RB4 as an "interrupt-on-change ".RB5~RB7 are used as outputs.
Would this be doable ?
 
If you're continually polling portb then you may miss some interrupts.

Mike.
 
I believe (but can't find where I read it) that if you read the port at the same time as a pin changes then the interrupt flag doesn't get set and therefore no interrupt is generated.

Mike.
 
I wrote a program where the input would be polled in a loop. It would wait in this loop for an input.
It had me confused, Why was it not seeing any input and was stuck in this loop?
I realized that it never saw the input because it was interrupted every time it had an input.
 
Could not quite understand that.Did you have "interrupt on change" enabled ? Even then it should read the input,if you reset the RBIF flag in the ISR.
 
I wish I could remember all the details. I'll have to see what I put in my notebook under stupid mistakes. It's heck being a senior.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top