Professional Documents
Culture Documents
Sri Ramakrishna Engineering College (Educational Service: SNR Sons Charitable Trust)
Sri Ramakrishna Engineering College (Educational Service: SNR Sons Charitable Trust)
Sri Ramakrishna Engineering College (Educational Service: SNR Sons Charitable Trust)
Certified that this is the bonafide record of works done by Mr. Ayush Dutta in 16EC256
Faculty In - Charge
REGISTER NUMBER:
1901067
AIM:
To write an assembly language program to add two 8-bit numbers.
ALGORITHM:
Step 1: Move the source address of the numbers to the register R0 as value.
Step 2: Move the destination address to the register R1 as any value.
Step 3: Move the first data to A and increment value in R0 to get the second data
Step 4: Add the data in A to the data pointed by R0 and store result in A.
Step 5: Move the result in A to the destination address pointed by R1.
OUTPUT:
INPUT OUTPUT
20H 40
30H 50
21H 10
4
RESULT:
Thus, the assembly language program to add two 8-bit numbers is executed and
the output is verified successfully.
5
AIM:
To write an assembly language program to subtract two 8-bit numbers.
ALGORITHM:
Step 1: Move the source address of the numbers to the register R0 as value.
Step 2: Move the destination address to the register R1 as any value.
Step 3: Move the first data to A and increment value in R0 to get the second data
Step 4: Subtract the data in A to the data pointed by R0 and store result in A.
Step 5: Move the result in A to the destination address pointed by R1.
OUTPUT:
INPUT OUTPUT
20H 40
30H 30
21H 10
6
RESULT:
Thus, the assembly language program to subtract two 8-bit numbers is executed
and the output is verified successfully.
7
AIM:
To write an assembly language program to divide two 8-bit numbers.
ALGORITHM:
PROGRAM:
8
OUTPUT:
INPUT OUTPUT
20H 21 30H 02
21H 10 31H 01
RESULT:
Thus, the assembly language program to divide two 8-bit numbers is executed
and the output is verified successfully.
9
AIM:
To write an assembly language program to multiply two 8-bit numbers.
ALGORITHM:
Step 1: Move the source address of the numbers to R0 and destination address
to R1 as values.
Step 2: Move the first number to A and increment the value in R0 to get the
second number and move it to B register.
Step 3: Multiply the number in A by the number in the register B.
Step 4: Move value in B to destination address pointed by R1 and increment R1.
Step 5: Move the result in A to the address pointed by the register R1.
PROGRAM:
10
OUTPUT:
INPUT OUTPUT
20H 10 30H 02
21H 20 31H 00
RESULT:
Thus, the assembly language program to multiply two 8-bit numbers is executed
and the output is verified successfully.
11
Ex. No.: 2 (A) Movement of a block of data from one internal memory location
Date: 21-2-21 to other.
AIM:
To write an assembly language program to move a block of data from one
internal memory location to another.
ALGORITHM:
OUTPUT:
INPUT OUTPUT
10H 10 20H 10
11H 20 21H 20
12H 30 22H 30
RESULT:
Thus, the assembly language program to move a block of data from one internal
memory location to another was executed and the output is verified successfully.
13
AIM:
To write an assembly language program to move a block of data from one
external memory location to another.
ALGORITHM:
Step 1: Initialize R1, R2, R3, R0 as 60H, 00H, 70H and 5H.
Step 2: Move the contents of R1, R2 to DPH, DPL.
Step 3: Move the data pointed by DPTR to accumulator.
Step 4: Move the contents of R3 to DPH and contents of accumulator to DPTR.
Step 5: Increment R2 and execute from step 2 till R0 becomes zero
OUTPUT:
INPUT OUTPUT
6000H 99 7000H 99
6001H 98 7001H 98
6002H 97 7002H 97
6003H 96 7003H 96
6004H 95 7004H 95
14
RESULT:
Thus, the assembly language program to move a block of data from one external
memory location to another was executed and the output is verified successfully.
15
AIM:
To write an assembly language program to exchange a block of data from one
internal memory location to another.
ALGORITHM:
OUTPUT:
INPUT OUTPUT
10H 11 10H 33
11H 22 11H 44
20H 33 20H 11
21H 44 21H 22
RESULT:
Thus, the assembly language program to exchange a block of data from one
internal memory location to another was executed and the output is verified
successfully.
17
AIM:
To write an assembly language program to exchange a block of data from one
external memory location to another.
ALGORITHM:
OUTPUT:
INPUT OUTPUT
6000H 25 6000H 30
6001H 50 6001H 60
7000H 30 7000H 25
7001H 60 7001H 50
RESULT:
Thus, the assembly language program to exchange a block of data from one
external memory location to another was executed and output is verified successfully.
19
AIM:
To write an assembly language program to find the smallest number in an array.
ALGORITHM:
Step 1: Move 89H, 95H to R0, R3 and R0, R1 to DPH, DPL and set counter to 4.
Step 2: Move values in A to DPTR and A to B.
Step 3: Increment DPL values and move to A, If A and B not equal, jump to next
else skip.
Step 4: If carry is not set, jump to skip else move value in A to B and decrement
R2, if not zero jump to again else move the value in B to A
Step 5: Set the DPH to the destination address in R3, DPL to zero and move the
value pointed by DPTR to A.
OUTPUT:
INPUT OUTPUT
8600H 02
8601H 03
8602H 30 9500H 02
8603H 50
8604H 11
RESULT:
Thus, the assembly language program to find smallest number in an array was
executed and output is verified successfully.
21
AIM:
To write an assembly language program to add two 16-bit Numbers.
ALGORITHM:
OUTPUT:
INPUT OUTPUT
A 50H
R0 50H 10H A2
A 51H 11H A0
R0 51H
RESULT:
Thus, the assembly language program to add two 16-bit numbers was executed
and the output is verified successfully.
23
AIM:
To write an assembly language program subtract two 16-bit numbers.
ALGORITHM:
OUTPUT:
INPUT OUTPUT
A 21H
R0 20H 60H 01
A 21H 61H 01
R0 20H
RESULT:
Thus, the assembly language program to subtract two 16-bit numbers was
executed and the output is verified successfully.
25
AIM:
To write an assembly language program to find square of 8-bit number.
ALGORITHM:
OUTPUT:
INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
A 21H A 41H
A 21H
RESULT:
Thus, the assembly language program to find square of 8-bit number was
executed and the output is verified successfully.
26
AIM:
To write an assembly language program to find cube of 8-bit number.
ALGORITHM:
OUTPUT:
INPUT OUTPUT
R0 2H A 40
R1 4H
RESULT:
Thus, the assembly language program to find cube of 8-bit number was executed
and output is verified successfully.
28
AIM:
To write an assembly language program to convert ASCII to BDC.
ALGORITHM:
Step 1: Load address into DPTR and move the data from memory location.
Step 2: AND A with 0FH and move data from A to B.
Step 3: Increment DPTR and move content of the location address to A.
Step 4: Add A with 0FH and swap A and OR A with B.
Step 5: Increment DPTR and move the data from A to memory location.
OUTPUT:
INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
X:6000H 12 X:6003H 32
X:6001H 23
29
RESULT:
Thus, the assembly language program to convert ASCII to BDC was executed
and the output is verified successfully.
30
AIM:
To write an assembly language program convert BCD to ASCII.
ALGORITHM:
Step 1: Load address into DPTR and move the data from the memory location.
Step 2: Move the data from A to R0, AND A with 0FH and OR A with 30H.
Step 3: Increment DPTR and move content of the location address to A.
Step 4: Move the data from A to R0, Add A with 0F0H and swap A.
Step 5: OR A with 30H and increment DPTR and move the data from A to
memory location
OUTPUT:
INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
X:6000H 15 X:6001H 35
X:6002H 31
31
RESULT:
Thus, the assembly language program to convert BCD to ASCII was executed
and the output is verified successfully.
32
Ex. No.: 4 (C) Flipping port 1 using 55H and FFH and generating delay using
timer0
Date: 8-3-21
AIM:
To write an assembly language program to flip port 1 using 55H and FFH and
generating delay using timer0.
ALGORITHM:
OUTPUT:
INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
P0 0xFF P0 0XFF
Pins 0x0A Pins 0X55
RESULT:
Thus, the assembly language program to flip port 1 using 55H and FFH and
generating delay using timer0 was executed and the output is verified successfully.
34
AIM:
To write an assembly language program to convert hexadecimal number to
decimal number.
ALGORITHM:
OUTPUT:
INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
X:6000H 0E X:6001H 04
X:6001H 01
RESULT:
AIM:
To write an assembly language program to convert decimal number to
hexadecimal number.
ALGORITHM:
OUTPUT:
37
INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
X:6000H 10 X:6001H 0A
RESULT:
AIM:
To write a c program to send hexadecimal values for ASCII characters.
ALGORITHM:
C PROGRAM:
OUTPUT:
39
RESULT:
Thus, the c program to send hexadecimal values for ASCII characters was
executed and the output is verified successfully.
40
AIM:
To write a c program to toggle all bits of P1 continuously.
ALGORITHM:
C PROGRAM:
OUTPUT:
RESULT:
Thus, the c program to toggle all bits of P1 continuously was executed and the
output is verified successfully.
41
AIM:
To write a c program to send temperature range +4, -4 to the port P1.
ALGORITHM:
C PROGRAM:
OUTPUT:
42
RESULT:
Thus, the c program to send temperature range +4, -4 to the port P1 was
executed and the output is verified successfully.
43
AIM:
To write a c program to toggle bit D0 of (P1.0) 50000 times.
ALGORITHM:
C PROGRAM:
OUTPUT:
RESULT:
Thus, the c program toggle bit D0 of (P1.0) 50000 times was executed and the
output is verified successfully.
44
Ex. No.: 5 (E) Toggling bit P2.4 continuously without disturbing other bits
Date: 10-3-21
AIM:
To write a c program to toggle bit P2.4 continuously without disturbing rest of the
bits of P2.
ALGORITHM:
C PROGRAM:
OUTPUT:
RESULT:
45
Thus, the c program to toggle bit P2.4 continuously without disturbing rest of the
bits of P2 was executed and the output is verified successfully.
AIM:
To write a c program to monitor bit P1.5 if high, send 55H to P0 and if not AAH to
P2.
ALGORITHM:
C PROGRAM:
46
OUTPUT:
RESULT:
Thus, the c program to monitor bit P1.5 if high, send 55H to P0 and if not AAH to
P2 was executed and the output is verified successfully.
47
Ex. No.: 5 (G) Getting status of bit P1.2, saving and sending to bit P2.5
Date: 10-3-21 continuously
AIM:
To write a c program to status of bit P1.2 and save it, and sending it bit P2.5
continuously.
ALGORITHM:
Step 1: Declare sbits inbit, outbit as P1^2 and P2^5 and bit mbit.
Step 2: Create infinite while loop.
Step 3: Set mbit=inbit and outbit=mbit.
C PROGRAM:
OUTPUT:
RESULT:
Thus, the c program to toggle all bits of P1 continuously was executed and the
output is verified successfully.
48
Ex. No.: 6 (A) Toggling bits of P1 continuously with some time delay
Date: 17-3-21
AIM:
To write a c program to toggle bits of P1 continuously with some time delay.
ALGORITHM:
C PROGRAM:
OUTPUT:
RESULT:
Thus, the c program to toggle bits of P1 continuously with some time delay was
executed and the output is verified successfully.
49
AIM:
To write a c program to toggle bits of P1 continuously with 250ms delay.
ALGORITHM:
C PROGRAM:
50
OUTPUT:
RESULT:
Thus, the c program to toggle bits of P1 continuously with 250ms delay was
executed and the output is verified successfully.
51
Ex. No.: 6 (C) Getting a byte data from P1, wait and sending to P2
Date: 17-3-21
AIM:
To write a c program to get a byte of data from P1, wait for a half second and
send it to P2.
ALGORITHM:
C PROGRAM:
52
OUTPUT:
RESULT:
Thus, the c program to get a byte of data from P1, wait for a half second and
send it to P2 was executed and the output is verified successfully.
53
Ex. No.: 6 (D) Toggling all bits of P0 and P2 continuously with 250ms delay
Date: 17-3-21 using sfr keyword
AIM:
To write a c program to toggle all bits of P0 and P2continuously with 250ms
delay and by using sfr keyword.
ALGORITHM:
Step 1: Using SFR assign port address P0 and P2 and set P0 and P2 value 55H.
Step 2: Set Delay for 250ms using delay function.
Step 3: Set P0 and P2 value AAH.
Step 4: Repeat steps continuously.
C PROGRAM:
54
OUTPUT:
RESULT: Thus, the c program toggles all bits of P0 and P2continuously with 250ms delay and
by using sfr keyword was executed and the output is verified successfully.
55
AIM:
To write a c program to toggle all bits of P0 and P2continuously with 250ms
delay and by using inverting and ex-or operators.
ALGORITHM:
C PROGRAM:
56
OUTPUT:
RESULT:
Thus, the c program to toggle all bits of P0 and P2continuously with 250ms delay
and by using inverting and ex-or operators was executed and the output is verified
successfully.
57
AIM:
To create a tinker cad simulation for blinking LED.
ALGORITHM:
PROGRAM:
OUTPUT:
58
LED OFF
LED ON
RESULT:
Thus, the tinker cad simulation to make a LED blinking was demonstrated
successfully.
59
AIM:
To create a tinker cad simulation to interface with sensors.
ALGORITHM:
PROGRAM:
OUTPUT:
60
LED off at no
light in the input
LED On at light in
the input
RESULT:
Thus, the tinker cad simulation to interface with sensors was demonstrated
successfully.
61
AIM:
To create a tinker cad simulation with LCD display.
ALGORITHM:
PROGRAM:
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup()
{
lcd.begin(16, 2);
lcd.print("AyusH");
}
void loop()
{
}
62
OUTPUT:-
63
RESULT:Thus, the tinker cad simulation with LCD display was demonstrated successfully.
64
AIM:
To create an interfacing of stepper motor.
ALGORITHM:
PROGRAM:
65
OUTPUT:
RESULT: