Forgot to mention, the code does wake up it from sleep as it is supposed to. It just doesn't stay asleep when it hits the @ SLEEP line.
'16F628A
DEFINE OSC 10
TRISB = %000000001
TRISA.2 = %0 'Ouput Pin for Turning On/Off LED
CMCON = 7
OPTION_REG.7=0 ' 0=Enable PORTB Pull Ups
OPTION_REG.6=0 ' 1=RB0 Rising-Edge Trigger, 0=Falling-Edge Trigger
@CONFIG.2 = 0 ' 0=Watch Dog Off
@CONFIG.6 = 0 ' 0=Brown Out Off
@CONFIG.4 = 0 ' Set for High Speed Crystal
@CONFIG.1 = 1 ' Set for High Speed Crystal
@CONFIG.0 = 0 ' Set for High Speed Crystal
top:
INTCON=%00011000 ' Interrupt Control Register
' 7=0 - GIE - Global Interrupt Enable
' 6=0 - PEIE - Peripheral Interrupt Enable
' 5=0 - TOIE - TMR0 Overflow Interrupt Enable
' 4=1 - INTE - RB0/INT Enable
' 3=1 - RBIE - PORTB change interrupt Enable
' 2=0 - TOIF - TMR0 Overflow Flag
' 1-0 - INTF - RB0/Ext Interrupt Flag
' 0=0 - RBIF - PORTB Interrupt Flag
@ SLEEP
Pause 100
PORTA.2 = 1 'Turn LED On for 1 second
pause 1000
PORTA.2 = 0 'Turn LED off before going back to sleep
goto top
Bookmarks