CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

PortB Interrupt-On-Change

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
ritchie



Joined: 13 Sep 2003
Posts: 87

View user's profile Send private message

PortB Interrupt-On-Change
PostPosted: Fri Aug 06, 2004 9:11 am     Reply with quote

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
PostPosted: Fri Aug 06, 2004 9:27 am     Reply with quote

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

View user's profile Send private message

Re: PortB Interrupt-On-Change
PostPosted: Sun Aug 08, 2004 10:24 pm     Reply with quote

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
PostPosted: Wed Aug 11, 2004 2:53 am     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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