You are on page 1of 42

Chapter 2:

Introduction to
Microprocessor-Based Control

Adapted from:
Kilian, C. T. (2001), Modern Control Technology: Components and Systems
Delmar
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 various
types of available digital controllers, that is,
microcontrollers, single-board computers, programmable
logic controllers, and personal computers.
Introduction
Microprocessors ushered in a whole new era
for control systems electronics.
Microprocessors require additional
components to be useful – RAM, ROM, etc.
Microcontrollers are essentially
microprocessors with built-in features to be
used independently.
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 is
easy.
Easily connected to networks.
A computer is made up of four basic blocks:
 Central Processing Unit (CPU)
 Does the actual computing.
Unit – performs math and logic
 Arithmetic

 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


Input/Output ports: Used for connections to
devices.
Busing:
 Devices are multiplexed using 3 major buses:
 Address Bus – To specify the device or memory
location to communicate with.
 Data Bus – To transfer data between the CPU and
device.
 Control Bus – Timing and event control, such as read
and write operations.
Microprocessor Instructions & Op-Codes

Each processor has its own instruction set


of commands to control its operation.
 Move data
 Perform math operations

 Perform logical operations

Each instruction has a unique Op-code, a


binary value associated to it.
01001101 or 4Dh.
An Accumulator is staging area for data –
data is moved into it, and operations are
performed on that data.
Machine Code/Mnemonics/PC
Machine Code
 The program the CPU follows represented in binary or
hex.
Mnemonics
 Abbreviations representing an op-code. Programs
written in assembly language use mnemonics.
Program counter
 Used to point to the memory address of the instruction to
be performed.
Fetch-execute cycles
 Performed to bring an instruction into memory and
execute it.
From another text…
DAC - Parallel
Parallel Interface: Transfers 8-bits (or more)
at once.
Digital-to-Analog Converter (DAC) converts
8-digital data to analog.
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
Resolution
The 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%.
A DAC has a 5V reference with a binary
input of 10010100, calculate the voltage
output.

If the binary input were 11111111?


ADC
Analog-to-Digital converter (ADC):
A circuit that converts an analog voltage to
digital.
ADC
Conversion Time: The time required to
convert an analog voltage to digital.
For an 8-bit ADC:
 Output = Vin x 255
Vref

Resolution in % is 1/255 x 100 (for an 8-bit


ADC).
The smallest step change in voltage for a
DAC or ADC is the voltage resolution – how
closely 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.
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


A 0 to 2000 PSI pressure sensor has an
output of 0 to 5V. This voltage feeds an 8-bit
ADC with a Vref of 5V.
 Draw a diagram and a graph.
 What would be the resolution of the ADC in PSI?

 What would be the transfer function from the


input pressure to the digital output?
 Given an input of 1250PSI, what would be the
output of the ADC?
 What equation would convert the ADC back to
PSI in the controller?
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 to


transmit, and vice-versa on receive.
 A UART (Universal Asynchronous Transmitter
Receiver) is a device which performs this
conversion.
Asynchronous Transmission
Data is sent with defined timing, termed a
BAUD rate. 2400,9600, 19200, etc. Start Bit
& 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
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.
Synchronous Communications
Unlike asynchronous, which relies on the
timing of the data, with synchronous
communications the clocks of the 2 devices
are locked together.
One means is to use a separate clock line to
indicate individual bit positions.
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.
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
or scan.
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.
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 low
complexity of tasks.
Very large cost savings over
microcomputers.
Motorola 68HC11, Intel 8051, PIC 16C72,
Atmel AVR, BASIC Stamp
BASIC Stamp
Single-Board Computers
A computer on a single board.
Programmable for I/O control and the ability
to use high level peripherals.
Programmable Logic Controllers
Self-contained microprocessor based controller.
Designed for fast connection and control of
processes.
Used extensively in industrial control
environments.
Programs in relay-logic to be compatible to the
more traditional electrical workforce.
Personal Computers
PCs with dedicated I/O and data acquisition
cards and specialized software may be used
as controllers.
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.

You might also like