English
Language : 

MC9RS08KA8RM Datasheet, PDF (112/190 Pages) Freescale Semiconductor, Inc – MC9RS08KA8 Features
Analog-to-Digital Converter (RS08ADC10V1)
• polled or interrupt approach
Refer to Table 10-6, Table 10-7, andTable 10-8 for information used in the following example.
NOTE
Hexadecimal values designated by a preceding 0x, binary values designated
by a preceding %, and decimal values have no preceding character.
10.5.1 ADC Module Initialization Example
Before the ADC module completes conversions, an initialization must be performed.
10.5.1.1 Initialization Sequence
A typical initialization sequence is as follows:
1. Update the configuration register (ADCCFG) to select the input clock source and the divide ratio
used to generate the internal clock, ADCK. Also used for selecting sample time and low-power
configuration.
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 continuous or once-only conversions and
to enable or disable conversion complete interrupts. Also, use this register to select the input
channel on which conversions are to be performed.
10.5.1.2 Pseudo-Code Example
In this example, the ADC module is configured 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 is
derived from the bus clock divided by 1.
ADCCFG = 0x98 (%10011000)
Bit 7 ADLPC 1
Bit 6:5 ADIV
00
Bit 4 ADLSMP 1
Bit 3:2 MODE 10
Bit 1:0 ADICLK 00
Configures for low power (lowers maximum clock speed)
Sets ADCK to input clock ÷ 1
Configures for long sample time
Sets mode at 10-bit conversions
Selects bus clock as input clock source
ADCSC2 = 0x00 (%00000000)
Bit 7 ADACT 0
Bit 6 ADTRG 0
Bit 5 ACFE 0
Bit 4 ACFGT 0
Bit 3:2
00
Bit 1:0
00
Indicates if a conversion is in progress
Selects software trigger
Disables compare function
Not used in this example
Unimplemented or reserved, always reads zero
Reserved for Freescale internal use; always write zero
ADCSC1 = 0x41 (%01000001)
MC9RS08KA8 Series Reference Manual, Rev. 3
112
Freescale Semiconductor