hello . im runing this coge example in pic 16f913, and when it goes to sleep it still runing on 3mA i need help bcz the datasheet says it sleep mode must be 3 uA . im sure there things wrong i didnt set and i want it not to reset the program when wakeup or durinf sleep.thank you
Code:
Include "modedefs.bas"
DEFINE CONFIG_WORD_$3F31
DEFINE INT_OSC 8
WDTCON.0 = 0
OPTION_REG = %00000001
ADCON0 = 0
OSCCON.6 = 7
intcon = 0
vrcon = 0
PORTB =%00000001
PORTA = 0
PORTC = 0
TRISB = %00000001
G VAR BYTE
H VAR BYTE
L VAR BYTE
K VAR BYTE
NOTE VAR BYTE
BUZ VAR PORTB.3
MAIN:
G = G + 1
IF G => 30 THEN slp
HIGH PORTB.1
PAUSE 100
IF PORTB.0 = 0 THEN SLP
LOW PORTB.1
PAUSE 1000
IF PORTB.0 = 0 THEN SLP
GOTO MAIN
SLP:
SOUND BUZ,[126,3,00,4,126,3,00,4,126,3,00,4,126,3,00,40,120,6,00,8,124,6,00,10,120,6,00,8,124,6]
OPTION_REG =%00000001
PAUSE 100
for NOTE = 115 TO 127
SOUND BUZ,[NOTE,3]
NEXT NOTE
HIGH PORTB.2
PAUSE 1000
LOW PORTB.2
INTCON.0 = 0 'RBIF
INTCON.3 = 1 'RBIE
INTCON.1 = 0
INTCON.4 = 1
sleep 1800
@ SLEEP
@ NOP
HIGH PORTB.2
PAUSE 1000
LOW PORTB.2
GOTO MAIN
END
Bookmarks