Hello all, I'm trying to make a low power app that use interrupts on RB4-5-6-7 port change.
The problem is that it's always awake so LD1 blink continuously. Portb internal pull-up are enabled so I want interrupt when RB4-5-6-7 goes low.
This is my test code:
can someone help me to understand where is the problem (probably I miss something) and how to make it works?Code:OSCCON = %01001110 '1MHz int osc ANSEL = 0 ANSELH = 0 ADCON0.0 = 0 CCP1CON = 0 CCP2CON = 0 REGISTER CM1CON0.7 = 0 CM2CON0.7 = 0 CVRCON.7 = 0 CVRCON2.7 = 0 HLVDCON.4 = 0 INTCON.3 = 1 INTCON.4 = 0 INTCON2.7 = 0 SSPCON1 = 0 TRISB=%11111111 IOCB.7=1 IOCB.6=1 IOCB.5=1 IOCB.4=1 SW1 VAR PORTB.4 SW2 VAR PORTB.5 SW3 VAR PORTB.6 SW4 VAR PORTB.7 LD1 VAR PORTA.0 HIGH LD1 INTCON.0=0 ciclo: TOGGLE LD1 IF (SW1 == 0) THEN HIGH LD2 ENDIF ASM sleep ENDASM INTCON.0=0 LOW LD2 pause 100 goto ciclo
very thanks!
Bookmarks