MCT Chapter2

Embed Size (px)

Citation preview

  • 7/27/2019 MCT Chapter2

    1/40

    Chapter 2:

    Introduction to Microprocessor-

    Based Control

    Adapted from:

    Kilian, C. T. (2001), Modern Control Technology: Components and Systems

    Delmar

  • 7/27/2019 MCT Chapter2

    2/40

    Objectives

    Understand what a microprocessor is, what it does, and

    how it works.

    Understand the concepts of RAM and ROM computer

    memory and how memory is accessed via the address and

    data buses.

    Understand how parallel and serial data interfaces work.

    Perform relevant calculations pertaining to analog-to-digital

    converters and digital-to-analog converters.

    Understand the principles of digital controller software.

    Recognize and describe the characteristics of the varioustypes of available digital controllers, that is,

    microcontrollers, single-board computers, programmable

    logic controllers, and personal computers.

  • 7/27/2019 MCT Chapter2

    3/40

    Introduction

    Microprocessors ushered in a whole new era

    for control systems electronics.Microprocessors require additional

    components to be useful RAM, ROM, etc.

  • 7/27/2019 MCT Chapter2

    4/40

    Microcontrollers are essentially

    microprocessors with built-in features to beused independently.

  • 7/27/2019 MCT Chapter2

    5/40

    Reasons for Microprocessor Control

    Low-level signals converted to digital can be

    transmitted long distances error free.Micro can handle complex calculations.

    Memory is available for tracking and storage.

    Loading new programs for control change iseasy.

    Easily connected to networks.

  • 7/27/2019 MCT Chapter2

    6/40

    A computer is made up of four basic blocks:

    Central Processing Unit (CPU) Does the actual computing.

    Arithmetic Unit performs math and logic

    Control: Manages flow of data Memory Data is contained in memory

    locations at specified addresses.

    RAM volatile, read/write memory

    ROM nonvolatile, read only

    EPROM/EEPROM/Flash Erasable ROM

  • 7/27/2019 MCT Chapter2

    7/40

    Input/Output ports: Used for connections to

    devices.Busing:

    Devices are multiplexed using 3 major buses:

    Address Bus To specify the device or memorylocation to communicate with.

    Data Bus To transfer data between the CPU and

    device.

    Control Bus Timing and event control, such as readand write operations.

  • 7/27/2019 MCT Chapter2

    8/40

  • 7/27/2019 MCT Chapter2

    9/40

    Microprocessor Instructions & Op-Codes

    Each processor has its own instruction set

    of commands to control its operation. Move data

    Perform math operations

    Perform logical operationsEach instruction has a unique Op-code, a

    binary value associated to it.

    01001101 or 4Dh.An Accumulatoris staging area for data

    data is moved into it, and operations are

    performed on that data.

  • 7/27/2019 MCT Chapter2

    10/40

  • 7/27/2019 MCT Chapter2

    11/40

  • 7/27/2019 MCT Chapter2

    12/40From another text

  • 7/27/2019 MCT Chapter2

    13/40

    INTERFACING TO A

    MICROPROCESSOR

    CONTROLLER

    Parallel Interfacing

    Serial Interfacing

  • 7/27/2019 MCT Chapter2

    14/40

    Parallel Interfacing

    transfers data 8 bits (or more) at the same

    time, using eight separate wires.ideal for inputting or outputting data from

    devices that are either on or off.

    For example, a single limit switch uses onlyone input bit, and an on-off signal to a motor

    requires only one output bit.

    These 1-bit signals are called logic variables,and eight such signals can be provided from

    a single (8-bit) port.

  • 7/27/2019 MCT Chapter2

    15/40

    DAC

    Driving a variable-speed DC motor - DAC

    Digital-to-Analog Converter (DAC) converts8-digital data to analog voltage.

  • 7/27/2019 MCT Chapter2

    16/40

    DAC Formula & Resolution

    Vout = Input x Vref

    256 (for 8-bit)Vout = DAC output analog voltage

    Input = Decimal value of binary input

    Vref= Reference DC voltage

  • 7/27/2019 MCT Chapter2

    17/40

    ResolutionThe worst case error introduced when

    converting.In an 8-bit DAC, there are 255 possible

    steps. The resolution is the smallest step

    size, or 1/255, 0.39%.In an 16-bit DAC, there are 65,535 possible

    steps. The resolution is the smallest step

    size, or 1/65535, 0.0015%.

  • 7/27/2019 MCT Chapter2

    18/40

    A DAC has a 5V reference with a binary

    input of 10010100, calculate the voltageoutput.

    If the binary input were 11111111?

  • 7/27/2019 MCT Chapter2

    19/40

    ADC

    Analog-to-Digital converter (ADC):

    A circuit that converts an analog voltage todigital word.

  • 7/27/2019 MCT Chapter2

    20/40

    ADC

    Conversion Time: The time required to

    convert an analog voltage to digital.

    For an 8-bit ADC:

    Output = Vin x 255Vref

  • 7/27/2019 MCT Chapter2

    21/40

  • 7/27/2019 MCT Chapter2

    22/40

    Serial Interface

    Data is sent 1 bit at a time.

    Reduces number of cables or lines More easily shielded from noise.

    Existing data lines may be used (phone).

    Parallel data must be converted to serial totransmit, and vice-versa on receive.

    A UART (Universal Asynchronous Receiver

    Transmitter) is a device which performs this

    conversion.

  • 7/27/2019 MCT Chapter2

    23/40

  • 7/27/2019 MCT Chapter2

    24/40

    Asynchronous Transmission

    Data is sent with defined timing, termed a

    BAUD rate. 2400bps,9600, 19200, etc. StartBit & Stop Bit are used to frame the signal.

    A parity bit is used optionally for error

    detection.Common settings: 9600 Baud, 8 bits, no

    parity, 1 stop-bit -- 9600 8-N-1

    RS 232

  • 7/27/2019 MCT Chapter2

    25/40

    RS-232

    RS-232 is a specification which defines

    standard for serial interfaces between DTEs(Data Terminal Equipment Computers),

    and DCEs (Data Communication Equipment

    Modems, etc).

    DTE to DTE communications can be

    performed serially using a cross-over or Null-

    Modem cable.

  • 7/27/2019 MCT Chapter2

    26/40

    N t ki

  • 7/27/2019 MCT Chapter2

    27/40

    Networking

    Multiple devices are connected together.

    Serial data is passed between devices.Devices are provided individual address

    numbers to send data to a particular device.

    C t ll P

  • 7/27/2019 MCT Chapter2

    28/40

    Controller Programmer

    Real Time control

    Program runs in a loop,sensing the current

    condition and

    calculating new output

    to the actuator.

    Each pass through the

    program is an iteration

    orscan.

  • 7/27/2019 MCT Chapter2

    29/40

    The frequency at which new data is collected

    is the sampling rate (scan time).Time-delay loops may be inserted to slow

    the execution or scan time.

    Programs can be written at the lowest level(machine code, assembler) or high level

    languages (C), BASIC, etc.

    Mi t ll

  • 7/27/2019 MCT Chapter2

    30/40

    Microcontrollers

    A single-chip computer specifically designed

    for I/O control.On board RAM, ROM, possibly timers and

    ADCs.

    High speed is not required due to lowcomplexity of tasks.

    Very large cost savings over

    microcomputers.Motorola 68HC11, Intel 8051, PIC 16C72,

    Atmel AVR, BASIC Stamp

  • 7/27/2019 MCT Chapter2

    31/40

  • 7/27/2019 MCT Chapter2

    32/40

  • 7/27/2019 MCT Chapter2

    33/40

  • 7/27/2019 MCT Chapter2

    34/40

    BASIC Stamp

    Single Board Computers

  • 7/27/2019 MCT Chapter2

    35/40

    Single-Board Computers

    A computer on a single board.

    Programmable for I/O control and the abilityto use high level peripherals.

    Programmable Logic Controllers

  • 7/27/2019 MCT Chapter2

    36/40

    Programmable Logic Controllers

    Self-contained microprocessor based controller.

    Designed for fast connection and control ofprocesses.

    Used extensively in industrial control

    environments.

    Programs in relay-logic to be compatible to the

    more traditional electrical workforce.

    Personal Computers

  • 7/27/2019 MCT Chapter2

    37/40

    Personal Computers

    PCs with dedicated I/O and data acquisition

    cards and specialized software may be usedas controllers.

  • 7/27/2019 MCT Chapter2

    38/40

    The smallest step change in voltage for a

    DAC or ADC is the voltage resolution howclosely a voltage can be resolved due to the

    digital quantization:

    With a 5V reference,1 LSB = 5V/255 = 19.5mV

    (5V x .39% = .00195V)

    ADCs and DACs have a resolution error of LSB.

    LSB = 9.7 mV

    In a ADC, the input voltage could be +/- 9.7mV.

  • 7/27/2019 MCT Chapter2

    39/40

    Given a 10-Bit ADC with a 5V reference,

    calculate: The % Resolution

    The LSB Value (volts)

    The LSB Value (volts) The digital output for an input of voltage of 3.2V

    Objectives Review

  • 7/27/2019 MCT Chapter2

    40/40

    Objectives Review

    Understand what a microprocessor is, what it does, and

    how it works.

    Understand the concepts of RAM and ROM computer

    memory and how memory is accessed via the address and

    data buses.

    Understand how parallel and serial data interfaces work.

    Perform relevant calculations pertaining to analog-to-digital

    converters and digital-to-analog converters.

    Understand the principles of digital controller software.

    Recognize and describe the characteristics of the various

    types of available digital controllers, that is,

    microcontrollers, single-board computers, programmable

    logic controllers, and personal computers.