EasyManuals Logo

Renesas RX110 User Manual

Renesas RX110
88 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #61 background imageLoading...
Page #61 background image
RX Family ADC Module Using Firmware Integration Technology
R01AN1666EJ0220 Rev. 2.20 Page 61 of 74
Dec 01, 2016
/* Have channel 1 and 2 as Group A, have 3 and 4 as Group B,
have 5 and 6 as Group C
Perform addition/average on all channels except 9
*/
ch_cfg.scan_mask = ADC_MASK_CH1 | ADC_MASK_CH2;
ch_cfg.scan_mask_groupb = ADC_MASK_CH3 | ADC_MASK_CH4;
ch_cfg.scan_mask_groupc = ADC_MASK_CH5 | ADC_MASK_CH6;
ch_cfg.priority_groupa = ADC_GRPA_PRIORITY_OFF;
ch_cfg.add_mask = 0;
ch_cfg.diag_method = ADC_DIAG_OFF;
ch_cfg.anex_enable = false;
ch_cfg.sample_hold_mask = 0;
R_ADC_Control(0, ADC_CMD_CONFIGURE_SCAN, &ch_cfg);
/* After open, wait 1 us or longer before A/D conversion starts */
/* ENABLE TRIGGERS */
R_ADC_Control(0, ADC_CMD_ENABLE_TRIG, NULL);
/* INTERRUPT OCCURS UPON SCAN COMPLETION */
/* The callback is called twice from interrupt level- once after each
* group scan completes. The order depends upon the trigger order.
*/
void MyCallback(void *p_args)
{
adc_cb_args_t *args;
uint16_t data1,data2,data3,data4,data5,data6;
args = (adc_cb_args_t *)p_args;
/* READ RESULTS */
if (args->event == ADC_EVT_SCAN_COMPLETE)
{
/* From S12ADIO interrupt, Group A scan complete, read registers */
R_ADC_Read(0, ADC_REG_CH1, &data1);
R_ADC_Read(0, ADC_REG_CH2, &data2);
}
else if (args->event == ADC_EVT_SCAN_COMPLETE_GROUPB)
{
/* From GBADI interrupt, Group B scan complete, read registers */
R_ADC_Read(0, ADC_REG_CH3, &data3);
R_ADC_Read(0, ADC_REG_CH4, &data4);
}
else if (args->event == ADC_EVT_SCAN_COMPLETE_GROUPC)
{
/* From GCADI interrupt, Group C scan complete, read registers */
R_ADC_Read(0, ADC_REG_CH5, &data5);
R_ADC_Read(0, ADC_REG_CH6, &data6);
}
/* process data, or set flag for application level to do so */
}

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Renesas RX110 and is the answer not in the manual?

Renesas RX110 Specifications

General IconGeneral
BrandRenesas
ModelRX110
CategoryControl Unit
LanguageEnglish

Related product manuals