ROHS MC9S08QE128 Reference Manual page 196

Table of Contents

Advertisement

12-bit Analog-to-Digital Converter (S08ADCV1)
2. Update status and control register 2 (ADCSC2) to select the conversion trigger (hardware or
software) and compare function options, if enabled.
3. Update status and control register 1 (ADCSC1) to select whether conversions will be continuous
or completed only once, and to enable or disable conversion complete interrupts. The input channel
on which conversions will be performed is also selected here.
10.5.1.2
Pseudo — Code Example
In this example, the ADC module will be set up with interrupts enabled to perform a single 10-bit
conversion at low power with a long sample time on input channel 1, where the internal ADCK clock will
be derived from the bus clock divided by 1.
ADCCFG = 0x98 (%10011000)
Bit 7
ADLPC
Bit 6:5 ADIV
Bit 4
ADLSMP
Bit 3:2 MODE
Bit 1:0 ADICLK
ADCSC2 = 0x00 (%00000000)
Bit 7
ADACT
Bit 6
ADTRG
Bit 5
ACFE
Bit 4
ACFGT
Bit 3:2
Bit 1:0
ADCSC1 = 0x41 (%01000001)
Bit 7
COCO
Bit 6
AIEN
Bit 5
ADCO
Bit 4:0 ADCH
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
APCTL1=0x02
AD1 pin I/O control disabled. All other AD pins remain general purpose I/O pins
APCTL2=0x00
All other AD pins remain general purpose I/O pins
196
1
Configures for low power (lowers maximum clock speed)
Sets the ADCK to the input clock ÷ 1
00
1
Configures for long sample time
10
Sets mode at 10-bit conversions
00
Selects bus clock as input clock source
0
Flag indicates if a conversion is in progress
0
Software trigger selected
0
Compare function disabled
0
Not used in this example
00
Unimplemented or reserved, always reads zero
00
Reserved for Freescale's internal use; always write zero
0
Read-only flag which is set when a conversion completes
1
Conversion complete interrupt enabled
0
One conversion only (continuous conversions disabled)
00001 Input channel 1 selected as ADC input channel
MC9S08QE128 MCU Series Reference Manual, Rev. 2
Freescale Semiconductor

Hide quick links:

Advertisement

Table of Contents
loading

Related Products for ROHS MC9S08QE128

This manual is also suitable for:

Mc9s08qe96Mc9s08qe64

Table of Contents