Freescale/NXP MPC5606B: ADC CTU Program

Task:While performing normal conversions on a few standard ADC channel inputs, use the CrossTriggering Unit (CTU) to trigger a conversion from an eMIOS channel event, where the channel isconfigured as Single Action Input Capture (SAIC).

In this example,
- ADC inputs ANS1 and ANS2 are continuously scanned.
- EMIOS and the CTU areconfigured so an input signal on eMIOS channel 2 will cause an event that “cross triggers” a conversionfor ANS0.
- To generate an input signal, eMIOS channel 3 is configured for OPWM.
- Both channels useeMIOS channel 23 configured as modulus counter for their time base.

Make the connections shown below:
- Connect ANS0 to a potentiometer or a known voltage.
- Connect ANS1:2 to other known voltages.
- Verify the eMIOS channel 2 injects an ADC command which reads the pot value.

                                              (100 144  176)
ANS0        32        B8      PCR[24]=2000     39 53   R9
ANS1        33        B9      PCR[25]=2000     38 52   T9
ANS2        34        B10     PCR[26]=2000     40 54   P9
eMIOS0[2]   -         A2      PCR[2]=0503      5   9   F2
eMIOS0[3]   -         A3      PCR[3]=0600      68 90   K15     

Connect Jumper between PA[2] and PA[3]

Program Outcome:
          INPUT                   =>             OUTPUT 
ANS0 PB[8](CTU Inject Mode)   (ADC0) =>  LED1 (ON if Input>=500, else OFF)
ANS1 PB[9] (Normal Scan mode) (ADC0) =>  LED2 (ON if Input>=500, else OFF) 
ANS2 PB[10] (Normal Scan mode)(ADC0) =>  LED3 (ON if Input>=500, else OFF)
[LED4 is Continuously Toggling (Blinking) to Check Whether Program is executing in Infinite Loop] 
eMIOS0_3 PA[3] Generates 1KHz with 25% Duty Cycle 
eMIOS0_2 PA[2] injects conversion at ANS0 (ADC0). (CTU is used)


Click here to see more codes for Freescale/NXP MPC56xx Family.

Feel free to ask doubts in the comment section. I will try my best to solve it.
If you find this helpful by any mean like, comment and share the post.
This is the simplest way to encourage me to keep doing such work.

Thanks and Regards,
-Akshay P. Daga
Post a Comment (0)
Previous Post Next Post