|
|
View previous topic :: View next topic |
Author |
Message |
Srig007 Guest
|
interrupt question |
Posted: Wed Jan 03, 2007 3:22 pm |
|
|
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
|
|
Posted: Wed Jan 03, 2007 3:37 pm |
|
|
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 |
|
|
|
|
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
|