Magazines: AutoSpeed  |  V8X  |  Silicon Chip  Shopping: Property  |  Cars  |  Fishing
Email Address:
Password:

Lost your password?

Article Search

The PICAXE Part 8 - A Datalogger and Sending it to Sleep

To sleep, perchance to dream (or nap)...(and PICAXE datalogging too!)

By Stan Swan

 Advertisement
Advertisement 

Click for larger image

Given the prevalence of portable devices (refer June "SILICON CHIP" editorial!) this alone should win favour for projects such as torches and data loggers used away from a mains supply.

There are four distinct commands, and several code techniques, to organise this.

PAUSE - introduces a program delay in milliseconds.

Example: pause 100 = 100ms

Maximum delay is 65535ms (a little over one minute) with about 1ms overhead. Of course, we've used pause a lot in earlier articles for LED flashing etc. No power saving.

WAIT - equivalent to pause, but with larger units

Example: wait 10 = 10 seconds

Up to 65.5 seconds wait possible, but again no power saving activated

NAP - Enters a low power short period mode.

Example: nap 3 yields a 144ms delay.

The eight nap period values (0-7), yield a duration given by the formula:

Delay (in ms) = 2^time value x 18.

Hence Nap 0= 18ms, while nap 1= 36ms, nap 2= 72 ms , nap 3 = 144ms etc. Nap 7 = 2304ms (2.3 seconds).

SLEEP - Also enters a low power long period mode (2.3 seconds units). Example: Sleep 10 = ~23 seconds.
Although of high accuracy, resolution is lower and overall times can amount to ±1% deviation (perhaps up to 30 seconds drift in an hour.) The maximum sleep value, of 65535 (being 256 x 256) extends to days, but could be temperature dependent. Hence don't set your alarm clock by this...

 RSS  |  Privacy Policy  |  Advertise  |  Contact Us

Copyright © 1996-2009 Silicon Chip Publications Pty Ltd & Web Publications Pty Limited. All Rights Reserved