How to access multiplexed ADC channels in S12GA48 MCU ?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

How to access multiplexed ADC channels in S12GA48 MCU ?

跳至解决方案
869 次查看
sagardhavali
Contributor III

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

标签 (1)
标记 (3)
0 项奖励
回复
1 解答
672 次查看
RadekS
NXP Employee
NXP Employee

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:

  1. Measure one sample at single ATD channel
  2. Measure multiple samples at single ATD channel
  3. Measure one sample at multiple ATD channels

 

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!
-----------------------------------------------------------------------------------------------------------------------

在原帖中查看解决方案

0 项奖励
回复
1 回复
673 次查看
RadekS
NXP Employee
NXP Employee

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:

  1. Measure one sample at single ATD channel
  2. Measure multiple samples at single ATD channel
  3. Measure one sample at multiple ATD channels

 

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!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复