nlirette
- 25th July 2009, 15:39
i wrote this code
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
' using a 12F683 pic, pin 7 will toggle on and off every 3 minutes
' and pin 6 will toggle opposite
' when pin 7 is on, pins 2 and 3 will blink LED for short period
' every 10 seconds (pin 2 + pin 3 -)
' when pin 6 goes on (pin 7 off) pins 2 and 3 will reverse polarity
' and blink for short period every 10 seconds(pin 3 + pin 2 -)
' this will loop while power is on the chip
define osc 20 ' makes the internal oscillator 2 MHZ ( default 4 MGH )
XX var byte ' makes xx a variable
PORTB.0 = 1 ' pin 7
PORTB.1 = 1 ' pin 6
PORTB.5 = 1 ' pin 2
PORTB.4 = 1 ' pin 3
loop: ' label
High 0 ' set pin 7 on
low 1 ' set pin 6 low
low 4 ' set pin 3 low
for xx = 1 to 18 ' blink the LED on pins 2 and 3
HIGH 5
pause 25
LOW 5
pause 2000
next xx
Low 0 ' set pin 7 low
high 1 ' set pin 6 on
low 5 ' set pin 2 low
for xx = 1 to 18 ' blink the LED on pins 2 and 3 (reverse polarity)
high 4
pause 25
low 4
pause 2000
next xx
Goto loop ' Go back to loop and blink LED forever
End
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
what i would like to do is put the PIC to sleep in
the for next area of the program
when i replace the "pause 2000" to "sleep 10" it does not work
i want to save battery drain using the low power feature (sleep) of the chip
any reason why the sleep doesn't work?
Norman
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
' using a 12F683 pic, pin 7 will toggle on and off every 3 minutes
' and pin 6 will toggle opposite
' when pin 7 is on, pins 2 and 3 will blink LED for short period
' every 10 seconds (pin 2 + pin 3 -)
' when pin 6 goes on (pin 7 off) pins 2 and 3 will reverse polarity
' and blink for short period every 10 seconds(pin 3 + pin 2 -)
' this will loop while power is on the chip
define osc 20 ' makes the internal oscillator 2 MHZ ( default 4 MGH )
XX var byte ' makes xx a variable
PORTB.0 = 1 ' pin 7
PORTB.1 = 1 ' pin 6
PORTB.5 = 1 ' pin 2
PORTB.4 = 1 ' pin 3
loop: ' label
High 0 ' set pin 7 on
low 1 ' set pin 6 low
low 4 ' set pin 3 low
for xx = 1 to 18 ' blink the LED on pins 2 and 3
HIGH 5
pause 25
LOW 5
pause 2000
next xx
Low 0 ' set pin 7 low
high 1 ' set pin 6 on
low 5 ' set pin 2 low
for xx = 1 to 18 ' blink the LED on pins 2 and 3 (reverse polarity)
high 4
pause 25
low 4
pause 2000
next xx
Goto loop ' Go back to loop and blink LED forever
End
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
what i would like to do is put the PIC to sleep in
the for next area of the program
when i replace the "pause 2000" to "sleep 10" it does not work
i want to save battery drain using the low power feature (sleep) of the chip
any reason why the sleep doesn't work?
Norman