hello...
i write this code for external interrupt..
its working as when int0 goes high INT comes ,led glows on portA and when again int0 goes high ,it turn off the PORTA..
but i want that LED's goes high only if int0 is 1,when int0 becomes low led should off.
simply ,when then push button is pushed LED's should on
when push button release LED's should off.
i write this code for external interrupt..
Rich (BB code):
unsigned int flag = 0;
void interrupt() {
if (INTCON.INT0IF==1)
{
INTCON.INT0IF = 0;
flag = 1;
}
}
void main()
{
TRISA=0x00;
TRISB.F0=0x01;
ADCON1 = 0b10000111;
CMCON = 0x07;
CVRCON.CVROE = 0;
INTCON = 0b11010000;
INTCON2 = 0b11100001;
INTCON3 = 0b00000000;
while(1){
if(flag == 1){
flag = 0;
PORTA = ~PORTA;
}
}
}
but i want that LED's goes high only if int0 is 1,when int0 becomes low led should off.
simply ,when then push button is pushed LED's should on
when push button release LED's should off.