User`s manual

RX62N Group, RX621 Group 4. Library Reference
4) R_ADC_12_Read
Synopsis
Read the ADC conversion results.
Prototype
bool R_ADC_12_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 to be used. This must always be 0.
[data2]
Specify a pointer to an array where the results shall be stored.
Return value
True if a valid unit is selected; otherwise false.
Category
12-bit ADC
Reference
R_ADC_12_Create
Remarks
Ensure that the storage area has room for all 8 channels. Only active channels will be read and
the value stored in the appropriate array location.
The data alignment is controlled using the R_ADC_12_Createfunction.
If no callback function is used, this function waits for the ADI12_0 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_12.h"
/* RPDL device-specific definitions */
#include "r_pdl_definitions.h"
void func(void)
{
uint16_t ADCresult[8];
/* Read the ADC */
R_ADC_12_Read(
0,
ADCresult
);
}
R20UT0084EE0112 Rev.1.12 Page 4-220
July. 16, 2014