How to access multiplexed ADC channels in S12GA48 MCU ?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to access multiplexed ADC channels in S12GA48 MCU ?

Jump to solution
868 Views
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

Labels (1)
Tags (3)
0 Kudos
Reply
1 Solution
671 Views
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!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
Reply
1 Reply
672 Views
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 Kudos
Reply