RL78 F13 - Needed sample code to understand DTC functionality with ADC Scan One shot mode

Dear Renesas community,

I'm looking for sample code to understand DTC with ADC scan one shot mode.

Needed scenario like 4 ADC channels conversion data want to transfer from ADCR to 4 different variables at each INTAD interrupt.

and 4 variables like arr[index], index value will be incremented at each INTAD interrupt. and index will be reseted after 4th channel ADC conversion

Could you please provide the sample code for the same?

Thanks & Regards,

Meet

Parents
  • Hello,

    Yes, I can provide this for you. 

    So when the INTAD occurs, you want to store the 4 results of the 4 ADC channels in a buffer using DTC, correct ?

  • Yes, every trigger of ADC SOC will generates 4 INTAD interrupts one by one after EOC(end of ADC conversation). 

    Steps: 

    1. So when 1st interrupt comes, transfer the result from ADC result register(source address is fixed for DTC) to arr[0] register. 

    2. Then when 2nd INTAD interrupt comes after 2nd channel ADC EOC, same ADC result register data should be copied to arr[1].

    3. Likewise for 3rd and 4th interrupt, DTC should transfer the ADC result register data into arr[2] and arr[3]. 

    4. Then array counter will reset and next trigger of ADC SOC, will start again and repeat steps from point no 1.

    Note :  I have considered 16 bit data transfer for 10bit ADC. 

    Kindly consider above scenario for sample code. 

    In addition, I have few queries as mentioned below - 

    1. for DTC destination address, how and where I can configure if the destination array is present in another file. e.g. uint16_t arr[4];

    2. How array index counters will be incremented while transferring next ADC result register data via DTC? 

    3. How DTC understand counter reset and destination address will start to store again from arr[0] ? 

    Thanks & Regards, 

    Meet

Reply
  • Yes, every trigger of ADC SOC will generates 4 INTAD interrupts one by one after EOC(end of ADC conversation). 

    Steps: 

    1. So when 1st interrupt comes, transfer the result from ADC result register(source address is fixed for DTC) to arr[0] register. 

    2. Then when 2nd INTAD interrupt comes after 2nd channel ADC EOC, same ADC result register data should be copied to arr[1].

    3. Likewise for 3rd and 4th interrupt, DTC should transfer the ADC result register data into arr[2] and arr[3]. 

    4. Then array counter will reset and next trigger of ADC SOC, will start again and repeat steps from point no 1.

    Note :  I have considered 16 bit data transfer for 10bit ADC. 

    Kindly consider above scenario for sample code. 

    In addition, I have few queries as mentioned below - 

    1. for DTC destination address, how and where I can configure if the destination array is present in another file. e.g. uint16_t arr[4];

    2. How array index counters will be incremented while transferring next ADC result register data via DTC? 

    3. How DTC understand counter reset and destination address will start to store again from arr[0] ? 

    Thanks & Regards, 

    Meet

Children