Docsity

Understanding Analog Signal Acquisition and A/D Converters on the 68HC11 Microcontroller, Slides of Microprocessor and Interfacing

Partial preview of the text

Download Understanding Analog Signal Acquisition and A/D Converters on the 68HC11 Microcontroller and more Slides Microprocessor and Interfacing in PDF only on Docsity!

Lecture Overview

  • Analog signal acquistion
  • The A/D Converters on the 68HC
  • REF: Chapters 7 and 8 plus the 68HC reference manual.

Analog signals

  • Analog output is typical of most transducers and sensors.
  • Need to convert these analog signals into a digital representation so the microcontroller can use it.
  • Some characteristics of analog signals.

Analog signals

  • Analog output is typical of most transducers and sensors.
  • Need to convert these analog signals into a digital representation so the microcontroller can use it.
  • Some characteristics of analog signals.
    • Maximum and minimum voltages
    • Precise continuous signals

Analog signals

  • Analog output is typical of most transducers and sensors.
  • Need to convert these analog signals into a digital representation so the microcontroller can use it.
  • Some characteristics of analog signals.
    • Maximum and minimum voltages
    • Precise continuous signals
    • Rate of voltage change

Analog-to-Digital Converters

  • The ideal transfer function of a 3-bit ADC
  • Full-scale (input voltage) range (FSR)
  • Analog signal is continuous
  • Digital โ€“ finite and discrete - In general n-bit converter - Total of 2n^ output codes

Quantization Error and FS

  • The smallest input change that can be detected.
  • In the 3 bit example it would be 1 Volt and defines the converters LSB accuracy.
  • Another term โ€“ Full Scale input โ€“ the largest analog voltage that a converter can detect. Voltages greater than the FS input will result in a converted value of 111---11.
  • Similarly inputs less than the minimum input voltage result in 000---00.

The 68HC

  • The 68HC11 has an 8 bit A/D converter which results in 256 possible digital output values.
  • The resolution = FSR/
  • The FSR of the 68HC11 is 0 to 5.12V so the resolution is 20mV/1bit - 5.12V/256 = .02031 V/bit = 20.3 mV/bit - Meaning โ€“ input change of 20mV changes LSB

68HC11 ADRs

  • 68HC11 has 4 A-to-D conversion registers
  • When a conversion is done, result is placed in one of the ADRx registers, where x is 1 to 4.

Port E and ADR addresses

  • When using Port E as a digital port the port is accessed through address $100A
  • The A/D control register, ADCTL, is at address $
  • The ADR registers are at addresses โ€“ these are read only registers. - ADR1 - $ - ADR2 - $ - ADR3 - $ - ADR4 - $

ADCTL register

  • To use the A/D converter on the 68HC11 the users only needs to write to ADCTL for the CPU to read results from the register. There are 8 A/D channels but only 4 results from one of the two groups of 4 can be stored at any one time. - Could also use the 4 registers to save 4 conversions from one input pin
  • ADCTL register โ€“ controls how the A/D converter works and how the registers are

Control register continued

  • Bit 6 โ€“ unused
  • Bit 5 โ€“ SCAN
    • Value of 0 โ€“ single conversion mode โ€“ conversion takes place after a write to the register.
    • Value of 1 โ€“ continuous conversion mode โ€“ conversions take place in round robin mode on the enabled analog input pins.
  • Bit 4 โ€“ Multiple/Single Channel Control (MULT)
    • Value of 0 โ€“ Single channel โ€“ Consecutive conversions results are stored in consecutive ADRx registers
    • Value of 1 โ€“ each pin in the group is converted and the result stored in the ADR register.

More on control register

  • Bits 3,2,1,0 โ€“ Channel select bits
    • For the 48-pin package โ€“ only 4 A/D inputs
    • How the CD, CC, CB, CA control bits work
  • The MULT bit says
  • 1 channel or all 4
  • Table lists specific group
  • and pin(s)

Setup example 2

  • What value needs to be written to the ADCTL register to have continuous conversions of pin PE0? What assembler language instructions would you use to set up this?
  • Set ADCTL as follows:
    • Bits 7 and 6 โ€“ donโ€™t cares
    • Bit 5 โ€“ 1 convert continuously val โ€“ 0010 0000
    • Bit 4 โ€“ 0 single channel
    • Bit 3,2,1,0 โ€“ 0000 the value for PE
  • The assembler code (assumes A accumulator is free) - LDAA #$ - STAA $1030 Docsity.com
  • โ€ข Stopped here Monday Feb