Unit 5
Unit 5
AIM:
a) To interface the DAC unit to microprocessor and to write an ALP
to convert the given digital word to analog voltage and also to
generate sawtooth, triangular and sinewaves.
b) To interface ADC unit to microprocessor and to write an ALP to
convert the given analog voltage to digital word.
APPARATUS REQUIRED:
8085 microprocessor kit, ADC/DAC interfacing board, CRO probe,
CRO, power supply(variable), digital multimeter and connecting wires.
THEORY:
DAC INTERFACE SECTION:
DAC 0800 is a monolithic, high speed, current output D/A Converter. Its
unique features are:
The address lines A6 and A7 are Nanded together and the Nand gate
output is connected to pin 6 of 74LS138. Pin 4 is ground. Thus with
A7 A6 A5 A4 A3 A2 A1 A0
1 1 0 0 0 X X X
=C0(hex)
DAC1 is selected.
The design comprised of the latch 74LS273, DAC 0800 and the
current to voltage converting circuitry using OPAMP-741. DAC 0800 is
configured for bipolar output operation.
=C8(hex)
The I/O address for the latch 74LS174 which latches the databus to
ADD0, ADD1, ADD2 and ALE is
A7 A6 A5 A4 A3 A2 A1 A0
1 1 1 0 0 X X X
=E0(hex)
The start of conversion pulse can be given by means of software also.
The flip flop 74LS74 which transfers the D0 line status to the SOC pin
of the ADC0809 is selected, when
A7 A6 A5 A4 A3 A2 A1 A0
1 1 0 1 0 X X X
=D0(hex)
The EOC output of ADC0809 is transferred to the data line D0, when
74LS125 is selected with address,
A7 A6 A5 A4 A3 A2 A1 A0
1 1 0 1 1 X X X
=D8(hex)
PROGRAM-1:
AIM:
To obtain a output of 0 volts at DAC1.
Since DAC0800 is an 8-bit DAC and the output voltage variation is
between -5V to +5V. The digital data input and the corresponding output
voltages are presented in the following table.
Input Data in Hex Output Voltage
00 -5.00
01 -4.96
02 -4.92
. .
. .
7F 0.00
. .
. .
FD 4.92
FE 4.96
FF 5.00
Execute the following program and observe that the output voltage at
DAC1 is 0 volts.
MEMORY
OP-CODE LABEL MNEMONICS
LOCATION
ORG 4100H
4100 3E,7F MVI A, 7F
4102 D3,C0 OUT C0H
4104 76 HLT
PROGRAM-2:
AIM:
To create a saw tooth wave at the output of DAC1.Output digital data
from 00 to FF in constant steps of 01 to DAC1. Repeat this sequence
again and again. As a result, a saw-tooth wave will be generated at
DAC1 output.
MEMORY
OP-CODE LABEL MNEMONICS
LOCATION
ORG 4100H
4100 3E, 00 START MVI A, 00
4102 D3, C0 L1 OUT C0H
4104 3C INR A
4105 C2, 02, 41 JNZ L1
4108 C3, 00, 41 JMP START
PROGRAM-3:
To generate a triangular waveform at DAC1 output.
The following program will generate a triangular wave at DAC1 output.
MEMORY
OP-CODE LABEL MNEMONICS
LOCATION
ORG 4100H
4100 2E, 00 START MVI L, 00
4102 7D L1 MOV A, L
4103 D3, C0 OUT C0H
4105 2C INR L
4106 C2, 02, 41 JNZ L1
4109 2E, FF MVI L, FFH
410B 7D L2 MOV A, L
410C D3, C0 OUT C0H
410E 2D DCR L
410F C2, 0B, 41 JNZ L2
4112 C3, 00, 41 JMP START
PROGRAM-4:
AIM:
To generate a sine-wave at DAC1 output.
A lookup table is provided in the program for sine-wave generation.
Output data continuously to DAC1 from this lookup table. Verify, using
a CRO at DAC1 output, that the waveform is a sinewave. The data for
lookup table is arrived by experiment.
MEMORY
OP-CODE LABEL MNEMONICS
LOCATION
ORG 4100H
4100 21, 10, 41 START LXI H, 4110H
4103 0E, 46 MVI C, 46
4105 7E LOOP MOV A, M
4106 D3, C0 OUT C0H
4108 23 INX H
4109 0D DCR C
410A C2, 05, 41 JNZ LOOP
410D C3, 00, 41 JMP START
LOOKUP:
MEMORY LOCATION DATA
4110 7F, 8A, 95, A0
4114 AA, B5, BF, C8
4118 D1, D9, E0, E7
411C ED, F2, F7, FA
4120 FC, FE, FF, FE
4124 FC, FA, F7, F2
4128 ED, E7, E0, D9
412C D1, C8, BF, B5
4130 AA, A0, 95, 8A
4134 7F, 74, 69, 5F
4138 53, 49, 3F, 36
413C 2D, 25, 1D, 17
4140 10, 0B, 07,04
4144 01, 00, 01, 04
4148 07, 0B, 10, 17
414C 1D, 25, 2D, 36
4150 3F, 49, 53, 5F
4154 69, 74
PROGRAM-5:
AIM:
In a real-time application, input of data and processing of data are
indispensable.
The following programs initiate the conversion process, checks the EOC
pin of ADC-0809 as to whether the conversion is over and then inputs
the data to the processor. It also instructs the processor to store the
converted data at RAM location 4150 (hex).
MEMORY
OP-CODE LABEL MNEMONICS
LOCATION
Execute this program. Compare the data displayed at the LEDs with that
stored at location 4150H.
FREQUENCY MEASUREMENT
Aim: To measure the frequency of the sine waveform.
Apparatus required: Bread board, Connecting wires, resistors, Op-amp, CRO, Function
generator, CRO probes, Power supply, Microprocessor kit.
Theory: The sine wave whose frequency is to be measured can be applied to zero crossing
detector. Since the number of zero crossings for every cycle is two, the number of zero
crossing for a time interval of 0.5 seconds is equal to frequency. For this a square wave form
of frequency 1 Hz. is generated using 8253 operating it in mode 3 and rising edge of the
square wave form is checked. Once the raising edge is found the number of zero crossings is
counted until the falling edge of the square wave. This count is equal to frequency and can be
displayed on address field.
To generate a square wave of 1 Hz frequency the 8253 is kept in mode 3. Since the clock
frequency is 3 MHz, the count required to generate square wave of 1 Hz is
= 300000/1=300000
Since the maximum count that can be loaded in a 16 bit counter is 65,535, we have to use two
counters for count value. 3,00,00. So we use the first counter with a count 3000 and second
counter with a count 1000. We use two counters counter 0 with count 3000 and the counter 1
with a count 1000.
Circuit Diagram
Algorithm
1. Initialize BC register to 0000.
10. Call subroutine synch that find falling edge of the output of ZCD
16. Call subroutine conversion that convert the BC register contents in to single digits and
store from locations form 4600.
17 Call subroutine display that display the contents of data stored from locations 4600 to
4603 on address field
18.Stop th eprogram
Subroutine synch
1. Read Port A
Subroutine REDGE
1. Read Port A
Subroutine Display
4.Call monitor program which display the contents of 4600 to 4603 on address field
PROGRAM:
MEMORY MACHINE LABEL NEMONICS
LOCATION CODE
4100 01,00,00 LXI B,0000
4103 3E,92 MVI A,92
4105 D3,0F OUT 0F
4107 3E,37 MVI A,37
4109 D3,CE OUT CE
410B 3E,00 MVI A,00
410D D3,C8 OUT C8
410F 3E,30 MVI A,30
4111 D3,C8 OUT C8
4113 3E,77 MVI A,77
4115 D3,CE OUT CE
4117 3E,00 MVI A,00
4119 D3,CA OUT CA
411B 3E,10 MVI A,10
411D D3,CA OUT CA
411F DB,0D LOOP IN 0D
4121 E6,01 ANI 01
4123 CA,1F,41 JZ LOOP
4126 CD,00,42 LOOP1 CALL SYNC
4129 03 INXB
412A CD,00,43 CALL REDGE
412D 03 INX B
412E DB,0D IN 0D
4130 E6,01 ANI 01
4132 C2,26,41 JNZ LOOP1
4135 CD,50,41 CALL CONVERSION
4138 CD,00,45 CALL DISPLAY
413B 76 HLT
CONVERSION:
MEMORY MACHINE LABEL NEMONICS
LOCATION CODE
4150 79 MOV A,C
4151 E6,0F ANI 0F
4153 32,03,46 STA 4603
4156 79 MOV A,C
4157 E6,F0 ANI F0
4159 0F RRC
415A 0F RRC
415B 0F RRC
415C 0F RRC
415D 32,02,46 STA 4602
4160 78 MOV A,B
4161 E6,0F ANI 0F
4163 32,01,46 STA 4601
4166 78 MOV A,B
4167 E6,F0 ANI F0
4169 0F RRC
416A 0F RRC
416B 0F RRC
416C 0F RRC
416D 32,00,46 STA 4600
4170 C9 RET
SYNC:
MEMORY MACHINE LABEL NEMONICS
LOCATION CODE
4200 DB,0C IN 0C
4202 E6,01 ANI 01
4204 C2,00,42 JNZ SYNC
4207 C9 RET
REDGE:
MEMORY MACHINE LABEL NEMONICS
LOCATION CODE
4300 DB,0C IN 0C
4302 E6,01 ANI 01
4304 CA,00,43 JZ REDGE
4307 C9 RET
DISPLAY:
MEMORY MACHINE LABEL NEMONICS
LOCATION CODE
4500 F5 PUSH PSW
4501 C5 PUSH B
4502 3E,03 MVI A,03
4504 0E,09 MVI C,09
4506 21,00,46 LXI H,4600
4509 CD,05,00 CALL 0005
450C C1 POP B
450D F1 POP PSW
450E C9 RET
STEPPR MOTOR INTERFACE
AIM:
To interface the given stepper motor to 8085 Microprocessor kit and write an ALP to
run the motor in both clockwise and anticlockwise directions.
APPARATUS REQUIRED:
Stepper motor, microprocessor kit, stepper motor, interfacing unit
THEORY:
STEPPER MOTOR:
A motor in which the rotor is able to assume only discrete stationary angular
displacement is a stepper motor. The rotary motion occurs in a stepwise manner from one
equilibrium position to the next.
CONSTRUCTIONAL FEATURES:
3600
------------------------------
NS * Nr
where ,
Generally step size of the stepper motor depends upon Nr. These stable positions can be
attained by simply energising the winding on any one of the stator poles with a DC. There are
three different schemes available for “stepping” a stepper motor. These are:
Here we are going to use 2-phase scheme for stepping a stepper motor.
2-PHASE SCHEME:
In this scheme, any two adjacent stator windings are energised. There are two
magnetic fields active in quadrature and none of the rotor pole face can be in direct
alignment with the stator poles. A partial but symmetric alignment of the rotor poles
is of course possible.
Next, when B1 and A2 are energised. S2 tends to align with B1 (N) and S3
with A2 (N). Of course, again under equilibrium conditions, only partial alignment is
possible and N1 finds itself in the neutral region, midway between B1 (N) and A2 (N)
[step (b)]. In step (c), A2 and B2 are on. S3 and S1 tend to align with A2 (N) and B2
(N), respectively with N2 in the neutral zone. Step (d) illustrates the case when A1
and B2 are on.
The step angle is 300 as in the wave scheme. However, the rotor is offset by
150 in the 2-phase scheme with respect to the wave scheme. A total of 12 steps are
required to move the rotor by 3600 (mechanical). 2-phase drives produce more torque
than the wave drives.
The switching sequence for the 2-phase scheme is given in the below table:
ANTICLOCKWISE CLOCKWISE
STEP A1 A2 B1 B2 steps A1 A2 B1 B2
1 1 0 0 1 1 1 0 1 0
2 0 1 0 1 2 0 1 1 0
3 0 1 1 0 3 0 1 0 1
4 1 0 1 0 4 1 0 0 1
DRIVING CIRCUITRY:
Stepper motor requires logic signals of relatively high power. In these boars the
silicon Darlington pair (TIP 122) transistors are used to supply that required power. The
driving pulses are generated by the interface circuit. The input for the interface circuit is TTL
pulses generated under software control using the microprocessor kit. The TTL levels of
pulses sequence from the data bus is translated to high voltage output pulses using a buffer
7407 with open collector.
The darlington pair transistor (TIP 122) drive the stepper motor as they withstand
higher current. A 220 ohm resistor and an IN 4148 diode are connected between the power
supply and darlington pair collector for supporting fly back current.
The data lines D0-D3 and D4-D7 are used to drive the 8 TIP 122 available on this
board as shown in the appendix A. The four collector points of each TIP 122 are brought to
two 5 pin connectors P2 & P3 to connect two different stepper motors. With this board it is
possible to connect stepper motor of torque ranging from 2kg to 20kg wit operating voltages
of 12V, 24V, & 6V.
PROGRAM:
To run a stepper motor for required angle within 3600 which is equivalent to 256 steps.
4118 23 INX H
4119 05 DCR B
4120 09 05 06 0A LOOK DB 09 05 06 0A
UP
4124 76 END HLT
PROGRAM:
To run stepper motor in both forward and reverse directions with delay.
4108 OD DCR C
4117 OD DCR C
412B B2 ORA D
412F 23 INX H
4130 05 DCR B
413A B2 ORA D
413B C2 38 41 JNZ LOOP 2
413E C9 RET