I am currently prototyping a device that uses the ZX-24a. It is battery-powered and minimizes power by putting all peripherals into sleep mode and finally powering down the CPU (later waking up via a watchdog timeout). Current measurements with the CPU powered down compared to the ZX-24a out of the circuit show that the powered-down CPU consumes about 4.1mA. I am powering the circuit via 5V at pin 21. It appears to me that the current contribution of U4, R1, R2, R7 (LEDs off) and other discrete components should be negligible.
What should be the lowest current that the ZX-24a can go to? -- it appears that the AT25256A chip select is left low between accesses and so never goes into standby mode. Its data sheet shows a non-sleep current of up to 7mA -- is this the culprit?
ZX-24a power down current
Re: ZX-24a power down current
rholch wrote:t appears that the AT25256A chip select is left low between accesses and so never goes into standby mode. Its data sheet shows a non-sleep current of up to 7mA -- is this the culprit?
It sounds that may be a problem. It may be fairly easy to deselect the EEPROM before going into sleep mode (via CPUSleep()). I'm away visiting relatives this weekend so it will probably be early next week before I can look into this.
- Don Kinzer
Modifying the VM to deassert the EEPROM chip select just before entering sleep mode yielded a 2.8mA reduction of current draw. Of course, the reduction with other actual EEPROMs may be more or less.
If you'd like to try the experimental version of the ZX-24a VM with this change, I can make it available.
If you'd like to try the experimental version of the ZX-24a VM with this change, I can make it available.
- Don Kinzer
Thank you very much for getting right on this.
I would like to try the revised VM.
On a related note, I have some data values that must be retained through the power down and watchdog timeout reboot. They change too often to use the persistent memory feature. What would be great would be a PersistentRAM type that would indicate user RAM locations that will not be cleared upon a non-powerdown reset situation.
In this vein, and correct me if I'm wrong, but it would seem to be an easier way to use such RAM (as well as, perhaps, a PersistentEEPROM type) that would read/write data to such areas automatically without the need for subroutine calls such as Get/PutPersistent.
I would like to try the revised VM.
On a related note, I have some data values that must be retained through the power down and watchdog timeout reboot. They change too often to use the persistent memory feature. What would be great would be a PersistentRAM type that would indicate user RAM locations that will not be cleared upon a non-powerdown reset situation.
In this vein, and correct me if I'm wrong, but it would seem to be an easier way to use such RAM (as well as, perhaps, a PersistentEEPROM type) that would read/write data to such areas automatically without the need for subroutine calls such as Get/PutPersistent.
The new VM for the ZX-24a is at http://www.zbasic.net/download/zvm/2.1/zx24a_2-1-1.zvm. The only difference is that the EEPROM is deselected before going into sleep mode.rholch wrote:I would like to try the revised VM.
What you describe can be easily done using a based variable. For example, say you want to have an UnsignedInteger RAM-based variable at address &H0c00.rholch wrote:[It]would seem to be an easier way to use such RAM (as well as, perhaps, a PersistentEEPROM type) that would read/write data to such areas automatically without the need for subroutine calls such as Get/PutPersistent.
Code: Select all
Dim myVar as UnsignedInteger Based &H0c00
For RAM-based variables, the more difficult problem lies in determining a suitable address to use. The compile-time constant Register.RamUsed indicates the size of the statically allocated variables that are allocated beginning at Register.RamStart. The remainder of RAM is used for the task stack for Main() and the heap. The task stack for Main() grows upward toward higher addresses while the heap grows downward toward lower addresses. In most cases, there is some RAM in between the two that is never used. Stevech has used this idea to preserve data across resets: post-2474.html
- Don Kinzer
After going into sleep mode, a stimulus of some kind is needed to awaken the processor. It could be a watchdog reset, a level or edge input, Timer 2, etc. Depending on which wakeup stimulus you are going to use, you have to set the sleep mode and then call CPUSleep(). There is additional information, including sample code showing how to use Timer2 to wake up, at http://www.zbasic.net/forum/about691.html.Genesis wrote:I've been playing with this for some time without material success.....
- Don Kinzer