0% found this document useful (0 votes)
8 views39 pages

Unit 5 0-Complete

Uploaded by

GOKUL
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views39 pages

Unit 5 0-Complete

Uploaded by

GOKUL
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 39

SECA1601 - MICROPROCESSORAND MICROCONTROLLER

COURSE HANDLED BY

Dr.V.Vijaya Baskar,Dr.M.R.Ebenezar Jebarani, Dr.S.Lakshmi,


Dr.P.Chitra,Dr.Aranganathan
School of EEE,
Sathyabama Institute of Science and Technology,
Chennai.
UNIT V –
APPLICATIONS BASED ON 8085
AND 8051
TEMPERATURE CONTROLLER-
EXAMPLE
8085 microprocessor based temperature control system
8085 microprocessor based
temperature control system
 System consist of an 8085 microprocessor as
CPU, EPROM memory for program storage, RAM
memory or stack and data storage, Intel 8279for
keyboard and display interface, ADC, DAC,8255
for I/O ports, amplifiers, signal conditioning
circuit, temperature sensor and supply control
circuit
 Using keyboard Controller commands given
through keyboard, 6 numbers of 7 segment
LEDs are interfaced to the system

Operation of Temperature
 Temperature of plant iscontrol
measured usingsystem
temperature sensors
 Sensor convert the input temperature to analog voltage, output signal is
weak, so amplify the signal
 Analog signal is scaled to a suitable level by the signal conditioning
circuit
 Microprocessor can only process digital signal, so the analog signal is
converted to digital with the help of ADC- SOC& EOC through Port
C(output) and input the digital data through Port A (input ) of 8255
 8085 calculates the actual temperature with the help of the input data and
display the temperature in LED
 The processor compares the actual temperature with the desired
temperature and calculate the error and generate necessary control
signals and send it through DAC to the heating element
• If Ta > Td, Switch off the heating element
• If Ta<Td, Switch On the heating element
• If Ta = Td, Just display the temperature and continuously monitor the
system

Flowchart for Temperature Control System
Interfacing of stepper motor
Stepper motor
 A stepper motor (or step motor) is a brushless DC
electric motor that divides a full rotation into a number of
equal steps.
 The motor's position can then be commanded to move
and hold at one of these steps without any feedback
sensor (an open-loop controller), as long as the motor is
carefully sized to the application.
 Precise angle of rotation is possible with stepper motor
Operation of Stepper motor
control system
 Stepper motor used in computer peripherals, plotters, robots and
machine tools for precise incremental rotation.
 In stepper motor, the stator windings are excited by electrical
pulses and for each pulse the motor shaft advances by one
angular step ( full step - 1.8 degree, half step-0.9 degree)
 Step size is determined by the number of poles in the rotor and
the number of pairs of stator windings-control windings
 Motor is controlled by switching ON/OFF the control windings
 Usually 1 step = 1.8 degree (200 steps per revolution)
 Basic step size is full step, by altering switching sequence it can
be made to run with incremental motion of the full step value
Clock wise rotation

HEXA
X’ Y X Y’
VALUE

0 0 1 1 03
0 1 1 0 06
1 1 0 0 0C
1 0 0 1 09
Anti Clock wise rotation

HEXA
X’c Y X Y’
VALUE

1 0 0 1 09
1 1 0 0 0C
0 1 1 0 06
0 0 1 1 03
Step Angle
Modes
There are two possible modes:-
1. Mode 1(Full stepping):-
Stepping motors have 200 rotor teeth, or 200 full steps per revolution
of the motor shaft. Dividing the 200 steps into the 360º of rotation
equals a 1.8º full step angle
2. Mode 2(Half stepping):-
Half step simply means that the step motor is rotating at 400 steps
per revolution. In this mode, one winding is energized and then two
windings are energized alternately, causing the rotor to rotate at half
the distance, or 0.9º
8085 microprocessor based stepper motor
control system
Operation of Stepper motor
 control system
A two phase or four winding stepper motor is shown in fig
 System consist of an 8085 microprocessor as the CPU, EPROM and
RAM memory for program and data storage and for stack.
 Using 8279 a Keyboard and 6 number of 7-segment LED display have
been interace in the system.
 Through the keyboard user can issue commands to control the
system.
 LED display messages to the user
 Windings of the stepper motor are connected to the collector of
darlington pair transistors.
 Transistors are switched ON/OFF by the microprocessor through the
ports of 8255 and buffer 74LS245
 A free-wheeling diode is connected across each winding for fast
switching
 Processor has to output a switching sequence and wait for 1 to 5
Flowchart for Stepper Motor Control System
ALGORITHM –STEPPER MOTOR
1. Initialize port A of 8255 as output port.

2. Load the step sequence in an array.

3. out the step sequence through port A to the stepper motor

4. Call the delay in between the step sequence.

5. send the 4 step sequence.(reverse the step sequence for anticlock wise)

6. delay decreases speed increases(inversely proportional)

7. repeat unconditionally so that the motor rotate continuously


