1 / 12

Chapter 11: 68HC11 Analog to Digital Converter

Chapter 11: 68HC11 Analog to Digital Converter. The 68HC11 Microcontroller. Han-Way Huang. Minnesota State University, Mankato. Basics on A/D Conversion - Almost any measurable quantity, for example, current, voltage, temperature, speed, and time, is analog in nature.

rhonda
Download Presentation

Chapter 11: 68HC11 Analog to Digital Converter

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 11: 68HC11 Analog to Digital Converter The 68HC11 Microcontroller Han-Way Huang Minnesota State University, Mankato

  2. Basics on A/D Conversion • - Almost any measurable quantity, for example, current, voltage, temperature, speed, and • time, is analog in nature. • - Analog signals must be represented in digital format in order to be processed by the digital • computer. • - An analog to digital (A/D) converter can convert a electrical voltage to a digital value. • - A non-electrical quantity must be converted into electrical voltage before it can be • converted into digital value. • - A transducer is normally used to convert a non-electrical quantity into a electrical voltage • so that it can be further processed by a computer. • - The accuracy of an A/D converter is dictated by the number of bits it used to represent the • digital value. • An A/D conversion system is illustrated in Figure 11.1

  3. Optimal Voltage Range for the A/D Converter • A/D converter needs a low reference voltage and a high reference voltage to operate. • The low reference voltage (VLREF) is often set to 0 and the • high reference voltage (VHREF) is often set to VCC. • Most A/D converters are ratiometric. • To take advantage the whole dynamic range of the A/D converter, we should set scale and • shift the sensor output to VLREF ~ VHREF. • The A/D conversion result x corresponds to an analog voltage given by • Vx = VLREF + (range  x)  (2n – 1) • where, range = VHREF – VLREF

  4. Example 11.1 Assume there is a 12-bit A/D converter with VLREF = 0V and VHREF = 5V. Find out the corresponding voltage values for A/D conversion results of 100, 400, 800, 1200, and 2400. Solution: range = VHREF – VLREF = 5 V. V(100) = 0V + (100  5)  (212 – 1) = 0.12 V V(400) = 0V + (400  5)  (212 – 1) = 0.49 V V(800) = 0V + (800  5)  (212 – 1) = 0.98 V V(1200) = 0V + (1200  5)  (212 – 1) = 1.46 V V(2400) = 0V + (2400  5)  (212 – 1) = 2.93 V

  5. An Overview of the 68HC11 A/D Converter - Eight-channel, 8-bit, multiplexed input, successive-approximation conversion method. - A weighted array of capacitors are used to implement the successive-approximation method. - A clock signal is required to control the A/D conversion that must have a frequency no lower than 750 KHz. - Reference voltages are required for the conversion: one is high reference (VRH) voltage, the other is low reference (VRL) voltage. The difference between VRH and VRL cannot be lower than 2.5 V. - Accuracy is only guaranteed for VRL = 0 V and VRH = 5 V. - The conversion is ratiometric. The input voltage VRL converts to $00 and the input voltage VRH converts to $FF.

  6. The Clock Frequency Issue - The A/D converter requires a clock to operate. - Either the E clock or the on-chip RC clock signal can be used. - The RC clock runs at 1.5 MHz. - To choose the E clock signal, clear the bit 6 of the OPTION register to 0. - To select RC clock signal, set the bit 6 of the OPTION register to 1. This circuit requires 10 ms to start and settle. - The 68HC11 completes the conversion of one sample in 32 clock cycles. Registers Related to the A/D Operation - ADCTL: A/D control/status register - OPTION: bits 7 and 6 - ADR1-4: A/D result registers 1 to 4

  7. A/D Control Register (ADCTL)

  8. The OPTION Register ADPU: A/D power up. When set to 1, it enables the A/D converter. After setting this bit, the user must wait at least 100 ms before using the A/D converter. CSEL: clock select. When set to 1, the RC clock signal is selected. Otherwise, the E clock is selected. It takes 10 ms for RC clock to stabilize.

  9. The Procedure for Using the A/D Converter Step 1. Connect the hardware properly. Scale and shift the analog inputs, when necessary, so that they fall between VRH and VRL. Step 2. Set the ADPU bit of OPTION register to enable the A/D converter. Step 3. Select the appropriate clock signal by setting or clearing the CSEL bit of the OPTION register. Step 4. Wait for the A/D converter to stabilize. Step 5. Select the appropriate channel(s) and operation modes by programming the ADCTL register. Step 6. Wait until the CCF flag of the ADCTL register becomes 1 and collect the conversion results.

  10. Example 11.5 Write an instruction sequence to set up the following A/D conversion parameters: Nonscan mode Single-channel mode Select channel AN0 Choose the E clock as the clock source for the A/D converter Enable A/D converter Solution: Set bit 5 of ADCTL to 0 to select nonscan mode. Set bit 4 of ADCTL to 0 to select single-channel mode. Set bits 3-0 of ADCTL to 0000 to select channel AN0. Write the value $00 into the ADCTL register. Set the bit 7 of the OPTION register to enable A/D charge pump. Clear the bit 6 of the OPTION register to select E clock as the A/D control clock signal. Wait for 100 ms for the converter to stabilize.

More Related