Você está na página 1de 40

Chapter 2: Introduction to MicroprocessorBased 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 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
Arithmetic

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. Abbreviations representing an op-code. Programs written in assembly language use mnemonics. Used to point to the memory address of the instruction to be performed. Performed to bring an instruction into memory and execute it.

Mnemonics

Program counter

Fetch-execute cycles

From another text

INTERFACING TO A MICROPROCESSOR CONTROLLER Parallel Interfacing Serial Interfacing

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 only one 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.

DAC Driving a variable-speed DC motor - DAC Digital-to-Analog Converter (DAC) converts 8-digital data to analog voltage.

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%. In an 16-bit DAC, there are 65,535 possible steps. The resolution is the smallest step size, or 1/65535, 0.0015%.

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 word.

ADC
Conversion Time: The time required to convert an analog voltage to digital. For an 8-bit ADC:

Output = Vin x 255 Vref

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 Receiver Transmitter) is a device which performs this conversion.

Asynchronous Transmission
Data is sent with defined timing, termed a BAUD rate. 2400bps,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 NullModem cable.

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.

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

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.

Você também pode gostar