flip
- 22nd April 2006, 20:39
I made a small program written in PICBASIC using a PIC 16F628a.
I do not understand how to use the sleep instruction in a correct way.
device 16F628A
Config INTRC_OSC_NOCLKOUT, WDT_OFF,MCLRE_OFF
clear
TRISB.5=1
TRISB.0=0
INTCON=%00011000
OPTION_REG.6=1
OPTION_REG.7=0
SYMBOL LED = PORTB.0
Again:
HIGH LED ' Turn LED on.
DELAYMS 1000 ' Wait 1 second.
LOW LED ' Turn LED off.
DELAYMS 1000 ' Wait 1 second.
HIGH LED ' Turn LED on.
DELAYMS 1000 ' Wait 1 second.
LOW LED ' Turn LED off.
INTCON.1=0
INTCON.0=0
SLEEP
delayms 250
GOTO Again
On port B5 (pin 11) I have connected a switch to wake up the PIC
The led on port b.0 is flashing twice after switching on the power and then the PIC goes asleep.
Waking up through pushing the switch doesn't work.
Who is having any good solution for my problem?
I do not understand how to use the sleep instruction in a correct way.
device 16F628A
Config INTRC_OSC_NOCLKOUT, WDT_OFF,MCLRE_OFF
clear
TRISB.5=1
TRISB.0=0
INTCON=%00011000
OPTION_REG.6=1
OPTION_REG.7=0
SYMBOL LED = PORTB.0
Again:
HIGH LED ' Turn LED on.
DELAYMS 1000 ' Wait 1 second.
LOW LED ' Turn LED off.
DELAYMS 1000 ' Wait 1 second.
HIGH LED ' Turn LED on.
DELAYMS 1000 ' Wait 1 second.
LOW LED ' Turn LED off.
INTCON.1=0
INTCON.0=0
SLEEP
delayms 250
GOTO Again
On port B5 (pin 11) I have connected a switch to wake up the PIC
The led on port b.0 is flashing twice after switching on the power and then the PIC goes asleep.
Waking up through pushing the switch doesn't work.
Who is having any good solution for my problem?