Sri Ramakrishna Engineering College (Educational Service: SNR Sons Charitable Trust)

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 65

SRI RAMAKRISHNA ENGINEERING COLLEGE

[Educational Service: SNR Sons Charitable Trust]


[Autonomous Institution, Accredited by NAAC with ‘A’ Grade]
[Approved by AICTE and Permanently Affiliated to Anna University, Chennai]
[ISO 9001:2015 Certified and all eligible programmes Accredited by NBA]
VATTAMALAIPALAYAM, N.G.G.O. COLONY POST, COIMBATORE – 641 022.

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING

Certified that this is the bonafide record of works done by Mr. Ayush Dutta in 16EC256

- MICROCONTROLLER LAB of this Institution for IV Semester during the Academic

Year 2020 - 2021.

Faculty In - Charge

Date: HOD - CSE

REGISTER NUMBER:

1901067

Submitted for the IV Semester B. E. (CSE) Practical Examination held on

during the Academic Year 2020 - 2021.

Internal Examiner Subject Expert


INDEX
SL. NO. DATE EXPERIMENT PAGE NO

1. 17/02/2021 a. Addition of two 8-bit numbers 3


b. Subtraction of two 8-bit numbers
c. Division of two 8-bit numbers
d. Multiplication of two 8-bit numbers

2. 21/02/2021 a. Block data movement in internal memory 11


location
b. Block data movement in external memory
location
c. Exchange of data in internal memory location
d. Exchange of data in external memory location
e. Finding smallest number

3. 28/02/2021 a. Addition of two 16-bit numbers 21


b. Subtraction of two 16-bit numbers
c. Square of an 8-bit number
d. Cube of an 8-bit number

4. 08/03/2021 a. Conversion of ascii to bcd 28


b. Conversion of bcd to ascii
c. Flipping port 1 using 55h and ffh
d. Conversion- hexadecimal to decimal
e. Conversion- decimal to hexadecimal

5. 10/03/2021 a. Sending hex values of ascii characters 38


b. Toggling the bits of p1
c. Sending the temperature range to port p1
d. Toggling d0 bit of port p1
e. Toggling bit p2^4 only
f. Monitoring bit p1^5
g. Getting the status of bit p2^5

6. 17/03/2021 a. Toggling p1 bit continuously with delay 48


b. Toggling bit of p1 with 250 Ms delay
c. Getting byte of data from p1 with ½ sec delay
d. Toggling all the bits of p0 and p2 using sfr
e. Toggling all the bits of p0 and p2 using ex-or
operations

7. 31/03/2021 a. Blinking of led 57


b. Interfacing of ultrasonic sensor
c. Lcd display
8. 14/04/2021 a. Interfacing of stepper motor with 8051 63
3

Ex. No.: 1 (A) Addition of two 8-bit data


Date: 17-2-21

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.

ASSEMBLY LANGUAGE PROGRAM:

OUTPUT:

INPUT OUTPUT

ADDRESS DATA ADDRESS DATA

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

Ex. No.: 1 (B) Subtraction of two 8-bit data


Date: 17-2-21

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.

ASSEMBLY LANGUAGE PROGRAM:

OUTPUT:

INPUT OUTPUT

ADDRESS DATA ADDRESS DATA

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

Ex. No.: 1 (C) Division of two 8-bit data


Date: 17-2-21

AIM:
To write an assembly language program to divide two 8-bit numbers.

ALGORITHM:

Step 1: Move the source address of data to R0 and destination to R1 as values.


Step 2: Move the first data to A and increment the value in R0 to get the second
data and move to B.
Step 3: Divide the data in A by the number in the B register.
Step 4: Move the value in A to the destination address pointed by R1 and
increment R1.
Step 5: Move the result in the register B to the address pointed by the R1.

PROGRAM:
8

OUTPUT:

INPUT OUTPUT

ADDRESS DATA ADDRESS DATA

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

Ex. No.: 1 (D) Multiplication of two 8-bit data


Date: 17-2-21

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

ADDRESS DATA ADDRESS DATA

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:

Step 1: Initialize R0 = 10H, R1 = 20H and R3 = 3H.


