Application Note
25 of 38
001-86233 Rev. *I
2021-11-04
PSoC™ 4 MCU low
-power modes and power reduction techniques
Code examples
Figure 13
Switch power modes
You can measure the current in
PSoC™
4 development kits; see the kit guide for more information.
PS
oC™
Creator:
The project (AN86233_Power Modes) is available in the zip file associated with this application
note. With this project, you can easily compare all four low-power modes with active mode. You can edit the
code in one place to set the
PM_TO_DEMO
constant to the desired power mode constant. The following code
snippet shows an example of the code in which the deep sleep mode is selected.
/* Power Modes Constants */
#define
PM_SLEEP 1u
#define
PM_DEEP_SLEEP 2u
#define
PM_HIBERNATE 3u
#define
PM_STOP 4u
/* Set PM_TO_DEMO to power mode */
#define
PM_TO_DEMO PM_DEEP_SLEEP
After this selection is made, build the project and program the device. The project starts in active mode until
the switch on the development board is pressed. The LED flashes quickly according to the number of times
assigned to the power mode constant. In this example, the LED flashes twice for deep sleep.
The project stays in the low-power mode until the switch is pressed again. It then flashes slowly the same
number of times to let you know that the project is back in active mode. Using an ammeter, you can measure
the current in each mode. To evaluate a different power mode, set
PM_TO_DEMO
to a different power mode
constant, rebuild the project, and reprogram the
PSoC™
4 MCU device.
Note:
A separate project (AN86233_PSoC_4100PS) is available for devices without hibernate and stop
modes; it is available in the zip file. The devices that do not support hibernate or stop modes are
PSoC™
4000, 4000S, 4100S, 4100S plus, 4100S plus 256k, 4100S max, 4200DS, 4500S, 4700S, 4100PS,
and analog coprocessor product lines.