Hi All,
In one of our application, I need to have 10 ADC channels. I can use AN0 to AN7 for first 8 channels. As per reference manual, one can use multiplexed port AD pins. I would like to know how can I use them?
1. What registers should be initialized ?
2. Which register can I read to get the digital data?
Thanks in advance.
- Sagar
解決済! 解決策の投稿を見る。
Hi Sagar,
The S12GA48 may measure external analog voltages at 12 port AD pins when LQFP 48 package or bigger is selected. The number of available port AD pins may be limited for smaller packages.
The multiplexor inside ATD module is driven per ATD control registers (ATDCTL0~ATDCTL5) setting.
The ATD conversion sequence may be configured one for three options:
The digital values are stored into ATD data registers ATDDR0~ATDDR11 (for 12 channel ATD module).
If FIFO bit is 0 (default case), ATDDR0 register contains the first value from conversion sequence and next ATDDRx registers are filed subsequently by next ATD samples/channels.
In basic, you should configure ATDCTL0~ATDCTL5 registers while writing into ATDCTL5 register also works as measurement trigger (if an external trigger is not used). After that, you should wait for conversion end and read ATDDR0~ATDDRx registers.
The simple ATD example code may be downloaded for example here:
https://community.nxp.com/docs/DOC-93792
I hope it helps you.
Have a great day,
Radek
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Sagar,
The S12GA48 may measure external analog voltages at 12 port AD pins when LQFP 48 package or bigger is selected. The number of available port AD pins may be limited for smaller packages.
The multiplexor inside ATD module is driven per ATD control registers (ATDCTL0~ATDCTL5) setting.
The ATD conversion sequence may be configured one for three options:
The digital values are stored into ATD data registers ATDDR0~ATDDR11 (for 12 channel ATD module).
If FIFO bit is 0 (default case), ATDDR0 register contains the first value from conversion sequence and next ATDDRx registers are filed subsequently by next ATD samples/channels.
In basic, you should configure ATDCTL0~ATDCTL5 registers while writing into ATDCTL5 register also works as measurement trigger (if an external trigger is not used). After that, you should wait for conversion end and read ATDDR0~ATDDRx registers.
The simple ATD example code may be downloaded for example here:
https://community.nxp.com/docs/DOC-93792
I hope it helps you.
Have a great day,
Radek
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------