Analog-to-Digital Converter (ADC12)
MCF51CN128 Reference Manual, Rev. 6
15-18
Freescale Semiconductor
Bit 6
ADTRG
0
Software trigger selected
Bit 5
ACFE
0
Compare function disabled
Bit 4
ACFGT
0
Not used in this example
Bit 3:2
00
Reserved, always reads zero
Bit 1:0
00
Reserved for Freescale’s internal use; always write zero
ADCSC1 = 0x41 (%01000001)
Bit 7
COCO
0
Read-only flag set when a conversion completes
Bit 6
AIEN
1
Conversion complete interrupt enabled
Bit 5
ADCO
0
One conversion only (continuous conversions disabled)
Bit 4:0 ADCH
00001
Input channel 1 selected as ADC input channel
ADCRH/L = 0xxx
Holds results of conversion. Read high byte (ADCRH) before low byte (ADCRL) so that
conversion data cannot be overwritten with data from the next conversion.
ADCCVH/L = 0xxx
Holds compare value when compare function enabled
Figure 15-9. Initialization Flowchart for Example
Yes
No
Reset
Initialize ADC
ADCCFG = 0x98
ADCSC1 = 0x41
ADCSC2 = 0x00
Check
COCO=1?
Read ADCRH
Then ADCRL To
Clear COCO Bit
Continue