11.07.2015 Views

PICBASIC PLUS LITE Manual - Profe Saul

PICBASIC PLUS LITE Manual - Profe Saul

PICBASIC PLUS LITE Manual - Profe Saul

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>PICBASIC</strong> <strong>PLUS</strong> Compiler5.68. SLEEPSyntax : SLEEP { Length }Overview :Operators :Places the PIC into low power mode for approx n seconds. i.e. powerdown but leaves the port pins in their previous states.Length is an optional variable or constant (1-65535) that specifies theduration of sleep in seconds. If length is omitted, then the SLEEPcommand is assumed to be the assembler mnemonic, which meansthe PIC will sleep continuously, or until the Watchdog timer wakes itup.Example : SYMBOL LED = PORTA.0Again: HIGH LED ‘ Turn LED on.DELAYMS 1000 ‘ Wait 1 second.LOW LED‘ Turn LED off.SLEEP 60‘ Sleep for 1 minute.GOTO AgainNotes :SLEEP will place the PIC into a low power mode for the specifiedperiod of seconds. Period is 16 bits, so delays of up to 65,535 secondsare the limit (a little over 18 hours) SLEEP uses the WatchdogTimer so it is independent of the oscillator frequency. The smallestunits is about 2.3 seconds and may vary depending on specificenvironmental conditions and the device used.The SLEEP command is used to put the PIC in a low power modewithout resetting the registers. Allowing continual program executionupon waking up from the SLEEP period.Waking the PIC from SLEEPAll the PICmicro range have the ability to be placed into a low powermode, consuming micro Amps of current.The command for doing this is SLEEP. The compiler’s SLEEP commandor the assembler’s SLEEP instruction may be used. The compiler’sSLEEP command differs somewhat to the assembler’s in thatthe compiler’s version will place the PIC into low power mode for nseconds (where n is a value from 0 to 65535). The assembler’s versionstill places the PIC into low power mode, however, it does thisforever, or until an internal or external source wakes it. This samesource also wakes the PIC when using the compiler’s command.Many things can wake the PIC from its sleep, the WATCHDOGTIMER is the main cause and is what the compiler’s SLEEP commanduses.125Copyright Crownhill 2001

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!