Vous êtes sur la page 1sur 42

MICROCONTROLLER

Interfacing Of A to D Converter With 8085 Microprocessor

DEPARTMENT OF ELECTRONICS & COMMUNICATION $UNIL NARE$H KA$HYAP


Interfacing Of A to D 11

SYLLABUS
Interfacing of A to D Converter with 8085 Microprocessor 1) Using Handshaking 2) Using interrupts Interfacing of D to A Converter with 8085 Microprocessor and pgm for different waveform generation using 8255. Practical Applications using 8085 Microprocessor. - For Stepper Motor Control operation - For Temperature Control operation.

Interfacing Of A to D

22

LEARNING OBJECTIVE
The objective of chapter is to interface the 8085 microprocessor interfaced and programmable peripheral interface IC 8255 with DAC, ADC, Stepper motor and temperature controller with the help of latches and decoder.

Interfacing Of A to D

33

Interfacing of DAC with microprocessor 8085


Que:-Interface or connect 8bit DAC with microprocessor 8085 and write a program to generate saw tooth waveform at the output. Soln:Hardware: DAC is output device so for connecting DAC with microprocessor. We need output port. For output port, IC 8255 PPI can be used.
Interfacing Of A to D

44

Interfacing of DAC with microprocessor 8085 Cont.

Interfacing Diagram

Interfacing Of A to D

55

Interfacing of DAC with microprocessor 8085 Cont.

ADDRESS DECODING FOR IC 8255:TABLE:- ADD PORT HEXA ADD BINARY


PORT A PORT B 20H 21H 0010 00 00 0010 00 01

PORT C

22H

0010 00 10

CWR

23H

0010 00 11

Interfacing Of A to D

66

When of DAC with microprocessor applied Interfacing 8 bit digital number is 8085 Cont. at the input of DAC. Then DAC will convert this digital binary no. into proportional analog current IA. Using current to voltage converter. Analog current IA is converted into proportional analog voltage VA.

Interfacing Of A to D

77

Interfacing of DAC with microprocessor 8085 Cont.

If digital input=00H then lVAl =0V. If digital number applied at the input of DAC increased then lVAl also increased. Finally when digital=FFH, then lVAl= maximum. So, for obtaining sawtooth waveform of figure 2 we have to transfer 8 bit digital number from 00H to FFH in increasing order. Bit control word to define port B as 88 Interfacing Of A to D output in mode 0=10000000

Interfacing of DAC with microprocessor 8085 Cont.

Write a program to generate square wave.


MVI A,80H OUT 23H MVI A,00H L1: OUT 21H INR A JMP L1
Interfacing Of A to D 99

Prob.03) INTERFACE DAC WITH 8085 USING 8255


MVI A,80H

PA IS USED AS O/P. DIGITAL O/P OF MICROPROCESSOR IS GIVEN TO DAC THROUGH PA. b) O/P OF DAC IS AVAILABLE IN THE FORM OF CURRENT IT IS CONVERTED INTO VOLTAGE BY USING Op-Amp IN I-V MODE.
a)

OUT CWR MVI A,00H OUT PA CALL DELAY MVI A,FFH OUT PA CALL DELAY JMP START DELAY: 2040 LXI D,FFFFH REPEAT: DCX D MOV A,E ORA E JNZ REPEAT RET

3-A) GENERATION OF SQUARE WAVEFORM


MVI A,80H OUT CWR START : MVI A,00H OUT PA CALL DELAY MVI A,FFH OUT PA CALL DELAY JMP START DELAY: 2040: REPEAT: LXI D,FFFFH DCX D MOV A,E ORA E JNZ REPEAT RET

= 80H

3-B) GENERATION OF RAMP WAVEFORM


MVI A,80H OUT CWR L2: MVI A,00H L1: OUT PA INR A CPI FFH JNZ L1 JMP L2
1 0 0 0 0 0 0 0

= 80H

3-C) GENERATION OF TRIANGULAR WAVEFORM


BEGIN: MVI A,00H L1: INR A OUT PA CPI FFH JNZ L1 L2: DCR A OUT PA JNZ L2 JMP L1

3-D) GENERATION OF SINE WAVEFORM


