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

interrupt question

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







interrupt question
PostPosted: Wed Jan 03, 2007 3:22 pm     Reply with quote

Can someone please tell me what the following three line does, also I would like to know where the program will point to when the interrupt flag is set.

Set_Tris_B(0b00110000);//Set Port B.4 and B.5 to Input (Pause)
enable_Interrupts(Global);
enable_Interrupts(INT_RB);

Does this mean that whenever the PORTB.4 and/or PortB.5 pin is set to low logic level, the interrupt will occur?

Can someone please help me understand this concept please! thanks


Srig
Ttelmah
Guest







PostPosted: Wed Jan 03, 2007 3:37 pm     Reply with quote

No.
INT_RB, will trigger whenever any of the pins B4 to B7 _changes_ from the current latched state.
The state is latched whenever the port is read.
The TRIS statement sets pins B4, and B5 as inputs (this will be overwritten if any I/O function is perfromed on portB, _unless_ fast_io, or fixed_io is selected).
As it stands, there ought to be another line in front of the three shown, reading the port. This will reset the latch to the current signal levels. Then when either B4, or B5 _changes_, the interrupt will occur. The interrupt code itself will need to read the port, otherwise the interrupt will remain triggered permanently, so long as the signals are in the different state.

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