- Joined
- Jan 22, 2008
- Messages
- 53,107
- Helped
- 14,792
- Reputation
- 29,871
- Reaction score
- 14,291
- Trophy points
- 1,393
- Location
- Bochum, Germany
- Activity points
- 301,057
Change interrupt is enabled for all RB4 - RB7 pins configured as input.
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Change interrupt is enabled for all RB4 - RB7 pins configured as input.
But how i will detect ? on which RB4,RB5,RB6 or RB7 gets interrupt detected or not ? how to individually check the state ?
unsigned char x;
// Interrupt Handler
void interrupt()
{
// RB Port Change Interrupt
if(PIR1.RBIF == 1) // if the RB Port Change Interrupt flag is set...
{
PORTA.F1 = ~PORTA.F1;//LED on/off on press of switch
x = PORTB; // Need to read or write to the port to clear mismatch condition
PIR1.RBIF =0;
}
}
// code starts here...
void main()
{
TRISA = 0b00000000;
TRISB = 0b00100000; //RB5 defined as input and push switch connected to it
// Set Interrupt Enable bits
INTCON.RBIE = 1; // bit 3 RB Port Change Interrupt Enable
//Set global Interrupt Enable bits
INTCON.GIE = 1; // global interrput enable
while(1) //endless loop
{
}
}
See if you need to enable INTCON.PEIE. Use INT0 and INT1 for phase 1 and phase 2 and RBIF for OR of phase 1 and phase 2.
Are you simulating in Proteus?
As you are using mikroC ask your question in mikroe forum.