8085 applications
DESCRIPTION
8085 applicationsTRANSCRIPT
![Page 1: 8085 Applications](https://reader033.vdocuments.site/reader033/viewer/2022061523/563db785550346aa9a8bd09a/html5/thumbnails/1.jpg)
The 8085 Applications
![Page 2: 8085 Applications](https://reader033.vdocuments.site/reader033/viewer/2022061523/563db785550346aa9a8bd09a/html5/thumbnails/2.jpg)
Measurement of Voltage/Current
For measuring voltage/current we need to interface ADC 0808 with 8085 using 8255. Let us use port A of 8255 for transferring digital data output of ADC to the CPU and port C for control signals.
Assume that an analog input is present at I/P2 of the ADC and a clock input of suitable frequency is available for ADC.
Since the analog input I/P2 is used and therefore address pins A,B,C should be 0,1,0 respectively to select I/P2.
The OE and ALE pins are already kept at +5V to select the ADC and enable the outputs.
Port C upper acts as the input port to receive the EOC signal while port C lower acts as the output port to send SOC to the ADC.
![Page 3: 8085 Applications](https://reader033.vdocuments.site/reader033/viewer/2022061523/563db785550346aa9a8bd09a/html5/thumbnails/3.jpg)
Measurement of Voltage/Current
This Configuration is shown in figure below
![Page 4: 8085 Applications](https://reader033.vdocuments.site/reader033/viewer/2022061523/563db785550346aa9a8bd09a/html5/thumbnails/4.jpg)
Measurement of Voltage/Current
The 8255 control word is written as follows:
D7 D6 D5 D4 D3 D2 D1 D0
1 0 0 1 1 0 0 0 = 98H
![Page 5: 8085 Applications](https://reader033.vdocuments.site/reader033/viewer/2022061523/563db785550346aa9a8bd09a/html5/thumbnails/5.jpg)
Measurement of Voltage/Current
The required ALP is as follows: MVI A, 98h ;initialize 8255 as OUT CWR ;discussed above. MVI A, 02h ;Select I/P2 as analog OUT Port B ;input. MVI A, 00h ;Give start of conversion OUT Port C ; pulse to the ADC MVI A, 01h OUT Port C MVI A, 00h OUT Port C
WAIT: IN Port C ;Check for EOC by reading port C upper RCR ;rotating through carry
JNC WAIT ;In no EOC, then check again IN Port A ;If EOC, read digital equivalent in A HLT ;Stop.
![Page 6: 8085 Applications](https://reader033.vdocuments.site/reader033/viewer/2022061523/563db785550346aa9a8bd09a/html5/thumbnails/6.jpg)
Measurement of Frequency
To evaluate frequency, the number of cycles/seconds has to be determined.
The signal input from the pulse generator is applied to SID line of the 8085. The RIM instruction reads the SID line and stores it in the 7th bit of accumulator.
The program detects the rising edge and subsequent falling edge of the signal. Once detected, it increments the count in HL pair, which is initialized to zero at the beginning. This way number of pulses is counted till the timer generates an interrupt to the processor.
![Page 7: 8085 Applications](https://reader033.vdocuments.site/reader033/viewer/2022061523/563db785550346aa9a8bd09a/html5/thumbnails/7.jpg)
The maximum delay produce by 8253 timer is 1/23 of second. The HL pair has number of pulses counted for 1/23 of second. Therefore, the content of HL pair is multiplied by 23 which gives total number of pulses per second.
The interrupt to processor is given through RST 5.5 line.
![Page 8: 8085 Applications](https://reader033.vdocuments.site/reader033/viewer/2022061523/563db785550346aa9a8bd09a/html5/thumbnails/8.jpg)
The Hardware configuration is shown below
![Page 9: 8085 Applications](https://reader033.vdocuments.site/reader033/viewer/2022061523/563db785550346aa9a8bd09a/html5/thumbnails/9.jpg)
The interrupt mask required is
D7 D6 D5 D4 D3 D2 D1 D0
0 0 0 1 1 1 1 0 = 1E
![Page 10: 8085 Applications](https://reader033.vdocuments.site/reader033/viewer/2022061523/563db785550346aa9a8bd09a/html5/thumbnails/10.jpg)
![Page 11: 8085 Applications](https://reader033.vdocuments.site/reader033/viewer/2022061523/563db785550346aa9a8bd09a/html5/thumbnails/11.jpg)
The CWR of timer required is
D7 D6 D5 D4 D3 D2 D1 D0
0 0 1 1 0 0 0 0 = 30H
![Page 12: 8085 Applications](https://reader033.vdocuments.site/reader033/viewer/2022061523/563db785550346aa9a8bd09a/html5/thumbnails/12.jpg)
The Program is given by
MVI A,30 ;Control word for timer
OUT CWR ;Port Addres of CWR of Timer
MVI A,FF ;Move LSB of the count to counter0
OUT CONT0 ;Port address of counter 0
MVI A,FF ;Move MSB of count to counter0
OUT CONT0 ;Port address of counter0
LXI H,0000 ;Clear HL pair for pulse count
EI ;Enable Interrupt
MVI A,1E ;Set RST5.5 SIM ;Set interrupt mask
![Page 13: 8085 Applications](https://reader033.vdocuments.site/reader033/viewer/2022061523/563db785550346aa9a8bd09a/html5/thumbnails/13.jpg)
Nohigh: RIM ;Identify low to high transition
ANI 80
CPI 80 ;Compare with 80
JC Nohigh ;If no transition look again
Nolow: RIM ;Identify high to low transition
ANI 80
CPI 80
JZ Nolow ;If no transition look again
INX H ;If transition completes increament pulse count
SHLD 4200 ;Store pulse count at 4200
JMP Nohigh ;Repeat for more pulse count
![Page 14: 8085 Applications](https://reader033.vdocuments.site/reader033/viewer/2022061523/563db785550346aa9a8bd09a/html5/thumbnails/14.jpg)
The ISR of RST5.5
002C: JMP 4300 ;jump to specific address
4300: LHLD 4200 ;Get the count of pulses in HL pair
XCHG ;Copy the count in DE pair
LXI H,0000 ;Clear HL pair
MVI B,17 ;Initialize B to 17H(23D)
Repeat: DAD D ;Add HL pair and DE pair
DCR B ;Decrement B
JNZ Repeat ;Multiplication by repeated addition
SHLD 4500 ;Store HL pair in 4500 and 4501
![Page 15: 8085 Applications](https://reader033.vdocuments.site/reader033/viewer/2022061523/563db785550346aa9a8bd09a/html5/thumbnails/15.jpg)
LDA 4501 ;start packed to unpacked conversion
ANI F0 ;AND to get the MSD
RRC ;Rotate to get the digit in right position
RRC
RRC
RRC
STA 4600 ;Store it at 4600
LDA 4501
ANI 0F ;AND to get LSD
STA 4601 ;Store it at 4601
LDA 4500 ;Get Lower significant two digits
ANI F0 ;AND to get the MSD
RRC ;Rotate to get the digit in right position
RRC
RRC
RRC
STA 4602 ;Store it at 4600
LDA 4500
ANI 0F ;AND to get LSD
STA 4603 ;Store it at 4601
![Page 16: 8085 Applications](https://reader033.vdocuments.site/reader033/viewer/2022061523/563db785550346aa9a8bd09a/html5/thumbnails/16.jpg)
LXI H,4600 ;Call Display routine to Display result
MVI A,03
MVI C,09 ;Segment Address
CALL 0005 ;Display Routine
HLT