How to use the napping-function
My board is using batteries, and I need to save power during period of inactivity.
The specifications says that the javelin is using up to 180 mA, but in nap mode its reduced to 13 mA, it says nap mode should be used to save power.
·
What is the correct code for using CPU.nap for example 1 minute?
for (int n =0; n < 30; n++) {
· CPU.nap(7); // nap 2 secs
}
Is it the correct way to do it?
·
My second question is about nap and virtual peripherals. The javelin manual (version 1.0) says that we must remove all VPs before using the nap function. I’ have tried not to removed them, and it seems to work fine.· VP’s seems to stop and start again, for example it seems that a Timer will stop during CPU.nap(7), and start again after nap (of course·it's not possible to measure the elapsed time with Timer during napping).·
Should I remove VP’s before using the nap-function or not? If not, should take some precautions with my VP’s before napping? I’m using Timer, Uart, and ADC.
Regards
The specifications says that the javelin is using up to 180 mA, but in nap mode its reduced to 13 mA, it says nap mode should be used to save power.
·
What is the correct code for using CPU.nap for example 1 minute?
for (int n =0; n < 30; n++) {
· CPU.nap(7); // nap 2 secs
}
Is it the correct way to do it?
·
My second question is about nap and virtual peripherals. The javelin manual (version 1.0) says that we must remove all VPs before using the nap function. I’ have tried not to removed them, and it seems to work fine.· VP’s seems to stop and start again, for example it seems that a Timer will stop during CPU.nap(7), and start again after nap (of course·it's not possible to measure the elapsed time with Timer during napping).·
Should I remove VP’s before using the nap-function or not? If not, should take some precautions with my VP’s before napping? I’m using Timer, Uart, and ADC.
Regards
Comments
VP's must be stopped before, and restarted
after the nap, because otherwise some variables
used by the VP's will be in an invalid state, because
these are not updated during nap.
This may, or may not, give problems.
For receive uarts, read all bytes from the buffer
before nap, for transmit uarts make sure the buffer
is empty before nap.
regards peter.
Are there any other options for saving power? Will it help writing all the pins down (CPU.writePin(pin, false)?
Regards, Christian
Are you powering external circuitry from the
Javelin VDD pin?
regards peter
And a modem connected through rs232.
Christian
So if your external circuitry draws say 80 mA,
and the Javelin draws 13 mA during nap, you always
draw a minimum of 93 mA. To really save power
you should turn off this external circuitry. Perhaps
power this circuitry through a transistor that you
can switch with a javelin I/O pin.
(PNP transistor, collector to VDD pin, emitter to
power external circuitry, base (via 1k resistor)
to Javelin I/O pin. Making this pin low output
then turns on the external circuitry.
regards peter