MVI A,80H OUT CWR L2: LXI H,2050H MVI C,00H L1: MOV A,M OUT PA INX H DCR C JNZ L1 JMP L2

Interface ADC or 8 bit ADC or ADC 0808 /0809 with SOLN: microprocessor 8085.
Hardware:ADC is a input device so for connecting this input device with microprcessor,we have to use input port. For port IC 8255 PPI can be used.

Interfacing Of A to D

1515

Interface ADC or 8 bit ADC or ADC 0808 /0809 with microprocessor 8085 Cont. Interfacing Diagram

Interfacing Of A to D

1616

Interface ADC or 8 bit ADC or ADC 0808 /0809 with microprocessor 8085 Cont.

ADDRESS DECODING TABLE FOR 8255:PORT HEX ADDR BINARY ADDR


PORT A PORT B PORT C CWR 00H 01H 02H 03H 000000 00 000000 01 000000 10 000000 11

Interfacing Of A to D

1717

Interface ADC or 8 bit ADC or ADC 0808 /0809 with microprocessor 8085 Cont. Description:
1)

8 different analog voltages V0-V7 are applied to the 8 channels of ADC . Vref + = + 5v and Vref - = - 5v 3Mhz up clock signal is converted into 1 Mhz using divide by 3 counter and it is applied to the clock input of ADC

2) For selecting 1 corresponding channel 3 bit address is transferred on ADDA,ADDB,ADDC pins and ALE is made 1. so the corresponding voltage of selected channel is applied to the ADC input through inbuilt MUX.
Interfacing Of A to D 1818

Interface ADC or 8 bit ADC or ADC 0808 /0809 with microprocessor 8085 1 pulse 3)LogicCont. is applied on SOC pin.
So ADC starts the conversion and it gives EOC = 0 4) EOC = 1 then OE = 1. So 8 bit digital output is obtain on D7-D0 pins. This is 8 bit digital output is read through input port and it is stored in one memory location.
Interfacing Of A to D 1919

Prob.01 :-Interfacing
with ADC 0808/0809 with 8255 IC with 8085 IC. Points:
1) ADC IC 0808/0809 is used. 2) 8255 is used as interfacing IC. 3) PA & PC upper =I/P mode & PCLower =O/P mode. 4) EOC pin of ADC is Connected to PC7 bit. 5) ALE & SOC both are connected to PC3 Bit.
6)

START INITIALIZE PA & PC UPPER AS I/P & PCLOWER AS O/P SELECT 3 BY SENDING CBA=011 MAKE ALE & SOC HIGH KEEPING CBA=011 MAKING ALE &SOC LOW KEEPING CBA=011

READ SOC ROTATE A IN LEFT EOC=1 READ PA STORE A TO 20FFH STOP

PC0 to PC2 used for channel selection.

PROGRAM
MVI A,98H: OUT CWR MVI A,03H: OUT PC MVI A,0BH OUT PC MVI A,03H OUT PC IN PC RAL JNC BACK IN PA STA 20FFH HLT
To Configure for PA & PCU as i/p & PCL as o/p

select Channel 03
Make ALE & SOC High Maintaining CH3 Make ALE & SOC High Maintaining CH3 Read PC for EOC check EOC =1
1 0 0 1 1 0 0 0

= 98H (CWR)

Prob.02) Interface ADC with 8085 using 8255 in Interrupts.


IC 0808/0809 CONSIST OF 8CHANNELS FOR GIVING ANALOG INPUTS.HERE ANALOG I/P IS GIVEN TO CH-3 b) DIGITAL O/P OF ADC IS GIVEN TO PA. c) ALE & SOC SIGNAL ARE GIVEN TO PC3 OF 8255. d) PC0-PC2 ARE CONNECTED TO THE CHANNEL SELECT LINES CBA OF ADC. e) EOC OF ADC IS CONNECTED TO INTERRUPT IN RST7.5 OF 8085. f) ECLOCK OUT OF 8085 IS GIVEN TO CLOCK I/P OF ADC THROUGH COUNTER 7490 SO THAT CLK PULSES IN THE RANGE OF 200 TO 200KHz ARE GENERATES. g) PA IS USED AS I/P & PCLOWER IS USED AS OUTPUT.
a)

