ContentsIndex
PreviousUpNext
ADC
Topics | Structs, Records, Enums
Description

Converts voltage input to discrete integers on Analog input pins.

Introduction

ADC (Analog-to-digital converter) module can be used to read the value of an assigned analog input pin and converts the input voltage value 0 ~ 5V to discrete integers 0 ~ 1023. Refer to the pin table for pins that can be assigned as an analog input. To use ADC API, follow these steps: 

 

  1. Setup the pin mode to VM_DCL_PIN_MODE_ADC with vm_dcl_config_pin_mode.
  2. Open the VM_DCL_ADC device with vm_dcl_open.
  3. Create a ADC object with command VM_DCL_ADC_COMMAND_CREATE_OBJECT, which takes vm_dcl_adc_control_create_object_t as input.
  4. Configure the vm_dcl_adc_control_create_object_t input with the channel to be read. Use PIN2CHANNEL to convert from pin names, e.g. A0, A1, to the physical channel id required in vm_dcl_adc_control_create_object_t.
  5. Register the event VM_DCL_ADC_GET_RESULT with vm_dcl_register_callback.
  6. Send the command VM_DCL_ADC_COMMAND_SEND_START to start the voltage measurement.
  7. Once a measurement is completed, event VM_DCL_ADC_GET_RESULT arrives with parameter vm_dcl_adc_measure_done_confirm_t.
  8. Send the command VM_DCL_ADC_COMMAND_SEND_STOP to stop the voltage measurement.
Limitation

The pins that can be used as analog input is different on each HDK. Refer to the HDK documentation for available pins and their input limitations.

Group
Structs, Records, Enums
Struct, Record, Enum 
Description 
The channel name for VM_DCL_ADC_COMMAND_GET_CHANNEL command. Note that not all of the channels are available. Refer to the HDK pin table and pin-out diagram for the corresponding GPIO pin number, or, use the macro PIN2CHANNEL in vmdcl.h to convert pin name to corresponding VM_DCL_ADC_CHANNEL. 
The control commands of ADC module. 
The structure of ADC control command VM_DCL_ADC_COMMAND_CREATE_OBJECT. 
The structure of ADC control command VM_DCL_ADC_COMMAND_GET_CHANNEL. 
The structure of ADC control command VM_DCL_ADC_COMMAND_MODIFY_PARAMETER. 
The structure of ADC control command VM_DCL_ADC_COMMAND_SEND_START. 
The structure of ADC control command VM_DCL_ADC_COMMAND_SEND_STOP. 
This enum type represents the device of ADC (Analog Digital Convert) module. The vm_dcl_open() uses the enum values to create a handle to access the device. Applications should use the DCL (Driver Common Layer) APIs to control the ACD module. Different analog input pins are defined in VM_DCL_ADC_CHANNEL
ADC module events. 
The structure of ADC measure result for event VM_DCL_ADC_GET_RESULT. 
Links
Created with a commercial version of Doc-O-Matic. In order to make this message disappear you need to register this software. If you have problems registering this software please contact us at support@toolsfactory.com.