Step 2: Move data from location R0 to accumulator.
Step 3: Move data from accumulator to location pointed by R1.
Step 4: Increment R0, R1
Step 5: Execute again from step 2 till R3 becomes zero.

ASSEMBLY LANGUAGE PROGRAM:


12

OUTPUT:

INPUT OUTPUT

ADDRESS DATA ADDRESS DATA

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

Movement of a block of data from one external memory location


Ex. No.: 2 (B) to other.
Date: 21-2-21

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

ASSEMBLY LANGUAGE PROGRAM:

OUTPUT:

INPUT OUTPUT

ADDRESS DATA ADDRESS DATA

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

Ex. No.: 2 (C) Exchange of data in internal memory location


Date: 21-2-21

AIM:
To write an assembly language program to exchange a block of data from one
internal memory location to another.
ALGORITHM:

Step 1: Initialize R0, R1, R3 as 10H, 20H, 2.


Step 2: Move data located at R0 to accumulator and from accumulator to R4,
Step 3: Move data located at R1 to A and from A to location pointed by R0.
Step 4: Move data from R4 to A and from accumulator to location pointed by R1.
Step 5: Increment R0, R1and execute from step 2 till R3 becomes 0.

ASSEMBLY LANGUAGE PROGRAM:


16

OUTPUT:

INPUT OUTPUT

ADDRESS DATA ADDRESS DATA

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

Ex. No.: 2 (D) Exchange of data in external memory location


Date: 21-2-21

AIM:
To write an assembly language program to exchange a block of data from one
external memory location to another.
ALGORITHM:

Step 1: Initialize R1, R2, R3, R0 as 60H,00H,70H,2.


Step 2: Set DPH, DPL as R1, R2 and move data pointed by DPTR to A, from A
to R4.
Step 3: Set DPH as R3 and move data pointed by DPTR to A and Set DPH as
R1 and move data from A to DPTR.
Step 4: Move R4, R3 to A, DPH and data from A to location pointed by DPTR.
Step 5: Execute from step 2 until R0 becomes 0.

ASSEMBLY LANGUAGE PROGRAM:


18

OUTPUT:

INPUT OUTPUT

ADDRESS DATA ADDRESS DATA

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

Ex. No.: 2 (E) Finding smallest number in an array


Date: 21-2-21

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.

ASSEMBLY LANGUAGE PROGRAM:


20

OUTPUT:

INPUT OUTPUT

ADDRESS DATA ADDRESS DATA

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

Ex. No.: 3 (A) Adding two 16-bit Numbers


Date: 28-2-21

AIM:
To write an assembly language program to add two 16-bit Numbers.

ALGORITHM:

Step 1: Initialize A = 20H, R0 = 20H.


Step 2: Add A and R0.
Step 3: Move the value of A to 61H.
Step 4: Set A = 21H, R0 = 21H and add A and R0 with carry.
Step 5: Move the value of A to 60H.

ASSEMBLY LANGUAGE PROGRAM:


22

OUTPUT:

INPUT OUTPUT

ADDRESS DATA ADDRESS DATA

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

Ex. No.: 3 (B) Subtract two 16-bit Numbers


Date: 28-2-21

AIM:
To write an assembly language program subtract two 16-bit numbers.
ALGORITHM:

Step 1: Initialize A = 21H, R0 = 20H.


Step 2: Subtract A and R0.
Step 3: Move the value of A to 61H.
Step 4: Set A = 21H, R0 = 21H and subtract A and R0.
Step 5: Move the value of A to 60H.

ASSEMBLY LANGUAGE PROGRAM:


24

OUTPUT:

INPUT OUTPUT

ADDRESS DATA ADDRESS DATA

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

Ex. No.: 3 (C) Finding square of 8-bit number


Date: 28-2-21

AIM:
To write an assembly language program to find square of 8-bit number.
ALGORITHM:

Step 1: Initialize A = 21H.


Step 2: Move the value of A to B.
Step 3: Multiply A and B and Store the value in A.

ASSEMBLY LANGUAGE PROGRAM:

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

Ex. No.: 3 (D) Finding cube of 8-bit number


Date: 28-2-21

AIM:
To write an assembly language program to find cube of 8-bit number.
ALGORITHM:

Step 1: Initialize R0 = 2H, R1 = 4H.


