Microprocessor and Microcontrollers Lab
Ex. No : CODE CONVERSIONS
Date :
AIM:
To write an assembly language program to convert
BCD to Hexadecimal
Hexadecimal to Binary
using 8085 microprocessor kit.
ALGORITHM:
a. BCD TO HEXADECIMAL:
1. Start the program.
2. Get the BCD data in A register and move to B register.
3. Mask the lower nibble of BCD data in A register.
4. Rotate the upper nibble to lower nibble position and save in B register.
5. Clear the accumulator.
6. Move 0AH to C register.
7. Add B register to A register.
8. Decrement C register If ZF=0 go to step 7 If ZF=1 go to next step.
9. Save the product in B register.
10. Get the BCD data in A register.
11. Add the units (A reg) to product (B reg).
12. Store the binary value in memory.
13. Stop the program.
b. HEXA TO BINARY
1. Start
2. Move the count in B register
3. Load the number in Accumulator
4. Intialise memory pointer
5. Rotate accumulator right with carry
6. If carry load memory pointer with 1 and increment memory else move 0 to memory and
increment it.
7. Decrement count
8. Jump on non zero to step 5
9. Stop
Department of Electrical and Electronics Engineering / SKCET
Microprocessor and Microcontrollers Lab
PROGRAM ASSEMBLY FORM
PROGRAM TITLE: BCD TO HEXADECIMAL
HEXADECIMAL MNEMONIC INSTRUCTION
COMMENTS
ADDRESS INSTR. LABEL OPCODE OPERAND
4100 START LDA 4500
4101
4102
4103 MOV B,A
4104 ANI OF
4105
4106 MOV E,A
4107 MOV A,B
4108 ANI FO
4109
410A RRC
410B RRC
410C RRC
410D RRC
410E MOV D,A
410F XRA A
4110 MVI H,OA
4111
4112 L1 ADD H
4113 DCR D
4114
4115 JNZ L1
4116
4117 ADD E
4118 STA 4501
4119
411A
411B HLT
Department of Electrical and Electronics Engineering / SKCET
Microprocessor and Microcontrollers Lab
PROGRAM ASSEMBLY FORM
PROGRAM TITLE: HEXADECIMAL TO BINARY
HEXADECIMAL MNEMONIC INSTRUCTION
COMMENTS
ADDRESS INSTR. LABEL OPCODE OPERAND
4100 LXI H,4150
4101
4102
4103 MVI B,08H
4104
4105 MVI A,5AH
4106
4107 LOOP3 RRC
4108 JC LOOP1
4109
410A
410B MVI M,00H
410C
410D JMP LOOP2
410E
410F
4110 LOOP1 MVI M,01H
4111
4112 LOOP2 INX H
4113 DCR B
4114 JNZ LOOP3
4115
4116
4117 HLT
Department of Electrical and Electronics Engineering / SKCET
Microprocessor and Microcontrollers Lab
OBSERVATION:
BCD TO HEXADECIMAL:
MEMORY DATA1 DATA 2
LOCATION
INPUT
OUTPUT
HEXA TO BINARY
INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
RESULT:
Thus the code conversions
BCD to Hexadecimal
Hexadecimal to Binary
are done successfully using 8085 microprocessor.
Department of Electrical and Electronics Engineering / SKCET
Microprocessor and Microcontrollers Lab
Ex. No : PROGRAMMING FOR INTERFACE EXPERIMENTS
Date :
AIM:
To study the value of analog to digital conversion and digital to analog conversion.
A. ADC INTERFACING WITH 8085
B. DAC INTERFACING WITH 8085
ALGORITHM
A. ADC INTERFACE
1. Start the program
2. Initialize the count value
3. Move the data immediately to the accumulator
4. Store the data in specified address
5. Display the data with LED glowing ON/OFF
6. Stop the program
B. DAC INTERFACE
a. SQUARE WAVE GENERATOR:
b. SAW TOOTH WAVEFORM
c. TRIANGULAR WAVEFORM
a. SAW TOOTH WAVEFORM
1. Start the program
2. Load initial data as accumulator
3. Display the first data in output port address
4. Decrement the content of accumulator
5. If the data is zero jump to loop1
b. TRIANGULAR WAVEFORM
1. Start the program
2. Load the initial data in the accumulator
3. Write the data from the accumulator to the output port address
4. Increment the content of accumulator
5. If zero flag is reset, jump to loop1
6. Move the data FF to accumulator
7. Write the data from the accumulator to the output port address
8. Decrement the content of accumulator
9. Jump to loop3 if no zero exist
Department of Electrical and Electronics Engineering / SKCET
Microprocessor and Microcontrollers Lab
FLOWCHART: ANALOG TO DIGITAL CONVERTER
Start
Initialize the value
Set the mode for count
Transfer the data to output address
Check it with LED
Display
Stop
FLOWCHART: DAC INTERFACING SAWOOTH WAVE FORM
Start
Load the initial value in the acc
Display the data in accumulator to output port address
Increment the content of accumulator
Check the data is valid
Stop
Department of Electrical and Electronics Engineering / SKCET
Microprocessor and Microcontrollers Lab
FLOW CHART: DAC INTERFACING
TRIANGULAR
Start
Load the initial data to accumulator
Display 1st content in output port
If ZF=1
No
Yes
Initialize the 2nd content of accumulator
Display accumulator content in o/p port
Decrement 1st value
If ZF=1 No
Yes
Stop
Department of Electrical and Electronics Engineering / SKCET
Microprocessor and Microcontrollers Lab
PROGRAM ASSEMBLY FORM
PROGRAM TITLE: ADC INTERFACING
HEXADECIMAL MNEMONIC INSTRUCTION
COMMENTS
ADDRESS INSTR. LABEL OPCODE OPERAND
4100 3E MVI A,10 Move the data immediately to the
4101 10 accumulator
4102 D3 OUT C8 Display to port
4103 C8
4104 3E MVI A,18 Move the data immediately to the
4105 18 accumulator
4106 D3 OUT C8 Display to port
4107 C8
4108 76 HLT Stop the program
FORMULA USED:
TABLE:
Observed Digital Output Calculated
Output Output
Department of Electrical and Electronics Engineering / SKCET
Microprocessor and Microcontrollers Lab
PROGRAM ASSEMBLY FORM
PROGRAM TITLE: DAC INTERFACING
HEXADECIMAL MNEMONIC INSTRUCTION
COMMENTS
ADDRESS INSTR. LABEL OPCODE OPERAND
TRIANGULAR WAVE
4060 3E START MVI A,00 Move the data immediately to the
4061 00 accumulator
4062 D3 LOOP1 OUT C8 Write the data from A to port address
4063 C8
4064 3C INR A Increment the Accumulator
4065 C2 JNZ LOOP1 Jump to specified location if no zero
occurs
4066 62
4067 40
4068 3E MVI A,FF Move the data immediately to the
accumulator
4069 FF
406A D3 LOOP2 OUT C8 Write the data from A to port address
406B C8
406C 3D DCR A Decrement the Accumulator
406D C2 JNZ LOOP2 Jump to specified location if no zero
occurs
406E 6A
406F 40
4070 C3 JMP START Jump to specified location
4071 60
4072 40
SAW TOOTH WAVE :
4050 3E START MVI A,00 Move the data immediately to the
4051 00 accumulator
4052 D3 LOOP2 OUT C8 Write the data from A to port address
4053 C8
4054 3C INR A Increment the Accumulator
4055 C2 JNZ LOOP2 Jump to specified location if no zero
4056 52 occurs
4057 40
4058 C3 JMP START Jump to specified location
4059 50
405A 40
Department of Electrical and Electronics Engineering / SKCET
Microprocessor and Microcontrollers Lab
Model graph:
Amp in
Volts
Time in ms
b) Triangular Waveform c) Sawtooth Waveform
OBSERVATION:
WAVEFORM Amplitude in Volts Time Period in ms
TRIANGULAR
SAWTOOTH
RESULT:
Thus the programs for analog to digital conversion and digital to analog conversion with 8085
is executed and output is verified.
Department of Electrical and Electronics Engineering / SKCET