3.3 ADCC Continuous Operation in Sleep Mode and Threshold Comparison

Some sensor applications like automatic streetlight control systems and liquid/water level monitoring systems need continuous monitoring of the sensor output until it has reached the desired threshold limit. In battery-operated sensor nodes, low-power operation of the application is required to extend the battery life.

ADCC in the PIC16F17146/18146 family of microcontrollers can operate autonomously in Sleep mode and continuously monitor the analog sensors with the built-in threshold comparison and continuous sampling features. When working in Sleep mode, ADCC can generate an interrupt whenever the desired threshold is reached, and the CPU can wake up from Sleep mode to take appropriate action. The application described below demonstrates the usage of ADCC continuous sampling, Sleep mode operation, and threshold comparison features. Figure 3-8 shows the Street Light control system and water/liquid level monitoring system with an auto on/off feature.

To enable ADCC operation in Sleep mode, select internal ADCRC as the clock source to ADCC, enable Continuous Sampling mode, and configure ADC Upper Threshold (ADUTH) and the ADC Lower Threshold (ADLTH) registers to set lower and upper threshold values. Then, start the ADCC conversion and put the microcontroller in Sleep mode.

The ADCC peripheral starts operating autonomously in Sleep mode, and the Continuous Sampling mode retriggers automatic sampling of ADCC each time after the ADCC result has been compared with the threshold. By this, the ADCC operates in Sleep mode without CPU intervention and wakes the CPU only when the ADCC conversion result crosses above or below the threshold value. Which, in turn, lowers the microcontroller's average power consumption. If the ADCC conversion result goes below the lower threshold limit, ADCC generates a threshold interrupt and wakes the CPU from Sleep mode. The application turns on the streetlight or the pump motor to fill the tank and enable the upper threshold interrupt. The application starts the ADCC conversion with a Continuous Sampling mode set and puts the CPU in Sleep mode. If the ADCC conversion result passes the upper threshold limit, ADCC generates a threshold interrupt and wakes the CPU from Sleep mode. The application turns off the streetlight as there is sufficient ambient light or turns off the pump motor as the tank is full and enables the lower threshold interrupt. The application starts the ADCC conversion with a Continuous Sampling mode set and puts the CPU in Sleep mode.
Figure 3-8. Street Light Control System and Liquid/Water Level Monitor