Step 2: Move the value of R1 to A.
Step 3: Create a loop, move the value of R1 to B.
Step 4: Multiply A and B and Store the value in A.
Step 5: Execute till loop turns false.

ASSEMBLY LANGUAGE PROGRAM:


27

OUTPUT:

INPUT OUTPUT

ADDRESS DATA ADDRESS DATA

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

Ex. No.: 4 (A) ASCII to BCD Conversion


Date: 8-3-21

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.

ASSEMBLY LANGUAGE PROGRAM:

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

Ex. No.: 4 (B) BCD to ASCII Conversion


Date: 8-3-21

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

ASSEMBLY LANGUAGE PROGRAM:

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:

Step 1: Set R0 = #0AH and A = #55H, move the value of a to P0.


Step 2: Perform delay, set the mode and pass the values to the timer 1 and set
the timer run controller.
Step 3: Now set A = #0FFH and move the value of A to P0.
Step 4: Again, perform delay operation.
Step 5: Once the overflow occurs stop the timer and clear TR1 and TF1.

ASSEMBLY LANGUAGE PROGRAM:


33

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

Converting hexadecimal number to decimal


Ex. No.: 4 (D)
Date: 8-3-21

AIM:
To write an assembly language program to convert hexadecimal number to
decimal number.
ALGORITHM:

Step 1: Pass a hexadecimal number to #6000H.


Step 2: Move the value of DPTR to A and set B = #10 and divide A and B.
Step 3: Increment DPTR and exchange A and B. Perform the step 2 and 3,
increment DPTR and exchange A and B
Step 4: Move the value of A to DPTR and exchange A and B.
Step 5: Increment value of DPTR and move the value of A to DPTR.

ASSEMBLY LANGUAGE PROGRAM:


35

OUTPUT:

INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
X:6000H 0E X:6001H 04
X:6001H 01

RESULT:

Thus, the assembly language program to convert hexadecimal number to


decimal number was executed and output is verified successfully.
36

Ex. No.: 4 (E) Converting decimal number to hexadecimal


Date: 8-3-21

AIM:
To write an assembly language program to convert decimal number to
hexadecimal number.
ALGORITHM:

Step 1: Move the data to accumulator and move #0AH to B register.


Step 2: Divide a and b and move B to R1 register.
Step 3: Move #0AH to B and multiply A and B.
Step 4: ADD A with R1.
Step 5: Move A value to specified memory location.

ASSEMBLY LANGUAGE PROGRAM:

OUTPUT:
37

INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
X:6000H 10 X:6001H 0A

RESULT:

Thus, the assembly language program to convert decimal to hexadecimal


number was executed and output is verified successfully.
38

Embedded 8051 C programming

Ex. No.: 5 (A) Sending Hexadecimal values for ASCII Characters


Date: 10-3-21

AIM:
To write a c program to send hexadecimal values for ASCII characters.

ALGORITHM:

Step 1: declare unsigned char num and i.


Step 2: Create a for loop and condition I less or equal to 10.
Step 3: Inside loop, set P0=num[i]

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

Ex. No.: 5 (B) Toggling all bits of P1 continuously


Date: 10-3-21

AIM:
To write a c program to toggle all bits of P1 continuously.

ALGORITHM:

Step 1: Create an empty for loop.


Step 2: Set P1=0x55
Step 3: Set P1=0xAA

C PROGRAM:

OUTPUT:

RESULT:

Thus, the c program to toggle all bits of P1 continuously was executed and the
output is verified successfully.
41

Ex. No.: 5 (C) Sending temperature range +-4 to P1


Date: 10-3-21

AIM:
To write a c program to send temperature range +4, -4 to the port P1.

ALGORITHM:

Step 1: Declare character mynum with values -4 to +4 and unsigned char i.


Step 2: Create a for loop and set condition less than 8.
Step 3: Set P1=mynum[i].

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

Ex. No.: 5 (D) Toggling bit D0 of P1 (P1.0) 50000 times


Date: 10-3-21

AIM:
To write a c program to toggle bit D0 of (P1.0) 50000 times.

ALGORITHM:

Step 1: Declare sbit MYBIT=P1^0.


Step 2: Create a for loop and set condition I less than 50000.
Step 3: Set MYBIT=1 and 0.

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:

Step 1: Declare sbit mybit=P2^4.


Step 2: Create infinite while loop.
Step 3: Set mybit 0 and 1.

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.

Ex. No.: 5 (F) Monitoring bit P1.5


Date: 10-3-21

AIM:
To write a c program to monitor bit P1.5 if high, send 55H to P0 and if not AAH to
P2.

ALGORITHM:

Step 1: Declare sbit mybit=P1^5


Step 2: Initialize mybit=1.
Step 3: If mybit=1, P0=0x55 and set mybit=0. Else P2=0xAA.

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:

Step 1: Declare int a and create an infinite for loop.


Step 2: Set P1=0x55 and create for loop and set condition for 2000
Step 3: Set P1=0xAA and create for loop and set condition for 2000

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

Ex. No.: 6 (B) Toggling bits of P1 ports continuously with 250ms


Date: 17-3-21

AIM:
To write a c program to toggle bits of P1 continuously with 250ms delay.

ALGORITHM:

Step 1: Declare unsigned int and create an empty for loop.


Step 2: Set P1 = 0x55 and P1 = 0xAA.
Step 3: Perform toggle with delay of 250ms.

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:

Step 1: Declare unsigned char z and get data from P1.


Step 2: Delay for 500ms toggle P1.
Step 3: Repeat continuously.

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

Toggling all bits of P0 and P2 continuously with 250ms delay


Ex. No.: 6 (E) using inverting and Ex-OR operators
Date: 17-3-21

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:

Step 1: Set P0 and P2 value 55H.


Step 2: Toggle bits of P0 using inverter operator and P2 using ex-or operator.
Step 3: Set Delay for 250ms using delay function.
Step 4: Toggle bits of P0 using inverter operator and P2 using ex-or operator and
delay 250ms.
Step 5: Repeat from step 2 continuously.

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

Ex. No.: 7 (A) Blinking LED


Date: 31-3-21

AIM:
To create a tinker cad simulation for blinking LED.

ALGORITHM:

Step 1: Select Arduino UNO board.


Step 2: Connect a LED with one end to the ground and another to port 13 with a
suitable resistor.
Step 3: Program by declaring pin mode 13 and output.
Step 4: Create a loop and set pin 13 to high and set delay, and repeat for low.

PROGRAM:

OUTPUT:
58

LED OFF

LED ON

RESULT:

Thus, the tinker cad simulation to make a LED blinking was demonstrated
successfully.
59

Ex. No.: 7 (B) Interfacing


Date: 31-3-21

AIM:
To create a tinker cad simulation to interface with sensors.

ALGORITHM:

Step 1: Select an Arduino UNO board.


Step 2: Connect a light sensor and a LED.
Step 3: Program by declaring pin mode A0 as input.
Step 4: Create an infinite loop and read the sensor’s input and the output is
turning on of LED.

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

Ex. No.: 7 (C) LCD Display


Date: 31-3-21

AIM:
To create a tinker cad simulation with LCD display.

ALGORITHM:

Step 1: Select an Arduino UNO board.


Step 2: Connect a 16*2 LCD display.
Step 3: Program by declaring LCD and its values.
Step 4: Begun the lcd and print the content.
Step 5: Create an infinite loop and set cursor in line 1.

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

Ex. No.: 8 Interfacing of Stepper Motor


Date: 14-4-21

AIM:
To create an interfacing of stepper motor.

ALGORITHM:

Step 1: Using a loop move address #CH to accumulator A, then move


accumulator A to Port P2.
Step 2: After using ACALL delay move address 06 to accumulator A and from
accumulator A to port P2
Step 3: Repeat the step 2 for the address 03 and 09 and Use SJMP to main.
Step 4: Move address 08 to register R3 if DELAY IS USED
Step 5: Move address 0FF to register R2 for UP2 and move address 0FF to
register R1 for UP1.
Step 6: Call here until R1 becomes zero using DJNZ and Use DJNZ for R2 and
UP1, also for R3 and UP2.

PROGRAM:
65

OUTPUT:

RESULT:

Thus, an interfacing of stepper motor was done successfully.

You might also like