Analog-to-Digital Converter (S08ADC12V1) : 10.1.1 Module Configurations
Analog-to-Digital Converter (S08ADC12V1) : 10.1.1 Module Configurations
ADCH Channel Input Pin Control ADCH Channel Input Pin Control
00000 AD0 PTB0/MISO2/ADP0 ADPC0 10000 AD16 VREFL N/A
00001 AD1 PTB1/MOSI2/ADP1 ADPC1 10001 AD17 VREFL N/A
00010 AD2 PTB2/SPSCK2/ADP2 ADPC2 10010 AD18 VREFL N/A
00011 AD3 PTB3/SS2/ADP3 ADPC3 10011 AD19 VREFL N/A
00100 AD4 PTB4/KBIP4/ADP4 ADPC4 10100 AD20 VREFL N/A
00101 AD5 PTB5/KBIP5/ADP5 ADPC5 10101 AD21 Reserved N/A
00110 AD6 PTB6/ADP6 ADPC6 10110 AD22 Reserved N/A
00111 AD7 PTB7/ADP7 ADPC7 10111 AD23 Reserved N/A
01000 AD8 PTD0/ADP8/ACMP+ ADPC8 11000 AD24 Reserved N/A
01001 AD9 PTD1/ADP9/ACMP- ADPC9 11001 AD25 Reserved N/A
01010 AD10 PTD3/KBIP3/ADP10 ADPC10 11010 AD26 Temperature N/A
Sensor1
01011 AD11 PTD4/ADP11 ADPC11 11011 AD27 Internal Bandgap N/A
01100 AD12 VREFL ADPC12 11100 Reserved N/A
01101 AD13 VREFL ADPC13 11101 VREFH VREFH N/A
01110 AD14 VREFL ADPC14 11110 VREFL VREFL N/A
01111 AD15 VREFL ADPC15 11111 module None N/A
disabled
1
For more information, see Section 10.1.1.5, “Temperature Sensor.”
NOTE
Selecting the internal bandgap channel requires BGBE =1 in SPMSC1 see
Section 5.7.7, “System Power Management Status and Control 1 Register
(SPMSC1).” For value of bandgap voltage reference see Appendix A.8,
“Analog Comparator (ACMP) Electricals.”
ADCSC2[ADTRG] bit. When enabled, the ADC will be triggered every time RTCINT matches
RTCMOD. The RTC interrupt does not have to be enabled to trigger the ADC.
The RTC can be configured to cause a hardware trigger in MCU run, wait, and stop3.
where:
— VTEMP is the voltage of the temperature sensor channel at the ambient temperature.
— VTEMP25 is the voltage of the temperature sensor channel at 25°C.
— m is the hot or cold voltage versus temperature slope in V/°C.
For temperature calculations, use the VTEMP25 and m values from the ADC Electricals table.
In application code, the user reads the temperature sensor channel, calculates VTEMP, and compares to
VTEMP25. If VTEMP is greater than VTEMP25, the cold slope value is applied in Equation 10-1. If VTEMP
is less than VTEMP25 the hot slope value is applied in Equation 10-1.
To improve accuracy, calibrate the bandgap voltage reference and temperature sensor. Calibrating at
25 °C will improve accuracy to ±4.5°C. Calibration at 3 points, –40°C, 25°C, and 125°C will improve
accuracy to ±2.5°C. Once calibration has been completed, the user will need to calculate the slope for both
hot and cold. In application code, the user would then calculate the temperature using Equation 10-1 as
detailed above and then determine if the temperature is above or below 25°C. Once determined, if the
temperature is above or below 25°C, the user can recalculate the temperature using the hot or cold slope
value obtained during calibration.
USBDP
ON-CHIP ICE AND USBDN
HCS08 CORE
DEBUG MODULE (DBG)
PORT A
6
PTA5– PTA0
USB SIE
BKGD/MS FULL SPEED PTB7/ADP7
BDC CPU USB PTB6/ADP6
USB ENDPOINT TRANSCEIVER
RAM PTB5/KBIP5/ADP5
PORT B
PTB4/KBIP4/ADP4
SS2
PTB3/SS2/ADP3
SPSCK2
RESET HCS08 SYSTEM CONTROL 8-/16-BIT SERIAL PERIPHERAL PTB2/SPSCK2/ADP2
MOSI2
INTERFACE MODULE (SPI2) PTB1/MOSI2/ADP1
MISO2 PTB0/MISO2/ADP0
RESETS AND INTERRUPTS
MODES OF OPERATION PTC6
IRQ/TPMCLK RxD2
POWER MANAGEMENT PTC5/RxD2
SERIAL COMMUNICATIONS
INTERFACE MODULE (SCI2) PTC4
PORT C
TxD2 PTC3/TxD2
COP IRQ LVD
PTC2
SDA
PTC1/SDA
IIC MODULE (IIC) SCL
PTC0/SCL
VDDAD
12-CHANNEL, 12-BIT 8 PTD7
VSSAD
ANALOG-TO-DIGITAL 4 PTD6
VREFL
CONVERTER (ADC) PTD5
VREFH PTD4/ADP11
PORT D
PTD3/KBIP3/ADP10
USER Flash (IN BYTES) PTD2/KBIP2/ACMPO
MC9S08JM60 = 60,912 ACMP–
PTD1/ADP9/ACMP–
ANALOG COMPARATOR ACMP+
MC9S08JM32 = 32,768 PTD0/ADP8/ACMP+
(ACMP)
ACMPO
SS1 PTE7/SS1
USER RAM (IN BYTES) SPSCK1
8-/16-BIT SERIAL PERIPHERAL PTE6/SPSCK1
MC9S08JM60 = 4096 MOSI1
INTERFACE MODULE (SPI1) PTE5/MOSI1
MC9S08JM32 = 2048
MISO1
PTE4/MISO1
TPMCLK
PORT E
6-CHANNEL TIMER/PWM TPM1CH1
MULTI-PURPOSE CLOCK PTE3/TPM1CH1
MODULE (TPM1) TPM1CH0
GENERATOR (MCG) PTE2/TPM1CH0
TPM1CHx 4
RxD1 PTE1/RxD1
SERIAL COMMUNICATIONS
VSSOSC LOW-POWER OSCILLATOR TxD1 PTE0/TxD1
INTERFACE MODULE (SCI1)
PTF7
VDD SYSTEM TPMCLK PTF6
VOLTAGE 2-CHANNEL TIMER/PWM TPM2CH1 PTF5/TPM2CH1
VSS TPM2CH0
PORT F
NOTES:
PTG3/KBIP7
1. Port pins are software configurable with pullup device if input port. PTG2/KBIP6
2. Pin contains software configurable pullup/pull-down device if IRQ is enabled PTG1/KBIP1
(IRQPE = 1). Pull-down is enabled if rising edge detect is selected (IRQEDG = 1) PTG0/KBIP0
3. IRQ does not have a clamp diode to VDD. IRQ must not be driven above VDD.
4. Pin contains integrated pullup device.
5. When pin functions as KBI (KBIPEn = 1) and associated pin is configured to enable the
pullup device, KBEDGn can be used to reconfigure the pullup as a pull-down device.
Figure 10-1. MC9S08JM60 Series Block Diagram Highlighting ADC Block and Pins
10.1.3 Features
Features of the ADC module include:
• Linear successive approximation algorithm with 12-bit resolution
• Up to 28 analog inputs
• Output formatted in 12-, 10-, or 8-bit right-justified unsigned format
• Single or continuous conversion (automatic return to idle after single conversion)
• Configurable sample time and conversion speed/power
• Conversion complete flag and interrupt
• Input clock selectable from up to four sources
• Operation in wait or stop3 modes for lower noise operation
• Asynchronous clock source for lower noise operation
• Selectable asynchronous hardware conversion trigger
• Automatic compare with interrupt for less-than, or greater-than or equal-to, programmable value
• Temperature sensor
Compare true
3 ADCSC1 ADCCFG
COCO
AIEN
ADLSMP
complete
ADICLK
ADTRG
ADLPC
MODE
ADCO
ADCH
ADIV
Async
1 2 Clock Gen
ADACK
initialize
transfer
sample
convert
abort
AD0
AIEN 1
•••
Interrupt
ADVIN COCO 2
SAR Converter
AD27
Compare true
3
Compare
Logic
Value
ACFGT
Name Function
7 6 5 4 3 2 1 0
R COCO
AIEN ADCO ADCH
W
Reset: 0 0 0 1 1 1 1 1
Field Description
7 Conversion Complete Flag. The COCO flag is a read-only bit set each time a conversion is completed when the
COCO compare function is disabled (ACFE = 0). When the compare function is enabled (ACFE = 1), the COCO flag is
set upon completion of a conversion only if the compare result is true. This bit is cleared when ADCSC1 is written
or when ADCRL is read.
0 Conversion not completed
1 Conversion completed
6 Interrupt Enable AIEN enables conversion complete interrupts. When COCO becomes set while AIEN is high,
AIEN an interrupt is asserted.
0 Conversion complete interrupt disabled
1 Conversion complete interrupt enabled
4:0 Input Channel Select. The ADCH bits form a 5-bit field that selects one of the input channels. The input channels
ADCH are detailed in Table 10-4.
The successive approximation converter subsystem is turned off when the channel select bits are all set. This
feature allows for explicit disabling of the ADC and isolation of the input channel from all sources. Terminating
continuous conversions this way prevents an additional, single conversion from being performed. It is not
necessary to set the channel select bits to all ones to place the ADC in a low-power state when continuous
conversions are not enabled because the module automatically enters a low-power state when a conversion
completes.
00000–01111 AD0–15
10000–11011 AD16–27
11100 Reserved
11101 VREFH
11110 VREFL
11111 Module disabled
7 6 5 4 3 2 1 0
R ADACT 0 0
ADTRG ACFE ACFGT R1 R1
W
Reset: 0 0 0 0 0 0 0 0
1
Bits 1 and 0 are reserved bits that must always be written to 0.
Field Description
7 Conversion Active. Indicates that a conversion is in progress. ADACT is set when a conversion is initiated and
ADACT cleared when a conversion is completed or aborted.
0 Conversion not in progress
1 Conversion in progress
6 Conversion Trigger Select. Selects the type of trigger used for initiating a conversion. Two types of triggers are
ADTRG selectable: software trigger and hardware trigger. When software trigger is selected, a conversion is initiated
following a write to ADCSC1. When hardware trigger is selected, a conversion is initiated following the assertion
of the ADHWT input.
0 Software trigger selected
1 Hardware trigger selected
4 Compare Function Greater Than Enable. Configures the compare function to trigger when the result of the
ACFGT conversion of the input being monitored is greater than or equal to the compare value. The compare function
defaults to triggering when the result of the compare of the input being monitored is less than the compare value.
0 Compare triggers when input is less than compare value
1 Compare triggers when input is greater than or equal to compare value
If the MODE bits are changed, any data in ADCRH becomes invalid.
7 6 5 4 3 2 1 0
Reset: 0 0 0 0 0 0 0 0
7 6 5 4 3 2 1 0
Reset: 0 0 0 0 0 0 0 0
7 6 5 4 3 2 1 0
R 0 0 0 0
ADCV11 ADCV10 ADCV9 ADCV8
W
Reset: 0 0 0 0 0 0 0 0
In 10-bit mode, the ADCCVH register holds the upper two bits of the 10-bit compare value (ADCV[9:8]).
These bits are compared to the upper two bits of the result following a conversion in 10-bit mode when the
compare function is enabled.
In 8-bit mode, ADCCVH is not used during compare.
7 6 5 4 3 2 1 0
R
ADCV7 ADCV6 ADCV5 ADCV4 ADCV3 ADCV2 ADCV1 ADCV0
W
Reset: 0 0 0 0 0 0 0 0
R
ADLPC ADIV ADLSMP MODE ADICLK
W
Reset: 0 0 0 0 0 0 0 0
Field Description
7 Low-Power Configuration. ADLPC controls the speed and power configuration of the successive approximation
ADLPC converter. This optimizes power consumption when higher sample rates are not required.
0 High speed configuration
1 Low power configuration:The power is reduced at the expense of maximum clock speed.
6:5 Clock Divide Select. ADIV selects the divide ratio used by the ADC to generate the internal clock ADCK.
ADIV Table 10-7 shows the available clock configurations.
4 Long Sample Time Configuration. ADLSMP selects between long and short sample time. This adjusts the
ADLSMP sample period to allow higher impedance inputs to be accurately sampled or to maximize conversion speed for
lower impedance inputs. Longer sample times can also be used to lower overall power consumption when
continuous conversions are enabled if high conversion rates are not required.
0 Short sample time
1 Long sample time
Field Description
3:2 Conversion Mode Selection. MODE bits are used to select between 12-, 10-, or 8-bit operation. See Table 10-8.
MODE
1:0 Input Clock Select. ADICLK bits select the input clock source to generate the internal clock ADCK. See
ADICLK Table 10-9.
R
ADPC7 ADPC6 ADPC5 ADPC4 ADPC3 ADPC2 ADPC1 ADPC0
W
Reset: 0 0 0 0 0 0 0 0