Full step Mode
In mode1(Full stepping) ,the motor moves
by 1.8°, to do this two bits are changed at a
time ,the bit pattern is as

HEXA
X’ Y X Y’
VALUE

0 0 1 1 03
0 1 1 0 06
1 1 0 0 0C
1 0 0 1 09
Program for full stepping
MVI A,80H
OUT 83H
Address Data
BACK: LXI H,2000H
2000 03
MVI C,04H
2001 06
UP: MOV A,M 2002 0C
OUT 80H 2003 09
CALL DELAY
INX H
DCR C
JNZ UP
JMP BACK
Half step Mode
In mode 2(half stepping) ,the motor moves
by 0.9° to do this 1 bit is changed at a time
and the bit pattern is as:-
A B C D
0 0 0 1 01
0 0 1 1 03
0 0 1 0 02
0 1 1 0 06
0 1 0 0 04
1 1 0 0 0C
1 0 0 0 08
1 0 0 1 09
Program for Half stepping
MVI A,80H
Addres Data
OUT 83H s
BACK: LXI H,2000H 2000 0A
MVI C,08H 2001 08
2001 09
UP: MOV A,M 2002 01
OUT 82H 2003 05
CALL DELAY 2004 04
INX H 2005 06
DCR C 2006 02
JNZ UP
JMP BACK
STEPPER MOTOR-APPLICATIONS
APPLICATIONS -
LCD INTERFACING
LCD Interfacing
• Liquid Crystal Displays (LCDs)
• cheap and easy way to display text
• Various configurations (1 line by 20 char upto 8 lines
X 80 ).
• Integrated controller
• The display has two register
– command register
– data register
• By RS you can select register
• Data lines (DB7-DB0) used to transfer data and
commands
Alphanumeric LCD Interfacing
• Pinout Microcontroller
– 8 data pins D7:D0
– RS: Data or Command E communications
R/W bus
Register Select
RS
– R/W: Read or Write DB7–DB0
– E: Enable (Latch data) 8051
8
• RS – Register Select LCD
controller
– RS = 0  Command Register
LCD Module
– RS = 1  Data Register
• R/W = 0  Write , R/W = 1  Read
• E – Enable
– Used to latch the data present on the data pins.
• D0 – D7
– Bi-directional data/command pins.
– Alphanumeric characters are sent in ASCII format.
LCD Commands
• The LCD’s internal controller can accept several
commands and modify the display accordingly. These
commands would be things like:
– Clear screen
– Return home
– Decrement/Increment cursor

• After writing to the LCD, it takes some time for it to


complete its internal operations. During this time, it
will not accept any new commands or data.
– We need to insert time delay between any two commands or data sent to
LCD
Pin Description
Command Codes
LCD Addressing
Interfacing LCD with 8051
8051

LM015

P3.4
R/W
P3.5 E

P3.3 RS

P1.7-P1.0 D7-D0
Interfacing LCD with 8051
mov A, command
call cmd
delay
mov A, another_cmd
call cmd
delay
mov A, #’A’
call data
delay
mov A, #’B’
call data
delay
….
Command and Data Write Routines
data:mov P1, A ;A is ascii data
setb P3.3 ;RS=1 data
clr P3.4 ;RW=0 for write
setb P3.5 ;H->L pulse on E
clr P3.5
ret
cmd:mov P1,A ;A has the cmd word
clr P3.3 ;RS=0 for cmd
clr P3.4 ;RW=0 for write
setb P3.5 ;H->L pulse on E
clr P3.5
ret
Example
Programs Using Timers
Writing delay program using 8051 timers

While designing delay programs in 8051, calculating the initial value that has to
be loaded into the TH and TL registers forms a very important thing. Let us see
how it is done.
• Assume the processor is clocked by a 12MHz crystal.
• That means, the timer clock input will be 12MHz/12 = 1MHz
• That means, the time taken for the timer to make one increment = 1/1MHz = 1uS
• For a time delay of “X” uS the timer has to make “X” increments.
• 2^16 = 65536 is the maximim number of counts possible for a 16 bit timer.
• Let TH be the value that has to be loaded into TH register and TL be the value
that has to be loaded to TL register.
• Then, THTL = Hexadecimal equivalent of (65536-X+1) where (65536-X+1) is
considered in decimal.
2 KHz Square wave using 8051 timer

Initial value to be loaded in to timer register-Calculation

T = 1 / f = 1 / 2 kHz = 500 us the period of the square wave.

1/2 of it for the high and low portions of the pulse is 250 us.

250 us / 1 us = 250 and 65536 – 250+1 = 65287.


The hex equivalent is FF07H.
Program to generate 2 KHz Square wave using 8051 timer

MOV TMOD,#01
MAIN: SETB P1.0
ACALL DELAY
CLR P1.0
ACALL DELAY
SJMP MAIN
DELAY: MOV TH0,#0FFH
MOV TL0,#007H
SETB TR0
HERE:JNB TF0,HERE
CLR TR0
CLR TF0
RET
THANK YOU

You might also like