20
18/03/2016 1 MECHATRONICS SYSTEM DESIGN (MtE-325) TODAYS LECTURE Introduction to Microprocessor System Hardware Introduction to Microprocessor Operation Interface to a Microprocessor Controller The Parallel Interface Digital to Analog Conversion Analog to Digital Conversion The Serial Interface RS-232 Introduction to Controller Programming Microprocessor-based Controllers

Mechatronics System Design - TODAYS LECTURE Introduction to Microprocessor System ...mte401.weebly.com/uploads/1/4/0/7/14075053/ch2_msd... · 2019-10-30 · 18/03/2016 1 MECHATRONICS

  • Upload
    others

  • View
    6

  • Download
    2

Embed Size (px)

Citation preview

Page 1: Mechatronics System Design - TODAYS LECTURE Introduction to Microprocessor System ...mte401.weebly.com/uploads/1/4/0/7/14075053/ch2_msd... · 2019-10-30 · 18/03/2016 1 MECHATRONICS

18/03/2016

1

MECHATRONICS SYSTEM DESIGN

(MtE-325)

TODAYS LECTURE

Introduction to Microprocessor System Hardware

Introduction to Microprocessor Operation

Interface to a Microprocessor Controller

The Parallel Interface

Digital to Analog Conversion

Analog to Digital Conversion

The Serial Interface

RS-232

Introduction to Controller Programming

Microprocessor-based Controllers

Page 2: Mechatronics System Design - TODAYS LECTURE Introduction to Microprocessor System ...mte401.weebly.com/uploads/1/4/0/7/14075053/ch2_msd... · 2019-10-30 · 18/03/2016 1 MECHATRONICS

18/03/2016

2

INTRODUCTION TO

MICROPROCESSOR SYSTEM

HARDWARE

MICROPROCESSOR VS MICROCONTROLLER

• A microprocessor by itself is not a computer; additional

components such as memory and input/output circuits are

required to make it operational.

• However, the microcontroller does contain all the

computer functions on a single IC.

• Microcontrollers lack some of the power and speed of the

newer microprocessors, but their compactness is ideal for

many control applications.

• Majority of the so-called microprocessor-controlled devices,

such as vending machines, are really using

microcontrollers.

Page 3: Mechatronics System Design - TODAYS LECTURE Introduction to Microprocessor System ...mte401.weebly.com/uploads/1/4/0/7/14075053/ch2_msd... · 2019-10-30 · 18/03/2016 1 MECHATRONICS

18/03/2016

3

MICROPROCESSOR SYSTEM HARDWARE

MICROPROCESSOR SYSTEM HARDWARE

A computer is made up of four basic functional units:

1. Central processing unit (CPU)

2. Memory

3. Inputs

4. Outputs

The central processing unit does the actual computing

and is composed of two subparts: the arithmetic logic unit (ALU) and

control sections

The arithmetic logic unit performs the actual numerical and logic

calculations such as addition, subtraction, AND, OR, and so on.

The control section of the CPU manages the data flow, such as reading

and executing the program instructions.

If data require calculations, the control section hands it over to the ALU

for processing.

Page 4: Mechatronics System Design - TODAYS LECTURE Introduction to Microprocessor System ...mte401.weebly.com/uploads/1/4/0/7/14075053/ch2_msd... · 2019-10-30 · 18/03/2016 1 MECHATRONICS

18/03/2016

4

MICROPROCESSOR SYSTEM HARDWARE

Binary to decimal conversion Decimal to binary conversion

MICROPROCESSOR SYSTEM

HARDWARE…MEMORYComputers usually have two kinds of addressable memory. The first is

random-access memory (RAM). Also called read/write memory, or RWM.

All data in this type of memory are lost when the power is turned off and is

called volatile memory.

The second type of memory is read-only memory (ROM), which is similar to

RAM except that new data cannot be written in.

This type of memory does not lose its data when power is turned off and is

called non-volatile memory.

Most microprocessor systems have both RAM and ROM. RAM is used for

temporary program storage and as a temporary scratch-pad memory for the

CPU. Whereas ROM is used to store programs and data that need to be

always available.

Actually, many computers use an EPROM (erasable programmable read-only

memory) or an EEPROM (electrically erasable programmable ROM) instead

of a ROM for long-term memory.

EPROMs can be erased with a strong UV light and reprogrammed.

EEPROMs can be erased and reprogrammed electrically.

Page 5: Mechatronics System Design - TODAYS LECTURE Introduction to Microprocessor System ...mte401.weebly.com/uploads/1/4/0/7/14075053/ch2_msd... · 2019-10-30 · 18/03/2016 1 MECHATRONICS

18/03/2016

5

MICROPROCESSOR SYSTEM

HARDWARE…I/O SECTION

• The input/output (I/O) section of the computer allows it to interface with

the outside world.

• The input section is the conduit through which new programs and data

are

• entered into the computer,

• whereas the output section allows the computer to communicate its

results.

• An I/O interface is called a port.

• An input port is a circuit that connects input devices to the computer;

examples of input devices are keyboards, sensors, and switches.

• An output port is a circuit that connects the computer to output devices.

• Examples of output devices are indicator lamps, actuators, and

monitors.

MICROPROCESSOR SYSTEM HARDWARE

• The address bus is a group of wires that carries an address (in binary

form) from the CPU to the memory and I/O circuits.

• The data bus is a group of wires that carries the actual numerical data

from place to place within the computer.

• Data flow in both directions on the data bus. For example, input data

enter through the input port and proceed through the data bus to the

CPU.

• If the CPU needs to store this data, it will send it back through the data

bus to memory.

• The control bus consists of timing and event-control signals from the

CPU. These signals are used to control the data flow on the data bus.

• For example, one of the control signals is the read/write (R/W) line. This

signal informs the memory if the CPU wishes to read existing data out of

memory or write new data into memory.

Page 6: Mechatronics System Design - TODAYS LECTURE Introduction to Microprocessor System ...mte401.weebly.com/uploads/1/4/0/7/14075053/ch2_msd... · 2019-10-30 · 18/03/2016 1 MECHATRONICS

18/03/2016

6

INTRODUCTION TO

MICROPROCESSOR OPERATION

MICROPROCESSOR SYSTEM OPERATION

Each type of microprocessor has its own instruction set, which is the

set of commands that it was designed to recognize and obey.

Microprocessor instructions are very elemental and specific.

Many microprocessor instructions simply move data from one place to

another within the computer; others perform mathematical or logic

operations. Still another group of instructions control program flow,

such as jumping forward or backward in the program.

Each instruction in the instruction set is assigned its own unique

operation code, (which is typically 8 bits long and referred to as the op-

code). The CPU uses this 8-bit number to identify the instruction.

A machine language program is a list of instructions (in op-code form)

for the microprocessor to follow. Before the program can be executed, it

must first be loaded sequentially into memory. The op-code for the first

instruction is loaded at the first address location, the op-code for the

second instruction is loaded next in line, and so on.

Page 7: Mechatronics System Design - TODAYS LECTURE Introduction to Microprocessor System ...mte401.weebly.com/uploads/1/4/0/7/14075053/ch2_msd... · 2019-10-30 · 18/03/2016 1 MECHATRONICS

18/03/2016

7

MICROPROCESSOR SYSTEM OPERATION

MICROPROCESSOR SYSTEM OPERATION

The program shown on the next slide directs the CPU to get 1 byte of

data from input port 01, add 1 to it, and send the result to output port

02.

Before execution can start, the address of the first instruction must be

loaded into the program counter.

The program counter is a special address-storage register that the

CPU uses to keep track of where it is in the program, much like a

bookmark.

The program counter always holds the address of the next instruction

to be executed.

Once the microprocessor is activated, execution of the program is

completely automatic. The execution process is a series of fetch-execute

cycles, whereby the microprocessor first fetches the instruction from

memory and then executes it.

Page 8: Mechatronics System Design - TODAYS LECTURE Introduction to Microprocessor System ...mte401.weebly.com/uploads/1/4/0/7/14075053/ch2_msd... · 2019-10-30 · 18/03/2016 1 MECHATRONICS

18/03/2016

8

INTERFACING TO A

MICROPROCESSOR CONTROLLER

Parallel Port

Digital to analog conversion

Analog to digital conversion

Serial port

INTERFACING

An important part of any control system is the link between the controller

and the real world. For a digital controller, data enter and exit through a

parallel interface or through a serial interface.

The parallel interface transfers data 8 bits (or more) at the same time,

using eight separate wires.

It is essentially an extension of the data bus into the outside world.

The parallel interface is 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.

Page 9: Mechatronics System Design - TODAYS LECTURE Introduction to Microprocessor System ...mte401.weebly.com/uploads/1/4/0/7/14075053/ch2_msd... · 2019-10-30 · 18/03/2016 1 MECHATRONICS

18/03/2016

9

INTERFACING…..DIGITAL TO ANALOG

CONVERTER (DAC)

• The digital-to-analog converter (DAC) is a circuit that converts a digital

word into an analog voltage.

• Figure on the next slide shows the block diagram of a typical 8-bit DAC.

• The input is an 8-bit digital word.

• The output is a current that is proportional to the binary input value

and must be converted to a voltage with an op-amp.

• A stable reference voltage (Vref) must be supplied to the DAC.

• This voltage defines the maximum analog voltage—that is, for a digital

input of 11111111, Vout is essentially Vref.

• If the input is 00000000, the Vout will be 0 Vdc.

• For all values in between, the output voltage is a linear percentage of

Vref.

INTERFACING…..DIGITAL TO ANALOG

CONVERTER (DAC)

Page 10: Mechatronics System Design - TODAYS LECTURE Introduction to Microprocessor System ...mte401.weebly.com/uploads/1/4/0/7/14075053/ch2_msd... · 2019-10-30 · 18/03/2016 1 MECHATRONICS

18/03/2016

10

INTERFACING…..DIGITAL TO ANALOG

CONVERTER (DAC)

• Specifically, the output voltage for any digital input (for the 8-bit DAC)

is

INTERFACING…..ANALOG TO DIGITAL CONVERTER

(ADC)

An analog-to-digital converter (ADC) is a circuit that converts an

analog voltage into a digital word.

The output voltage for any analog input (for the 8-bit ADC) is

EXAMPLE 2.3

EXAMPLE 2.4

Page 11: Mechatronics System Design - TODAYS LECTURE Introduction to Microprocessor System ...mte401.weebly.com/uploads/1/4/0/7/14075053/ch2_msd... · 2019-10-30 · 18/03/2016 1 MECHATRONICS

18/03/2016

11

Analog-to-digital converter (ADC) block diagram.

INTERFACING…..ANALOG TO DIGITAL CONVERTER

(ADC)

THE SERIAL INTERFACE

In a serial interface, the data are sent 1 bit after the other on a

single wire.

Because data always exist in a parallel form inside the computer,

it must be converted to serial data before coming out the serial

port.

This is accomplished with a special parallel-to-serial converter IC

called a universal asynchronous receiver transmitter

(UART).

On the other end of the line, a receiver must convert the serial

data back into parallel data, which is done with another UART.

Page 12: Mechatronics System Design - TODAYS LECTURE Introduction to Microprocessor System ...mte401.weebly.com/uploads/1/4/0/7/14075053/ch2_msd... · 2019-10-30 · 18/03/2016 1 MECHATRONICS

18/03/2016

12

Components in a serial interface circuit.

THE SERIAL INTERFACE (CONT’D)

Serial data are classified as;

1. Synchronous

Synchronous data require that the data bytes be sent as a group

in a “package.” It is used in sophisticated communication systems

that move a lot of data

2. Asynchronous

synchronous data transfer is the more common (but slower) type

of serial transfer and allows for individual bytes to be sent when

needed.

The other important parameter in serial transmission is the

number of bits sent per second (frequently called the baud rate.

Standard bit rates are 300 bps (bits per second), 1200 bps, 2400

bps, 9600 bps, 14,400 bps 28,800 bps, 33,600 bps, and 57,600 bps.

Page 13: Mechatronics System Design - TODAYS LECTURE Introduction to Microprocessor System ...mte401.weebly.com/uploads/1/4/0/7/14075053/ch2_msd... · 2019-10-30 · 18/03/2016 1 MECHATRONICS

18/03/2016

13

Serial data format for the binary word 10110010.

THE SERIAL INTERFACE (CONT’D)

RS 232

In order to make the serial interface practical, a set of

specifications called the RS-232 standard was established.

Officially, the RS-232 standard specifies the serial data

interface between data terminal equipment (DTE) and data

communication equipment (DCE).

A common application of RS-232 is the interface between a

PC and the modem, in which case the computer is the DTE

and the modem is the DCE

27

THE SERIAL INTERFACE (CONT’D)

Page 14: Mechatronics System Design - TODAYS LECTURE Introduction to Microprocessor System ...mte401.weebly.com/uploads/1/4/0/7/14075053/ch2_msd... · 2019-10-30 · 18/03/2016 1 MECHATRONICS

18/03/2016

14

The RS-232 serial interface.

Networking

Probably the most common use of serial data is innetworking.

Network cabling differs depending on the type of localarea network (LAN).

Typically, each unit on the network has a unique address number and also address detection circuitry.

When one unit wants to talk to another unit, it first broadcasts the address of the unit its wants to talk to (serially, of course, on the signal wire) and then sends the data (serially), which consists of some number of bytes.

THE SERIAL INTERFACE (CONT’D)

Page 15: Mechatronics System Design - TODAYS LECTURE Introduction to Microprocessor System ...mte401.weebly.com/uploads/1/4/0/7/14075053/ch2_msd... · 2019-10-30 · 18/03/2016 1 MECHATRONICS

18/03/2016

15

Concept of local area network (LAN) interconnections for bus topology.

INTRODUCTION TO

CONTROLLER

PROGRAMMING

Page 16: Mechatronics System Design - TODAYS LECTURE Introduction to Microprocessor System ...mte401.weebly.com/uploads/1/4/0/7/14075053/ch2_msd... · 2019-10-30 · 18/03/2016 1 MECHATRONICS

18/03/2016

16

A digital controller is a computer operating in real time.

The program is running all the time—repeatedly taking in

the newest sensor data and then calculating a new output

for the actuator.

The basic structure of a controller program is a loop.

In a loop structure, the same sequence of instructions is

executed over and over again, and each pass through the

loop is called an iteration, or scan.

INTRODUCTION TO CONTROLLER

PROGRAMMING

A generalized controller program.

Page 17: Mechatronics System Design - TODAYS LECTURE Introduction to Microprocessor System ...mte401.weebly.com/uploads/1/4/0/7/14075053/ch2_msd... · 2019-10-30 · 18/03/2016 1 MECHATRONICS

18/03/2016

17

MICROPROCESSOR-BASED

CONTROLLERS

MICROPROCESSOR-BASED CONTROLLERS

Single-Chip Microcomputers (Microcontrollers)

The Motorola 68HC11

Intel 8051 microcontroller

PIC 16C72 microcontroller

35

Page 18: Mechatronics System Design - TODAYS LECTURE Introduction to Microprocessor System ...mte401.weebly.com/uploads/1/4/0/7/14075053/ch2_msd... · 2019-10-30 · 18/03/2016 1 MECHATRONICS

18/03/2016

18

Motorola 68HC11 microcontroller block diagram

Intel 8051 microcontroller block diagram

Page 19: Mechatronics System Design - TODAYS LECTURE Introduction to Microprocessor System ...mte401.weebly.com/uploads/1/4/0/7/14075053/ch2_msd... · 2019-10-30 · 18/03/2016 1 MECHATRONICS

18/03/2016

19

PIC 16C72 micro controller block diagram

Single-Board Computers are off-the-shelf microprocessor-

based computers built on a single printed-circuit card.

Programmable Logic Controllers (PLC’s) is a self-

contained microprocessor-based unit, designed specifically to

be a controller.

The PLC includes an I/O section that can interface directly

to such system components as switches, relays, small

motors, and lights.

MICROPROCESSOR-BASED CONTROLLERS

(CONT’D)

Page 20: Mechatronics System Design - TODAYS LECTURE Introduction to Microprocessor System ...mte401.weebly.com/uploads/1/4/0/7/14075053/ch2_msd... · 2019-10-30 · 18/03/2016 1 MECHATRONICS

18/03/2016

20

Personal Computers Used in Control Systems The

availability of relatively low-cost, off-the-shelf personal

computers (PCs) has made them an attractive alternative for

small, one-of-kind control applications.

Control system software packages are commercially

available for the PC that run under DOS and Windows.

A standard PC comes with expansion slots, which are

circuit-card connectors emanating from the motherboard

(main board) of the computer.

MICROPROCESSOR-BASED CONTROLLERS

(CONT’D)