|
|
View previous topic :: View next topic |
Author |
Message |
ritchie
Joined: 13 Sep 2003 Posts: 87
|
PortB Interrupt-On-Change |
Posted: Fri Aug 06, 2004 9:11 am |
|
|
Hello,
Anyone in the community that can explain on how interrupt-on-change work? If I have a square wave... how this interrupt occur?
Need your info...
thnx |
|
|
Ttelmah Guest
|
Re: PortB Interrupt-On-Change |
Posted: Fri Aug 06, 2004 9:27 am |
|
|
ritchie wrote: | Hello,
Anyone in the community that can explain on how interrupt-on-change work? If I have a square wave... how this interrupt occur?
Need your info...
thnx |
It does exactly what it says.
You get an interrupt, whenever any of the four input pins B4:7, disagree with the value held in a latch inside the chip, which is set whenever the port is read.
So to use it, read portB. Enable the interrupt. Then when any of these pins change state, there will be an interrupt. Inside the handler, you _must_ read the port, otherwise the latch will remain in it's old state, and the interrupt will repeat.
In you case, if you wired port B7,6 and 5 to +5v with a pull up resistor, and fed the square wave into B4, with a handler that simply reads port B, the system will interrupt on each edge of the square wave.
Remember the interrupt latency though...
Best Wishes |
|
|
ritchie
Joined: 13 Sep 2003 Posts: 87
|
Re: PortB Interrupt-On-Change |
Posted: Sun Aug 08, 2004 10:24 pm |
|
|
Ttelmah wrote: | ritchie wrote: | Hello,
Anyone in the community that can explain on how interrupt-on-change work? If I have a square wave... how this interrupt occur?
Need your info...
thnx |
It does exactly what it says.
You get an interrupt, whenever any of the four input pins B4:7, disagree with the value held in a latch inside the chip, which is set whenever the port is read.
So to use it, read portB. Enable the interrupt. Then when any of these pins change state, there will be an interrupt. Inside the handler, you _must_ read the port, otherwise the latch will remain in it's old state, and the interrupt will repeat.
In you case, if you wired port B7,6 and 5 to +5v with a pull up resistor, and fed the square wave into B4, with a handler that simply reads port B, the system will interrupt on each edge of the square wave.
Remember the interrupt latency though...
Best Wishes |
It simply means that you get an interrupt for a rising edge then another interrupt for falling edge...
The condition here is to read portB such that the system will interrupt on each edges (rising & falling edge)..
Am I correct with my understanding on the reply by Ttelmah?
Can you provide me a simple snippet on interrupt-on-port change...
Thank you... |
|
|
Ttelmah Guest
|
Re: PortB Interrupt-On-Change |
Posted: Wed Aug 11, 2004 2:53 am |
|
|
ritchie wrote: | Ttelmah wrote: | ritchie wrote: | Hello,
Anyone in the community that can explain on how interrupt-on-change work? If I have a square wave... how this interrupt occur?
Need your info...
thnx |
It does exactly what it says.
You get an interrupt, whenever any of the four input pins B4:7, disagree with the value held in a latch inside the chip, which is set whenever the port is read.
So to use it, read portB. Enable the interrupt. Then when any of these pins change state, there will be an interrupt. Inside the handler, you _must_ read the port, otherwise the latch will remain in it's old state, and the interrupt will repeat.
In you case, if you wired port B7,6 and 5 to +5v with a pull up resistor, and fed the square wave into B4, with a handler that simply reads port B, the system will interrupt on each edge of the square wave.
Remember the interrupt latency though...
Best Wishes |
It simply means that you get an interrupt for a rising edge then another interrupt for falling edge...
The condition here is to read portB such that the system will interrupt on each edges (rising & falling edge)..
Am I correct with my understanding on the reply by Ttelmah?
Can you provide me a simple snippet on interrupt-on-port change...
Thank you... |
Look at EX_PBUTT.C in the examples.
Best Wishes |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|