R_Adc_Control() - Renesas RX110 Application Note

12-bit a/d converter support
Table of Contents

Advertisement

RX Family
3.3

R_ADC_Control()

This function provides commands for enabling channels and sensors and for runtime operations. These include
enabling/disabling trigger sources and interrupts, initiating a software trigger, and checking for scan completion.
Format
adc_err_t R_ADC_Control(uint8_t
Parameters
unit
0 or 1. For MCUs with only one unit 0 should be passed (only the RX64M/RX71M/RX65x have 2 units).
cmd
Command to run. See type adc_cmd_t in section 2.10 for the MCU being used.
Some commands require arguments. All other commands should use FIT_NO_PTR/NULL for the p_cfg argument.
p_cfg
Pointer to optional configuration structure. FIT_NO_PTR/NULL for most commands. See type
in section 2.10 for the MCU being used.
Return Values
ADC_SUCCESS:
ADC_ERR_MISSING_PTR:
ADC_ERR_INVALID_ARG:
ADC_ERR_ILLEGAL_ARG:
ADC_ERR_SCAN_NOT_DONE:
ADC_ERR_TRIG_ENABLED:
ADC_ERR_CONDITION_NOT_MET:
Properties
Prototyped in file "r_s12ad_rx_if.h"
Description
Provides commands for enabling channels and sensors and for runtime operations. These include enabling/disabling
trigger sources and interrupts, initiating a software trigger, and checking for scan completion.
After an Open() call, the following sequence of Control() commands should be issued (MCU dependent):
1) Optionally issue commands for special hardware configuration (ADC_CMD_SET_DDA_STATE_CNT and/or
ADC_CMD_SET_SAMPLE_STATE_CNT, ADC_CMD_USE_VREFL0, ADC_CMD_USE_VREFH0).
2) Issue a command to configure channels, sensors, and comparator
(ADC_CMD_ENABLE_CHANS, ADC_CMD_EN_COMPARATOR_LEVEL, and/or
ADC_CMD_EN_COMPARATOR_WINDOW, ADC_CMD_ENABLE_TEMP_SENSOR,
ADC_CMD_ENABLE_VOLT_SENSOR).
3) Issue a command to enable hardware triggers or cause a software trigger (ADC_CMD_TRIG_ENABLE or
ADC_CMD_SCAN_NOW).
4) If polling instead of using interrupts, check for completion of scan or comparator match
(ADC_CMD_CHECK_SCAN_DONE, ADC_CMD_CHECK_SCAN_DONE_GROUPA or
ADC_CMD_CHECK_SCAN_DONE_GROUPB, ADC_CMD_CHECK_CONDITION_MET).
5) When the scan completes, the converted data is accessed using the Read() function at the application or
interrupt level.
To set values of parameters used in this function, first clear all members of parameters to 0, and then set values.
R01AN1666EJ0220 Rev. 2.20
Dec 01, 2016
ADC Module Using Firmware Integration Technology
unit,
adc_cmd_t const cmd,
void * const
p_cfg);
Successful
p_cfg pointer is FIT_NO_PTR/NULL when required as an argument
cmd or element of p_cfg structure has invalid value.
cmd is illegal based upon mode
The requested scan has not completed
Cannot configure comparator because scan still running
No channels/sensors met the comparison condition
adc_ch_cfg_t
Page 56 of 74

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents