Anda di halaman 1dari 43

Industrial automation Using Microcontroller

By: Engr. M.Rizwan Anjum Department of Electronic Engineering UCET, IUB.

Contents
Introduction Parameters

consideration for Automation Selecting microcontroller Internal architecture of Microcontroller Applications

Introduction
Automation
The

control of an industrial process (e.g manufacturing, production etc) by automatic rather that manual means is often called automation can be defined as a technology that uses programmed commands to operate a given process

Automation

Basic building block diagram of Automation

Transducer Processing/ control Set point Output/ Display

Appliances

Sensors/ Transducers
Level

Flow
Pressure Temperature Humidity

Controllable applications
Motors

Solenoid

valves Control valves

Display
Input

Parameters Set point Indication for Output (alarm)

Controller
Takes

Input Verifies the conditions Controls the equipment & Displays the output

Microcontrollers
The prime use of a microcontroller :

To control the operation of a machine using a fixed program that is stored in ROM and that does not change over the lifetime of the system

Typical Microcontrollers
The

bit. 4-bit are used in high volume very low cost applications 16 & 32 bit are used in high-end applications. Typical clock frequencies are 12 - 24 MHz

most common microcontrollers are 8-

Different manufacturers of microcontroller


Intel Atmel Philips Dallas Semiconductors Microchip Motorola

Criteria for Selecting microcontroller

speed, the amount of ROM and RAM, the number of I/O ports and timers, size, packaging, power consumption easy to upgrade cost per unit

meeting the computing needs of the task efficiently and cost effectively

assemblers, debuggers, C compilers, emulator, simulator, technical support

availability of software development tools

wide availability and reliable sources of the microcontrollers.

Different aspects of a microcontroller

Hardware:

Interface to the real world

Software:

order how to deal with inputs

Test case:

8051

A smaller computer On-chip RAM, ROM, I/O ports...

CPU I/O Port

RAM ROM

A single chip
Serial Timer COM Port

History of 8051
1981,

Intel MCS-51 The 8051 became popular after Intel allowed other manufacturers to make and market an flavor of the 8051.
different speed, amount of on-chip ROM code-compatible with the original 8051 form a 8051 family

Block Diagram
External interrupts On-chip ROM for program code
Timer/Counter

Interrupt Control

On-chip RAM

Timer 1 Timer 0

Counter Inputs

CPU Serial Port

OSC

Bus Control

4 I/O Ports

P0 P2 P1 P3

TxD RxD

Address/Data

Pin Description of the 8051


P1.0 P1.1 P1.2 P1.3 P1.4 P1.5 P1.6 P1.7 RST (RXD)P3.0 (TXD)P3.1 (INT0)P3.2 (INT1)P3.3 (T0)P3.4 (T1)P3.5 (WR)P3.6 (RD)P3.7 XTAL2 XTAL1 GND 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 Vcc P0.0(AD0) P0.1(AD1) P0.2(AD2) P0.3(AD3) P0.4(AD4) P0.5(AD5) P0.6(AD6) P0.7(AD7) EA/VPP ALE/PROG PSEN P2.7(A15) P2.6(A14) P2.5(A13) P2.4(A12) P2.3(A11) P2.2(A10) P2.1(A9) P2.0(A8)

8051 (8031)

Port 3 Alternate Functions


P3 Bit
P3.0 P3.1 P3.2 P3.3 P3.4 P3.5 P3.6 P3.7

Function
RxD TxD INT0 INT1 T0 T1 WR RD

Pin
10 11 12 13 14 15 16 17

MICROCONTROLLER I/O pins


I/O pins are very useful for the following : reading Inputs/ reading keypads Displaying output controlling Motors (PWM) etc.

A Pin of Port 1
Read latch
TB2

Vcc
Load(L1)

Internal CPU bus Write to latch

P1.X
Clk Q

P1.X pin M1

TB1 Read pin

P0.x
8051 IC

Writing 1 to Output Pin P1.X


Setb p1.x

Read latch
TB2

Vcc
Load(L1) 2. output pin is

1. write a 1 to the pin


Internal CPU bus Write to latch
D Q

Vcc 1 0
M1

P1.X
Clk Q

P1.X pin

output 1

TB1 Read pin

8051 IC

Writing 0 to Output Pin P1.X


Read latch
TB2

Vcc
Load(L1) 2. output pin is

1. write a 0 to the pin


Internal CPU bus Write to latch
D Q

ground 0 1
M1

P1.X
Clk Q

P1.X pin

output 0

TB1 Read pin

8051 IC

Reading High at Input Pin


Read latch TB2 Load(L1) 1 1

Vcc

2. MOV A,P1 external pin=High

Internal CPU bus

Q
P1.X

P1.X pin

Write to latch

Clk

M1

TB1 Read pin 3. Read pin=1 Read latch=0 Write to latch=1 8051 IC

Reading Low at Input Pin


Read latch TB2 Load(L1) 0 0

Vcc

2. MOV A,P1 external pin=Low

Internal CPU bus

Q
P1.X

P1.X pin

Write to latch

Clk

M1

TB1 Read pin 3. Read pin=1 Read latch=0 Write to latch=1 8051 IC

8051 Family
Mask OTP

programmable

factory fitted Programs

one time programmable

User Programmable
Reprogrammable

User Reprogrammable

Comparison of the 8051 Family Members

ROM type 8031 no ROM ; requires external Rom 80xx mask ROM 87xx EPROM 89xx Flash EEPROM 89xx 8951 8952 8953 8955 898252 891051 892051 Example (AT89C51,AT89LV51) AT= ATMEL(Manufacture) C = CMOS technology LV= Low Power(3.0v)

Registers
A

B
R0 R1 R2 R3 R4 R5 R6 R7 Some 8-bitt Registers of the 8051 Some 8051 16-bit Register DPTR DPH DPL

PC

PC

Memory mapping in 8051

ROM memory map in 8051 family


4k
0000H 0000H

8k
0000H

0FFFH DS5000 8751 AT89C51 1FFFH 8752 AT89C52

7FFFH

from Atmel Corporation

from Dallas Semi

RAM memory space allocation in the 8051

7FH General RAM

30H 2FH Bit-Addressable RAM 20H 1FH 18H 17H 10H 0FH 08H 07H 00H Register Bank 2 Register Bank 1 Register Bank 3

Register Bank 0

Development Cycle of microcontroller based project

How to interface Devices


Inputs

and Outputs Compatibility of I/Os Impedance matching Selecting right microcontroller

General diagram of Automation


Sensor input/Analog
D0~D7 Display Analog to Digital converter Set point

8051uc

Actuator Control Signals

Less complex Cheaper Example


Thousands

Why Microcontroller

hundreds

Tens

Units

Decoder

Decoder

Decoder

Decoder

Counter

Counter

Counter

Counter

Clk input

C 1
3 3 p F

C 2
3 3 p F

X 1
1 9 C R Y S T A L

U 1
X T A L 1 P 0 . 0 / A D 0 P 0 . 1 / A D 1 P 0 . 2 / A D 2 P 0 . 3 / A D 3 P 0 . 4 / A D 4 P 0 . 5 / A D 5 P 0 . 6 / A D 6 P 0 . 7 / A D 7 P 2 . 0 / A 8 P 2 . 1 / A 9 P 2 . 2 / A 1 0 P 2 . 3 / A 1 1 P 2 . 4 / A 1 2 P 2 . 5 / A 1 3 P 2 . 6 / A 1 4 P 2 . 7 / A 1 5 P 3 . 0 / R X D P 3 . 1 / T X D P 3 . 2 / I N T 0 P 3 . 3 / I N T 1 P 3 . 4 / T 0 P 3 . 5 / T 1 P 3 . 6 / W R P 3 . 7 / R D 3 9 3 8 3 7 3 6 3 5 3 4 3 3 3 2 2 1 2 2 2 3 2 4 2 5 2 6 2 7 2 8 1 0 1 1 1 2 1 3 1 4 1 5 1 6 1 7

1 8

R 1 C 3
1 0 u F 1 0 k 9

X T A L 2

R S T

Q 1
2 N 2 9 0 7

2 9 3 0 3 1

P S E N A L E E A

Q 2
2 N 2 9 0 7

1 2 3 4 5 6 7 8

P 1 . 0 P 1 . 1 P 1 . 2 P 1 . 3 P 1 . 4 P 1 . 5 P 1 . 6 P 1 . 7 A T 8 9 C 5 1

Q 3
2 N 2 9 0 7

Q 4
2 N 2 9 0 7

Controller
Fixed Universal controllers

Universal controllers
Input in form 4 ~ 20mA 0 ~20mA

of 0 ~5v

Conversion using Transmitter Exp. Temperature transmitter, pressure transmitter. etc

Applications of microcontroller
Personal

information products: Cell phone, pager, watch, pocket recorder, calculator Laptop components: mouse, keyboard, modem, fax card, sound card, battery charger Home appliances: door lock, alarm clock, thermostat, air conditioner, TV remote, VCR, small refrigerator, exercise equipment, washer/dryer, microwave oven Industrial equipment: Temperature/pressure controllers, Counters, timers, RPM Controllers Toys: video games, cars, dolls, etc.

Microcontroller Applications

Microcontroller Application Area

Sample projects
Car parking gate control

Car parking gate control program


org 0 mov p0, #00 mov p1, #00 mov p2, #00 mov p3, #00 wait: jnb p1.0, wait1 acall here wait1: jnb p1.2, wait acall here1 here: setb p2.0 limit1: jnb p3.0, limit1 clr p2.0 switch: jnb p1.1, switch setb p2.1 limit2: jnb p3.1, limit2 clr p2.1 inc a mov p0, a ret here1: setb p2.2 limit3: jnb p3.2, limit3 clr p2.2 switch1:jnb p1.3, switch1 setb p2.3 limit4: jnb p3.3, limit4 clr p2.3 dec a mov p0, a sjmp wait end

; wait for enter into parking ; if inside goto here subroutine ; wait for leave parking ; if leave parking goto here1 ; start motor1 for open d gate ; start motor1 until it strikes to limit switch ; after defined time stop d motor ; wait for input when the car cross the entering door ; when gate crossed start motor1 in revese direction to close d gate ; start motor1 in reverse direction until it strikes to the other limit ; after closing the door now stop motor1 ; start counter to count number of cars on seven segment display ; display result on port 0 'use decoder' ; return from subroutine ; start motor2 for open d gate ; start motor2 until it strikes to the other limit ; after defined time stop d motor ;wait for input when the car cross the exit door ; when gate crossed start motor2 in revese direction to close d gate ; start motor2 until it strikes to the other limit ; after closing the door now stop motor2 ; count down ; display result on port 0 ; restart

Anda mungkin juga menyukai