![Freescale Semiconductor QE128 Скачать руководство пользователя страница 74](http://html1.mh-extra.com/html/freescale-semiconductor/qe128/qe128_quick-reference-user-manual_2330661074.webp)
Using the Analog to Digital Converter (ADC) for the QE Microcontrollers
QE128 Quick Reference User Guide, Rev. 1.0
8-2
Freescale Semiconductor
Compare value.
Pin Control: ADC or I/O controlled
Pin Control: ADC or I/O controlled
Pin Control: ADC or I/O controlled
The QE128 MCUs have a 12-bit analog-to-digital succesive-approximation converter which is the ADC.
It can be configured with a 12-bit, 10-bit or 8-bit resolution. These are some options for the user:
•
Three different resolutions: 12-bit, 10-bit and 8-bit.
•
Two different types of conversions: single or continuous conversion.
•
Selectable ADC clock frequency: include a bus clock preescaler.
•
Automatic compare with interrupt for less-than, grater-than or equal-to, programmable value.
•
Configurable sample time and conversion speed/power.
8.2
ADC project for EVB
8.2.1
Code Example and Explanation
This example code is available from the Freescale Web site www.freescale.com.
The following examples describe the initialization code for the 12-bit ADC module using the
interrupt-based approach, 8-bit resolution, and continuous-sample mode.
The zip file contains the following functions:
•
main — Endless loop waiting for the ADC interrupt to occur.
ADCV7-ADCV0 – contains the lower eight bits of the 12-bit, 10-bit or 8-bit
compare value
ADCCFG
ADLPC
ADIV
ADLSMP
MODE
ADICLK
ADLPC – Low Power configuration
MODE – Conversion mode Selection
ADIV – Clock divide select
ADICLK – Input clock select.
ADLSMP – Long sample time
configuration.
APCTL1
ADPC7
ADPC6
ADPC5
ADPC4
ADPC3
ADPC2
ADPC1
ADPC0
ADPC7-ADPC0 – These bits are used to disable the I/O port control of the
MCU. For specific information visit www.freescale.com and search for the
reference manual MC9S08QE128 or MCF51QE128 MCUs.
APCTL2
ADPC15
ADPC14
ADPC13
ADPC12
ADPC11
ADPC10
ADPC9
ADPC8
ADPC15-ADPC8 – These bits are used to disable the I/O port control of the
MCU. For specific information visit www.freescale.com and search for the
reference manual MC9S08QE128 or MCF51QE128 MCUs.
APCTL3
ADPC23
ADPC22
ADPC21
ADPC20
ADPC19
ADPC18
ADPC17
ADPC16
ADPC23-ADPC16 – These bits are used to disable the I/O port control of the
MCU. For specific information visit www.freescale.com and search for the
reference manual MC9S08QE128 or MCF51QE128 MCUs.