User`s manual

RX62N Group, RX621 Group 4. Library Reference
4) R_ADC_10_Read
Synopsis
Read the ADC conversion results.
Prototype
bool R_ADC_10_Read(
uint8_t data1,
// ADC unit selection
uint16_t * data2
// Pointer to the buffer where the converted values are to be stored
);
Description
Reads the conversion values for an ADC unit.
[data1]
Select the ADC unit (0 or 1) to be read.
[data2]
Specify a pointer to a variable or array where the results shall be stored.
Return value
True if a valid unit is selected; otherwise false.
Category
ADC
Reference
R_ADC_10_Create, R_ADC_10_Control
Remarks
Between 1 and 4 conversion results will be read and stored. The number depends on the
settings for "Input channel selection" and "Scan mode" when R_ADC_10_Create is used to
configure the ADC unit.
The 10-bit data alignment is controlled using the R_ADC_10_Create function.
Ensure that the buffer is big enough for the requested number of values.
If no callback function is used, this function waits for the ADI flag to indicate that conversion is
complete before reading the results. If the ADC unit’s control registers are directly modified by
the user, this function may lock up.
Program example
/* RPDL definitions */
#include "r_pdl_adc_10.h"
/* RPDL device-specific definitions */
#include "r_pdl_definitions.h"
void func(void)
{
uint16_t ADCresult[2];
/* Read the ADC values for unit 2 */
R_ADC_10_Read(
2,
ADCresult
);
}
R20UT0084EE0112 Rev.1.12 Page 4-227
July. 16, 2014