DolphinV4 API  1.6.1.0
Ultra Low Power functions

There are special designed functions for ultra low power applications available in Dolphin API, recommended to be used to get the best performance. This chapter describes the philosophy of using these functions.

Analog measurements

To perform an analogue measurement it is necessary to measure a reference voltage and the source voltage, and then scale it. Because of hardware limitations to measure very small and very large voltages, every measurement consists of two measurements against an internal 0.9 V voltage. So in sum we get 4 measurement values for the scaling computing. As the reference voltage should be constant it is only necessary to measure it once. And if the source voltage is a single measurement against VSS it is also possible to measure it once and reuse that measurement value for scaling.

The example below shows the use of that functions for performing a single ended measurement of ADIO_1:

io_enableAnalog(1); // configuring hardware for analog measurement no VGA, increase current to Analog current
io_ulpMeasAnalog(RVDD , RVSS, &s16posref); // measure positive reference against internal reference voltage
io_ulpMeasAnalog(GPIO1_ADIO_0 , RVSS, &s16adio0value); // measure ADIO_0 against internal reference voltage
io_ulpScaleAnalog(s16posref, s16adio0value, 8, &u16gSetPointAD); // scale the measured value
io_enableAnalog(0); // restoring previous configuration for radio functionality and reduce current to CPU current

The result of the measurement is in s16adio0value, scaled to 8 bit with the reference of RVDD, whose value is s16posref. It is important to call io_enableAnalog directly before and after measurement, because it switches on and off the ASIC analogue circuitry. Not calling io_enableAnalog(0) as soon as possible causes higher consumption. energy.

The difference of using these functions instead of io_measAnalog is the optimized runtime.

Timer functions

It is possible to use the time_wait function in ultra low power applications for implementing time delays. To save energy this function switches to standby mode and will be waked up by the unused timer0 of the Dolphin chip, which is usually reserved for the scheduler. When the scheduler runs in non ulp applications the time_wait function waits in CPU mode, using the scheduler for computing the delay.

Note:
Autarkic Sensor Example provides a good example how to use ULP function