Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob

WICED Smart ADC Example

lock attach
Attachments are accessible only for community members.

WICED Smart ADC Example

JacobT_81
Employee
Employee
250 replies posted 100 replies posted 50 replies posted

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:

     Import:

     #include "adc.h"

     Instantiate in create function:

     adc_config();

     And poll the ADC using the function:

          adc_readVoltage(adc_convertGPIOtoADCInput(gpio_number));

*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.

     adc_adcCalibrate(2000, ADC_INPUT_VDDIO);

The output of the polling function is in mV.

jakewtorres

More info on the ADC:

     BCM20732S ADC Configuration

     BCM20737S - ADC Noise-free resolution

     Questions related to the ADC implementation on the BCM2073XS...

     BCM20737 ADC DMA or Interrupt Service Routine

Attachments
1044 Views
Contributors