hello,
i have problem with delay function in interrupt , i put it also in the main but it still not working , just i need pin rc6 still high after the interruption a few seond thanks
void interrupt (void){
unsigned char dummy;
bit oldstate;
if ((PORTA.F0==1)&& (INTCON.TMR0IF==1))
{ PORTC.F3 = 1;
PORTC.F4 = 0;
dummy = PORTA;
dummy = PORTB;
INTCON.TMR0IF =0 ; }
else if ( (PORTA.F1==1) &&(INTCON.TMR0IF==1) )
{ PORTC.F3 = 0;
PORTC.F4 = 1;
dummy = PORTA;
dummy = PORTB;
INTCON.TMR0IF =0 ;
}
else if ((INTCON.TMR0IF==1)&&(Button(& PORTA, 2, 1, 1)))
{oldstate = 1;
INTCON.TMR0IF =0 ;
}
else if ((INTCON.TMR0IF==1)&& (Button(&PORTA, 2, 1, 0))&& (oldstate==1))
{
PORTC.F6=1;
dummy = PORTA;
dummy = PORTB;
INTCON.TMR0IF =0 ;
oldstate=0;
Delay_ms(1000);
PORTC.F6=0;
}
}
void main() {
int cnt ;
bit oldstate;
ANSELA = ANSELB = ANSELC= 0; //all pins I/o are cofigurred as digital
C1ON_bit = C2ON_bit = 0; //Désactivation de deux comparateurs
INTCON.GIE =1 ; // Gener al interrupt enabled
TMR0 = 0;
INTCON.TMR0IE=1;
INTCON.TMR0IF=0;
OPTION_REG = 00000100 ;
//OPTION_REG.TMR0CS=1;
// OPTION_REG.INTEDG:=1;
OPTION_REG.TMR0CS=0;
OPTION_REG.PSA=0;
TRISA=0b11111111; // PortA input
TRISB=0b00010000; //RB4 input , others output
TRISC=0b00000111 ; //portC RC0,RC1,RC2 input , others output
PORTC.F7=0;
PORTC.F4=0;
PORTC.F3=0;
PORTC.F6=0;
do {
}while (1);
}
i have problem with delay function in interrupt , i put it also in the main but it still not working , just i need pin rc6 still high after the interruption a few seond thanks
void interrupt (void){
unsigned char dummy;
bit oldstate;
if ((PORTA.F0==1)&& (INTCON.TMR0IF==1))
{ PORTC.F3 = 1;
PORTC.F4 = 0;
dummy = PORTA;
dummy = PORTB;
INTCON.TMR0IF =0 ; }
else if ( (PORTA.F1==1) &&(INTCON.TMR0IF==1) )
{ PORTC.F3 = 0;
PORTC.F4 = 1;
dummy = PORTA;
dummy = PORTB;
INTCON.TMR0IF =0 ;
}
else if ((INTCON.TMR0IF==1)&&(Button(& PORTA, 2, 1, 1)))
{oldstate = 1;
INTCON.TMR0IF =0 ;
}
else if ((INTCON.TMR0IF==1)&& (Button(&PORTA, 2, 1, 0))&& (oldstate==1))
{
PORTC.F6=1;
dummy = PORTA;
dummy = PORTB;
INTCON.TMR0IF =0 ;
oldstate=0;
Delay_ms(1000);
PORTC.F6=0;
}
}
void main() {
int cnt ;
bit oldstate;
ANSELA = ANSELB = ANSELC= 0; //all pins I/o are cofigurred as digital
C1ON_bit = C2ON_bit = 0; //Désactivation de deux comparateurs
INTCON.GIE =1 ; // Gener al interrupt enabled
TMR0 = 0;
INTCON.TMR0IE=1;
INTCON.TMR0IF=0;
OPTION_REG = 00000100 ;
//OPTION_REG.TMR0CS=1;
// OPTION_REG.INTEDG:=1;
OPTION_REG.TMR0CS=0;
OPTION_REG.PSA=0;
TRISA=0b11111111; // PortA input
TRISB=0b00010000; //RB4 input , others output
TRISC=0b00000111 ; //portC RC0,RC1,RC2 input , others output
PORTC.F7=0;
PORTC.F4=0;
PORTC.F3=0;
PORTC.F6=0;
do {
}while (1);
}