8085 Micro-Processor Programs


HEX to ASCII conversion using 8085


Ø   An Assembly Language Program to perform HEX to ASCII conversion using 8085?

Algorithm

1)      Load the HEX value in to the accumulator.
2)      Compare the number with 0A.
3)      If number < 0A then jump to step 7.
4)      Add 07H with the number and store the result in the accumulator.
5)      Store the result in memory.
6)      Terminate the program.

Program

MEMORY
LABEL
MNEMONIC
HEX CODE
COMMENT
4300

LDA 4400
3A
Load the HEX value to the accumulator
4301


00
4302


44
4303

CPI 0A
FE
Compare accumulator with 0A
4304


0A
4305

JC AHEAD
DA
Jump on carry to the label AHEAD
4306


0A
4307


43
4308

ADI O7
C6
Add 07H with the accumulator content
4309


07
430A
AHEAD
ADI 30
C6
Add 30H with the accumulator content
430B


30
430C

STA 4401
32

Store the ASCII value in 4401
430D


01
430E


44
430F

HLT
76
Program ends

Observation

Input at           4400    :           06        ------- HEX value

Output at         4401    :           36        ------- ASCII value

---------------------------------------------------------------------------------

BCD to XS-3 conversion using 8085


Ø   An Assembly Language Program to perform BCD to XS-3 conversion using 8085?

Algorithm

1)      Load the BCD value in to the accumulator.
2)      Compare the number with 0A.
3)      If there is no carry then jump to step 7.
4)      Add 03H with the number and store the result in the accumulator.
5)      Store the result in memory.
6)      Terminate the program.
7)      Copy the content in the B register to Accumulator.
8)      Store the result in memory.
9)      Terminate the program.

Program

MEMORY
LABEL
MNEMONIC
HEX CODE
COMMENT
4200

MVI B,00
06
Initialize B with 0
4201


00
4202

LDA 4400
3A
Load the BCD value to Accumulator
4203


00
4204


44
4205

CPI OA
FE
Compare accumulator with 0A
4206


0A
4207

JNC LOOP
D2
Jump on no carry to the label LOOP
4208


10
4209


42
420A

ADI 03
C6
Add 03H with the accumulator
420B


03
420C

STA 4401
32

Store accumulator content to 4401
420D


01
420E


44
420F

HLT
76
Terminate program
4210
LOOP
MOV A,B
78
Copy register B’s content to A
4211

STA 4401
32

Store accumulator content to 4401
4212


01
4213


44
4214

HLT
76
Program ends

Observation

Input at           4400    :           06           -------- BCD value

Output at         4401    :           39        -------- XS-3


---------------------------------------------------------------------------------

1 comment:

  1. programs are very good and it is executable and understandable thank you sir for ur programs

    ReplyDelete