Programming Practices With Simulators
Programming Practices With Simulators
NO:14
8 bit operation
Aim:
To write and execute the Assembly language program for performing 8 bit addition, subtraction,
in 8051 using KEIL software.
Program logic:
8 bit addition
Data got from internal memory are loaded into ACC register and B registers. B register content is added
with ACC register content. Occurrence of carry flag (overflow) is checked. If it is occurred, then
increment carry counter by 1. ACC register contain the result of addition of two numbers. ACC content
and carry register content are stored in consecutive memory location.
Program
ORG 00H
SJMP START
START: MOV R0,#50H ; initialize data memory at 50h
MOV R1,#00H ; clear R0 reg for carry
MOV A,@R0; get first data in acc.
INC R0 ; move to next location
ADD A,@R0 ;add second data to acc content
JNC STORE ; check whether overflow occur
INC R1 ; if carry occur in c carry reg R1
STORE: INC R0 ; if no carry come to this loop STORE
MOV @R0,A ; store result in acc into mem location
NC R0 ; inc mem location
MOV A,R1 ;[ store carry reg]
MOV @R0,A ;content in next location]
END; halt the program
OUTPUT:
INPUT: OUTPUT:
R0-02H R0 05H
R1-03H R1 - 00H
Program logic:
8 bit subtraction:
Data got from internal memory are loaded into ACC register and B register. B register content is
subtracted wit Acc register content. Occurrence of carry flag (for barrow) is checked. If it is occurred,
then increment carry counter by 1. ACC register contain the result of subtraction of two numbers. ACC
content and carry register content are stored in consecutive memory location.
Program:
ORG 00H
SJMP START
START: MOV R0,#50H ; initialize data memory at 50h
CLR C; clear flag
MOV R1,#00H ; clear R0 reg for carry
MOV A, @R0; get first data in acc
INC R0; move to next location
subb A,@R0 ; subtract second data with acc content
JNC STORE; check whether carry occur
INC R1; if carry occur Inc carry reg R1
CPL A; [do 2's complement
INC A; of result]
STORE: INC R0 ; if no carry come to this loop STORE
MOV @R0, A; store result in acc into mem location
INC R0; Inc mem location
MOV A,R1 ;[ store carry reg
MOV @R0,A ; content in next location]
END; halt the program
OUTPUT:
INPUT: OUTPUT:
R0-05H R0 02H
R1-03H R1 - 00H
RESULT:
Thus the Assembly language program for 8 bit addition, subtraction in 8051is performed using
KEIL software.
Flowchart for rolling display
Start
Display A character
Stop
LOOK UP TABLE
EX.NO:15 MINI PROJECT DEVELOPMENT WITH PROCESSORS.
AIM
To interface the 8279 with 8085 microprocessor and perform the following operation.
To display the rolling message VRSCET in the display.
NOTE
a) Rolling message:
1) Store the look up table value in 4300 memory address onwards.
DATA BUS D7 D6 D5 D4 D3 D2 D1 D0
SEGMETS d c b a dp g f e
OBSERVATION:
D7 D6 D5 D4 D3 D2 D1 D0
LOOK UP TABLE:
RESULT:
Thus 8279 controller was interfaced with 8085 and program for rolling display was executed
successfully.
Flowchart for 16 bit multiplication
Start
Is multiplicand=0
No
Yes
Stop the data in HL pair get the
given memory location
Stop
Input data
BC pair-1CD2 H
Stack pointer-01AD H
Output
4A00 - EA H
4A01- 4B H
4A02 - 30 H
4A03 - 00 H
EX.NO:16 16 BIT MULTIPLICATIONS
AIM
To write a program for 16 bit multiplication for the given set of datas
APPARATUS REQUIRED
RESULT
Thus the assembly language program to perform 16 bit multiplication using 8085 microprocessor is
verified for the given 16 bit data.
FLOWCHART:
Ex. N0. 17 SUM OF ELEMENTS IN AN ARRAY
AIM:
ALGORITHM:
1. Load the array in the consecutive memory location and initialize the memory pointer with the
starting address.
2. Load the total number of elements in a separate register as a counter.
4. Load the other register with the value of the memory pointer.
6. Check for carry, if exist, increment the carry register by 1. otherwise, continue
Decrement the counter and if it reaches 0, stop. Otherwise increment the memory pointer by 1
and go to step 4.
PROGRAM:
INPUT OUTPUT
4200 4500
4201
4202
4203 4501
RESULT: