Micro processor Lab Manual / Display text on LCD using ALP

Program Name

Write a Assembly Language Program for Display text on LCD.
Theory
Instruction Mnemonic Operand Comments
MVI A,80H Load accumulator with 80H to configure CWR. /td>
OUT CWR Configure CWR to display output with accumulator value. /td>
CALL LCDINIT Calling the lcd initialization sub routine /td>
MVI A,80 Loading the value 80H into accumulator /td>
CALL LCDCMD Calling the subroutine lcd command /td>
LXI H,8100 Loading the contents of address 8100 into register pair /td>
CALL LCDSTR Calling the sub routine /td>
MVI A,C0 Moving C0 into accumulator to configure the starting address of the second line /td>
CALL LCDCMD Calling the sub routine lcd command /td>
LXI H,8200 Loading the contents of address 8200 into the register pair /td>
CALL LCDSTR Calling the subroutine lcd string /td>
HLT End of the program /td>


LCD Command Code
Instruction Mnemonic Operand Comments
MVI A,38H Moving the value 38 into accumulator to initialize or configure the two line display /td>
CALL LCDCMD Calling the lcd command sub routine /td>
MVI A,0C Passing 0C into accumulator to configure the cursor off , the display on.
CALL LCDCMD Calling the lcd command sub routine /td>
MVI A,06 Moving 06 to accumulator to configure the cursor towards right
CALL LCDCMD Calling the lcd command sub routine /td>
MVI A,01 Moving 01 to accumulator to clear the display /td>
CALL LCDCMD Calling the lcd command sub routine
RET Returning back to the next instruction where we encountered the LCDINIT call


Instruction Mnemonic Operand Comments
MVI A,80H Load accumulator with 80H to configure CWR. /td>
OUT CWR Configure CWR to display output with accumulator value. /td>
CALL LCDINIT Calling the lcd initialization sub routine /td>
MVI A,80 Loading the value 80H into accumulator /td>
CALL LCDCMD Calling the subroutine lcd command /td>
LXI H,8100 Loading the contents of address 8100 into register pair /td>
CALL LCDSTR Calling the sub routine /td>
MVI A,C0 Moving C0 into accumulator to configure the starting address of the second line
CALL LCDCMD Calling the sub routine lcd command /td>
LXI H,8200 Loading the contents of address 8200 into the register pair /td>
CALL LCDSTR Calling the subroutine lcd string /td>
HLT End of the program /td>


LCD Initilization Code
Instruction Mnemonic Operand Comments
MVI A,38H Moving the value 38 into accumulator to initialize or configure the two line display /td>
CALL LCDCMD Calling the lcd command sub routine /td>
MVI A,0C Passing 0C into accumulator to configure the cursor off , the display on.
CALL LCDCMD Calling the lcd command sub routine /td>
MVI A,06 Moving 06 to accumulator to configure the cursor towards right
CALL LCDCMD /td> Calling the lcd command sub routine /td>
MVI A,01 Moving 01 to accumulator to clear the display /td>
CALL LCDCMD /td> Calling the lcd command sub routine /td>
RET Returning back to the next instruction where we encountered the LCDINIT call /td>
LCD Command Code
<
Instruction Mnemonic Operand Comments
OUT Pa Configuring output port a
MVI A,FC Moving the value FC to accumulator to configure the PB2,PB1,PB0 pins(data write command)
OUT Pb Configuring output port b
CALL DELAY Calling the delay sub routine
MVI A,F8 Moving the value F8 to accumulator to configure the PB2,PB1,PB0 pins(data write data)
OUT Pb Configuring output port b
RET Returning back to the LCDINIT subroutine where we encountered the respective LCDCMD call


LCD Character Code
Instruction Mnemonic Operand Comments
OUT Pa Configuring output port a
MVI A,FD Moving the value FD to accumulator to configure the PB2,PB1,PB0 pins(command write command)
OUT Pb Sending 00H through Pb
CALL DELAY Calling the delay sub routine
MVI A,F9 Moving the value F9 to accumulator to configure the PB2,PB1,PB0 pins(data write command)
OUT Pb Configuring output port b
RET Returning to the LCDSTR subroutine where we encountered the LCDCHR call


LCD Delay Code
Instruction Mnemonic Operand Comments
MVI B,FF Moving immediately the maximum value FF to register B
DCR B Decrementing the value stored in register B
JNZ XX If the result of previous operation is not 00H then continue decrementing value of register B
RET Return back to the subroutines where delay function was encountered


LCD String Code
Instruction Mnemonic Operand Comments
MOV A,M Moving the contents of memory location to accumulator
CPI 0 Comparing immediately the content of accumulator with 00 to check if it has reached last address of display.
RZ Return to main program from where control has been suspended , if the result of previous operation is zero
CALL LCDCHR Calling the lcd character sub routine
INX H Incrementing the value stored in HL pair by 1
JMP LCDSTR Jumping back to the lcd string subroutine
Program Code


Online compiler for 8085 Microprocess Compiler


Home     Back