nRF51 SDK - S130 SoftDevice
|
The Low Power Comparator (LPCOMP) Example demonstrates how to use the Low Power Comparator peripheral and the LPCOMP driver.
The example initializes LPCOMP to constantly monitor the level of the analog input 2 (AIN2). If the level falls below half of the power supply, the registered event handler is called.
Information about the detected events is forwarded to the registered LPCOMP event handler, which then increases counters. This event handler is called in an interrupt context; therefore, it should return as quickly as possible. If LPCOMP IRQ priority is set to NRF_APP_PRIORITY_HIGH, there is a limitation in calling SoftDevice functions from the event handler.
The name of the example is lpcomp_pca10028. If you are not using the Keil Pack Installer, you can find the source code and project file of the example in the following folder: <InstallFolder>\examples\peripheral\lpcomp
Test the LPCOMP example application by performing the following steps:
To generate a voltage change on AIN2, short pin P0.01 with P0.02. This should indicate two events every second.
On PCA10028, you can also connect pin P0.01 with pin P0.17, where Button 1 is connected. Every button press will then generate an event, and information should be output on UART.