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

MANOJ KUM AR A

2129MMCA OOO6

DMC6312 INTERNET OF THINGSLABORATORY

OBJECTIVES

To learn tools relevant to embeddedsystem and loT developmeni.


Towrite simple assembly programs that uses various features of the processor.
To design and develop IoT application Arduino/Raspberry pi for real world scenario

S.No Experiment

Write an embedded C program for the blinking of LED using an


1. 8051 microcontroller.

2. Write a program to generate a 10KHZ square wave using8051

INT1 of8051
3. Write a programn to show the use of INTO &

8051
4. Write a Cprogram to perform 8-bit addition in

5. Write a Cprogram to interface stepper motor.

keypad with 8051


6. Writea Cprogram to interface LCD and
Ex. No: 1 WRITE A EMBEODED PRo GRAM

foR BLIN KIN G OF LED B7 osI MICROC oNIROLLER

AiM:

write an
embedded
pngram blakig of LED

micn Conhller

HARDWARÉ REguiR EMENTS :.

LED

Keil TDE

Microconto ller
int
(udy Dely
Void
OFr LEO 1) Diy LED
()
ON 0) LED
() while
(void) Gin Vojd
main
(undl); Doay
vojd
pin
LED 0)P2A EDLsbit
include #
PRoaRAM:
Mineoneler using
PosI
don ben ha
LED
REsULT:
29
blnk LED
)e100v0)
)+) (jo; for
Ex No: 2 WRIE A PRoGRAM GENERAjE A

10 KHz SgunRE WAVE USING

AIM:

write a

prgram
generate a |0KHz
Sguan wave

go51,

HARDWARE RERUIREMENTS !

* Keil îDE
* 805) Mieroconboller
# incud.
Shit P)^o
pin / deela variable
main c )

l clear pot
J inhalize hmer 0 as
load value
THO Count hmer will

pin 1}
high lagt to Pl.o

stast himr
wait
Duerfl.w

gain Count
THo Oo3c;
pin

while
join
) Conhn ne wih
OuTpuT:

a
vele

26

REsvLs:

wave /okke hos ben


Ex. No'3 WRITE A
PROGRAM FoR
DPERA ONS ARITHMENe
Pos)

AM:

write a

Qrihmehe perahns Pos)

HARDWARE REguREMENTS
LED

Kei îpE

8051 Microeonholler
PRotoRAM

Mov a, #2sh
Mov b, H12k
Add a,b
Mov foh, a nved 4oh rarm mtm loeehsn
Mov a, 25 h

Subb a, b
Mov 4ih, a sub resulk muve d b 4)h ram

Mov a, # 25h
Mul ab
Mov 4eb,
Mov. 4sh, b
Mov a,
Mov b, # 12h

Div ab
Mov 44h,
qusht mvd h 44h mem lo cahin
Mov 45h,k
Nmaindr Men locah'bu.

Mov

Mor

Erd
b 2

() A b 21
() A -b )3

(y
guokent ()
Remindu (1)
() Sne a 26

(vi) DEC 25

REsvL:

Al arihmehe
prchon
hes eYecuted
Microcanbollo
keil
LED
REguREMENTS! HaRDWARE
perkr
PosI hon add e-bit
Pgram
write
a
AiM:
AppIioN P-bit
PERFORM PROGRAM WRnE No:4 Ex.
A
ProGRAN:

ORG

Mov po, # OFFH


inpt
Mov p1, # 0FfH PI

Mov P2, 00M ouput pot


Moy p3, # 0 4 Snikalzs P3 oufout port

Mov
Movo Contt
Mov A, P| Moves Contet

CLR C

Apn
Ad Co nteat

resul

cony

cong priak
L2 Muv P2, Ri
RI Pot

Mov P3, A

END
A 0fF

20

RESVL:

Addiksa hoo ndea heu bern

executd
WRnE A PROGRAM FoR îNIERFAcING

SIEPPER WITH

AIM:

write a

he mobr
skppr
with foa)

HARDWARE

Steppor mobr
Drive Circuit

Keil DDE

&o51 Micro contoller


PRoGRAM:

ORG D000H

UP: Moy p2, # 09H

ACALL DELAY

Moy P2, # o6 H

ACALL DELAY

SJ MP UP

DELAY: MoV RA, #18

R3,
# 255
HI: MoV
R3, H2
H2 : DINZ

R4, HI
DJNZ

RET
RESUIT:
mhr
The stenp
miiroconholler hes ben
fosi

exdate!
WRSE PROGRAM To
Lep AND
KEY PAD îNTERMCE THE
WITH

AIM:

write
he
and
prgram intefare
Posi
Kyped wih Hhe

HARDwARE REgukEMENT
LCD

Kypal
* Keil

Micntonbller
PRobRAM:
# include
Sbit rl PiA 0;
cbit r2 PI^
Sbit Y3 PI

Sbit 4 Pl 3;
sbit
Sbit C2 P si
keyp.d enaehiw
Sbit P3 o;
Sbit P3^I;

sbil en P3 2j
of pot

Void kdemd (unsgnrd chas


Void leddat (unsignd cha);
Void
daley ()

Void main c )

malis
Ledemd (o m3 ):
Delay C);
Deloy ())
Ledemd ow o) ) Curtor blinting

Lodemd (or 0) :
Dely (o;
Ledemd (0n 8)i

Delay C);
while ()

RI 0

Loddat C):
Dolay c):

Leddet C'e);
Delay () i
Deley'C):

1f (cs )
Loddet ('3);
Delay ())
Delay I ())

complla
scanning
RI l} r2 30;

Leddat ('4):
Delay () i
Deley ! C)i

Leddat ('5))
Delay cT:

Leddet C' c);


Deley () :
Deleyl C);

Scamij
Leddat ('*):
Delay (>;
Delay' ();
3

Leddet C'0):
Delag (
Delayl ();

Leddat (#):
Delay C):

Void gned chor vol)


ledemd ( wn signod

P2

Ru 0;
5
Deioy ()

Void ieddar (unugnd char)


P2
Rs | ;

Delay cTi

V.d doly ()
Unsignd int î;

Void Jloy! ()
int ki
Ungnd
for (jo ) j<200; j)
20
For (ko)
REsULTY
he dply kypd
intufeing
mierconholle has bren execubd.

You might also like