WICED Smart ADC Example
The attached app shows sample usage of the ADC hardware built into the 36/37/s chips.
To use the app, load it onto a Tag board that has a push button on P0. Run traces on the board. You'll initially see ~0V, and when you press the button you'll see the applied voltage on the voltage rail (~3300mV).
There are three necessary steps to get the ADC running, as seen in the app:
Instantiate in create function:
And poll the ADC using the function:
*Calibration occurs within the initialization function. However, it may be useful to your application to calibrate the ADC to an external voltage for added assurance, or to do so periodically throughout the run-time of your application. To do so, call the function below: parameter one is the known voltage of the reference source in mV, and parameter two is the location of the reference voltage. The location can be configured to many different buses and all GPIOs (for external sources). Control click the second parameter within the source code to see a complete list of the locations that can be utilized as a reference voltage.
The output of the polling function is in mV.
More info on the ADC: