3.2 Standby Mode Example on PIC32CM PL10

In this implementation, the CPU enters Standby mode between sampling cycles instead of remaining in Active mode. The CPU wakes every 100 ms on a Real-Time Counter (RTC) interrupt to trigger the ambient light sensor sampling cycle, and also returns to Standby during the 10 ms sensor warm-up period while a Timer/Counter 1 (TC1) runs with its RUNSTDBY bit enabled. Once the warm-up completes, the CPU wakes to perform the same operations as the Active mode implementation of software-triggered ADC conversions, averaging, and conditional Universal Asynchronous Receiver/Transmitter (UART) transmission, all before returning to Standby. The power consumption for this approach was measured using the Atmel Power Debugger and captured with the MPLAB Data Visualizer, as shown in the following figures.

Figure 3-3. Standby Mode Sequence Flow Diagram with Interrupts
Figure 3-4. Power Consumption for Standby Mode: Below Threshold (No UART Activity)
Figure 3-5. Power Consumption for Standby Mode: Above Threshold (With UART Transmission)

The key difference from the Active mode implementation is visible in the power waveform baseline. Between sampling events, the current drops to the Standby level rather than remaining at the Active mode baseline, producing the characteristic regular spike pattern visible in both figures.

When the ambient light reading is below the transmission threshold, the Power Analysis reports an average of ~1.08 mA, an 82.5% reduction from the 6.18 mA Active mode baseline. Peak currents of up to 1.96 mA occur during the brief ADC sampling and processing bursts each time the CPU wakes. When the threshold is exceeded and UART transmission occurs, the average rises to ~1.26 mA due to the additional current drawn during each transmission event, with peaks reaching 3.76 mA. In both scenarios, the CPU still wakes for every 100 ms sampling cycle, executing the full processing sequence before returning to Standby, even when no actionable condition is detected. This mandatory wake-up on every sample represents the remaining inefficiency that SleepWalking is designed to address.