Professional Documents
Culture Documents
DIGITAL ASSIGNMENT 05
LCD PROGRAMMING
QUESTION: Connect the LCD to your 8051 Kit. Then write and run a program to
display your name on line 1 of the LCD (first name followed by last name with a space in
between).
Note: If you are not monitoring the busy flag of the LCD, put a few milliseconds delay in
your program.
PROGRAM:
ORG 0000H
MOV A,#38H
ACALL CMNWRT
ACALL DELAY
MOV A,#0EH
ACALL CMNWRT
ACALL DELAY
MOV A,#01H
ACALL CMNWRT
ACALL DELAY
MOV A,#06H
ACALL CMNWRT
ACALL DELAY
MOV A,#80H
ACALL CMNWRT
ACALL DELAY
MOV A,#'V'
ACALL DATWRT
ACALL DELAY
MOV A,#'I'
ACALL DATWRT
ACALL DELAY
MOV A,#'T'
ACALL DATWRT
ACALL DELAY
AGAIN: SJMP AGAIN
CMNWRT:
NAME : ashish KUMAR
REGISTRATION NO. : 21BEC2017
SIMULATION:
NAME : ashish KUMAR
REGISTRATION NO. : 21BEC2017
OBSERVATION:
We observed here that when we pressed the reset button on the LCD processor it started
displaying VIT one by one character on the LCD screen.
NAME : ashish KUMAR
REGISTRATION NO. : 21BEC2017
QUESTION: Connect the LCD to your 8051 Kit. Then write and run a program to
display “VIT UNIVERSITY” on 2 line of the LCD.
PROGRAM:
ORG 200H
DB 'VIT'
CHECK: SJMP CHECK
ORG 250H
DB 'UNIVERSITY'
CHECK2: SJMP CHECK2
ORG 0H
NAME : ashish KUMAR
REGISTRATION NO. : 21BEC2017
SIMULATION:
NAME : ashish KUMAR
REGISTRATION NO. : 21BEC2017
OBSERVATION:
We observed here that when we pressed the reset button on the LCD processor started
displaying VIT in one line and UNIVERSITY in next line, one by one character on the LCD
screen display using the DPTR command.
NAME : ashish KUMAR
REGISTRATION NO. : 21BEC2017
QUESTION_01: Add the contents of Registers R1,R2 and save the result in to R3.Use
Step execution in keil, write down the contents of various flags of ARM7
PROGRAM:
AREA PROG_2_1, CODE, READONLY
ENTRY
MOV R1, #0x25 ;R1 = 0x25
MOV R2, #0x34 ;R2 = 0x34
ADD R3, R2,R1 ;R3 = R2 + R1
HERE B HERE ;stay here forever
END
SIMULATION:
NAME : ashish KUMAR
REGISTRATION NO. : 21BEC2017
OBSERVATION:
We observed here that we can add two values using ADD command by first storing the two
values in R1 and R2 registers respectively and then adding them and storing the result in R3
register.
NAME : ashish KUMAR
REGISTRATION NO. : 21BEC2017
PROGRAM:
AREA EXP2, CODE, READONLY
ENTRY
START MOV R0,#0XFFFFFFFF
MOV R1,#0X80000000
MULS R2,R0,R1
END
SIMULATION:
OBSERVATIONS:
We observed here that we multiplied two values using MULS command and storing the
resulted value in R2 register.
NAME : ashish KUMAR
REGISTRATION NO. : 21BEC2017
QUESTION_03: Let the register content of r5 and r7 are 5 and 8 respectively. Without
using MUL instruction make r5 content as 14h(20d).
PROGRAM:
AREA EXP3, CODE, READONLY
ENTRY
START MOV R5,#5
MOV R7,#8
MOV R7,R5,LSL#2
END
SIMULATION:
OBSERVATIONS:
We observed here that to make the value of R5 as 14H from 5D we used the LSL instruction
i.e logically shift left two time because 5D=0101B after 1 left shift it becomes 10D=01010B
and after 2nd left shift it becomes 20D=010100H.
NAME : ashish KUMAR
REGISTRATION NO. : 21BEC2017
PROGRAM:
AREA EXP3, CODE, READONLY
ENTRY
START LDR R1,=0xF631024C
LDR R0,=0x17539ABD
EOR R0,R0,R1
EOR R1,R0,R1
EOR R0,R0,R1
END
SIMULATION:
NAME : ashish KUMAR
REGISTRATION NO. : 21BEC2017
OBSERVATIONS:
We observed here that when we perform XOR operation on two values which are stored in
R0 and R1 respectively we get a new value that is stored in one of the register(here R0) and
then again we perform the XOR operation of the value stored with the other value then we
get the First value which we stored in the other register(here R1).Lastly we again performed
XOR operation to get the other value which is then stored in the other register(here R0) and
hence swapping the two values of both the registers.
NAME : ashish KUMAR
REGISTRATION NO. : 21BEC2017
QUESTION_05: What is the inference of the following code? Execute and Observe.
PROGRAM:
AREA EXP3, CODE, READONLY
ENTRY
START MOV R1,#0x77
MOV R0,#0
RSB R0,R1,#2
END
SIMULATION:
OBSERVATIONS:
We observed here that using rsb command we subtracted the value of R1 register i.e.(77H)
from 2 and stored the result in R0 register that means R0=77h-2d.
NAME : ashish KUMAR
REGISTRATION NO. : 21BEC2017
QUESTION_06: What is the inference of the following code? Execute and Observe.
PROGRAM:
AREA EXP10, CODE, READONLY
ENTRY
START MOV R0,#5
MOV R3,R0
MOV R1,#1
LOOP
MUL R2,R0,R1
MOV R0,R2
ADD R1,#1
CMP R1,R3
BLT LOOP
MOV R5,R0
HLT
B HLT
END
NAME : ashish KUMAR
REGISTRATION NO. : 21BEC2017
SIMULATION:
OBSERVATIONS:
We observed here that the factorial of the integer 5 is computed using this code, and the result
is stored in register R5.R0 is initialised to 5, R3 to 5, and R1 to 1, then it enters a loop where
each iteration multiplies R0 by R1 and increases R1 by 1. The cycle repeats until R1 exceeds
R3 (where it is 5). The factorial of 5, which is kept in R5, is the ultimate value of R0.The
programme then goes into an infinite loop (HLT followed by B HLT) and stops working.
NAME : ashish KUMAR
REGISTRATION NO. : 21BEC2017
QUESTION_07: What is the inference of the following code? Execute and Observe.
PROGRAM:
AREA EXP4, CODE, READONLY
ENTRY
START MOV R0,#-4
LDR R2,=0X80000000
AND R3,R2,R0
CMP R3,R2
MVNEQ R1,R0
ADDEQ R1,#1
MOVNE R1,R0
HLT
B HLT
END
SIMULATION:
NAME : ashish KUMAR
REGISTRATION NO. : 21BEC2017
OBSERVATIONS:
In the above program, -4 is stored in RO, 80000000H is stored in R2, then AND operation is
performed with R2 and RO, the result is stored in R3. Now we compare the R3 value and the
R2 value, if they are equal we perform MVN operation (Bitwise NOT operation) else if they
are equal then we ADD 1 to R1. Finally if they are not equal we move RO to R1.