MVI A,90H OUT CWR MVI A,03H OUT PC MVI A,0BH OUT PC MVI A,0BH SIM EA HERE/JMP HERE 003C: IN PA STA 2200H RET

MULTI LOOP OR CLOSED LOOP TEMP. CONTROLLER


In multi loop or closed loop temp. controller using micro processor we have to convert ADC, relays etc. with microprocessor. For connecting this devices we need IO ports and for ports IC 8255 PPI is used.

Interfacing Of A to D

2323

MULTI LOOP OR CLOSED LOOP TEMP. CONTROLLER Cont.

Interfacing Diagram

Interfacing Of A to D

2424

MULTI LOOP OR CLOSED LOOP TEMP. CONTROLLER Cont.

ADDRESS DECODING TABLE FOR 8255 PPI


PORT PORT A PORT B PORT C CWR HEXA ADD 7C 7D 7E 7F BINARY ADDR 011111 00 011111 01 011111 10 011111 11

Interfacing Of A to D

2525

MULTI LOOP OR CLOSED LOOP TEMP. CONTROLLER Cont. Operation:1) Initially the temp. of heater is within the max. limit then to make heater on , logic 0 is applied on plotting 8255 so switching transistor T1 is on Vb~5V so power transistor (T2) is on hence current flows through coil of relay to the electromagnetic flux a is magnetized which attracts iron piece t so contacts ab are closed and heater becomes on. 2) Transducer:- Using temperature transducer like thermocouple or thermister temperature input at heater is converted into proportional electrical signal.

Interfacing Of A to D

2626

MULTI LOOP OR CLOSED LOOP TEMP. CONTROLLER Cont.

3) Signal conditioner and amplifier: Using I to V converter or amplifier or voltage follower the electrical signal is converted into the input voltage range of ADC (0to5V). 4) ADC: If logic 1 pulse is applied on SOC pin then conversion starts, during conversion EOC becomes 0. When conversion is over then EOC=1. Hence OE=1 and 8-bit digital output is 2727 Interfacing Of A pins. obtained on D7------D0 to D

MULTI LOOP OR CLOSED LOOP TEMP. CONTROLLER Cont. 5)Using software this digital out put is read by microcontroller and from this digital no. microprocessor coil get the information about the temp. of room. When the temp. of the room increases above max limit then for making relay of logic 1. is transferred on PC 0 pins of 8255. 6)When PC0 is 1 then T1 is off so VB IS DISCONNECTED to 5v. Hence p1 is off and i=0 relay is demagnetised. So contacts ab are open and heater becomes off.
Interfacing Of A to D 2828

PROGRAM:
L1: MVI A, 98H OUT CWR MVI A,03H OUT PC MVI A,0BH OUT PC IN PC RAL JNC L1 IN PA CPI 80H JC L3 MVI A,80H OUT PB JMP L1 MVI A,00H OUT PB JMP L1
1 0 0 1 1 0 0 0

= 98H(CWR)

L2:

L3:

Interface stepper motor with microprocessor 8085.


Soln:In practical stepper motor coil A & b are centre tapped to + 12V and between other end of each winding power transistor is connected. The base of power transistor is controlled by switching transistor and the base of switching transistor is controlled by microprocessor to the output port pin.
Interfacing Of A to D 3030

Interface stepper motor with microprocessor 8085 Cont.

Interfacing Diagram

Interfacing Of A to D

3131

Interface stepper motor with microprocessor 8085 Cont.

ADDRESS DECODING TABLE FOR IC 8255 PPI


PORT PORT A PORT B PORT C CWR HEXA ADD 20H 21H 22H 23H BINARY ADD 001000 00 001000 01 001000 10 001000 11

Interfacing Of A to D

3232

Interface stepper motor with microprocessor 8085 Cont.

Description 1)There are 4 units of driver circuit T1 and T2 connected to port c pin of stepper motor. 2)If pc 3 =1 then T1 is off there is no voltage so T2 is off. There is no flux of winding A1. 3)If PC3 =0 T1 is on so Vb ~ 5V hence T2 is on so point 1 is connected to ground and I1 will produce flux.

Interfacing Of A to D

3333

Interface stepper motor with microprocessor 4)Direction Control:-The resultant flux of winding 8085 Cont. rotates in clockwise or anticlockwise direction then

rotor also rotates in clockwise and anticlockwise direction. 5)Speed Control: The time delay between two steps is less than speed of stepper motor. The angle by which stepper motor rotates in 1 step called an step angle.Stepper having 1.8 step angle is available.

Interfacing Of A to D

3434

5-A) TO ROTATE FULL STEP OR 4 SEQUENCE STEPPER MOTOR IN CLOCKWISE DIRECTION CONTINUOUSLY LXI SP,20FFH MVI A,80H OUT CWR BEGIN : MVI C,04H LXI H,2050H L1: MOV M,A OUT PA INX H DCR C JNZ L1 JMP BEGIN

1 0 0 0 0 0 0 0

= 80H CWR

5-B) TO ROTATE FULL STEP OR 4 SEQUENCE STEPPER MOTOR IN ANTI CLOCKWISE DIRECTION CONTINUOUSLY LXI SP,20FFH MVI A,80H OUT CWR BEGIN : MVI C,04H 1 0 0 0 0 0 0 0 = 80H CWR LXI H,2053H L1: MOV M,A OUT PA CALL DELAY DCX H DCR C JNZ L1 JMP BEGIN

5-C) TO ROTATE HALF STEP OR 8 SEQUENCE STEPPER MOTOR IN CLOCKWISE DIRECTION CONTINUOUSLY MVI A,80H OUT CWR BEGIN : MVI C,08H LXI H,2050H L1: MOV A,M OUT PA CALL DELAY INX H DCR C JNZ L1 JMP BEGIN

1 0 0 0 0 0 0 0

= 80H CWR

5-D) TO ROTATE HALF STEP OR 8 SEQUENCE STEPPER MOTOR IN ANTI CLOCKWISE DIRECTION CONTINUOUSLY MVI A,80H OUT CWR BEGIN : MVI C,04H LXI H,2057H L1: MOV M,A OUT PA CALL DELAY DCX H DCR C JNZ L1 JMP BEGIN

1 0 0 0 0 0 0 0

= 80H CWR

5-E) WRITE A PROGRAM TO ROTATE STEPPER MOTOR BY 1800 IN CLOCKWISE DIRECTION.[ FULL STEP MOTOR ]
MVI A,80H ANGLE OF ROTATION FOR OUT CWR 1STEP=1.80 MVI B,19H NO. OF ROTATION FOR L2: LXI H,2050H 180=180/1.8=(100)d MVI C,04H FOR FOUR SEQUENCE = L1: MOV A,M 100/4=(25)d OUT PA =(19)H NO. OF CALL DELAY ROTATION INX H DCR C JNZ L1 1 0 0 0 0 0 0 0 DCR B JNZ L2 = 80H CWR HLT

5-F) WRITE A PROGRAM TO ROTATE STEPPER MOTOR 8 STEPS SEQUENCE OR HALF ANGLE STEPPER MOTOR IN CLOCKWISE DIRECTION BY 1800 MVI A,80H
OUT CWR ANGLE OF ROTATION FOR MVI B,19H 1STEP=0.90 L2: LXI H,2050H NO. OF ROTATION FOR MVI C,08H 180=180/0.9=(200)d FOR FOUR SEQUENCE = L1: MOV A,M 200/8=(25)d OUT PA =(19)H CALL DELAY NO. OF INX H ROTATION DCR C JNZ L1 1 0 0 0 0 0 0 0 DCR B JNZ L2 = 80H CWR HLT

SUMMERY
In this chapter we studied the interface of 8085 microprocessor and IC 8255 with ADC, DAC, Stepper motor, Temperature control and studied the various ADC and DAC ICs, Decoder, Latches.

Interfacing Of A to D

4141

REFERENCES
1)

2)

3)

4)

Microcontroller: Theory and application by Deshmukh Programming and Customizing 8051 microcontroller By Predko. 8051 Microcontroller hardware,Software & Application by V.Udayashankar & M.S.Mallikarjunaswamy. 8051 Microcontroller by Mohammad Mazidi

Interfacing Of A to D

4242

Vous aimerez peut-être aussi