You are on page 1of 2

Niciocontiollei Lab

2011



r e p a r e d 8 y M u h a m m a d S a a d ( m s a a d _ m s n [ h o L m a l l c o m )

age 1
Ub|ect:
1o |nterface LCD (20x2) and |nput from sw|tches
Components:
mlcroconLroller swlLches
orking:
llrsL program Lhe mlcroconLroller connecL wlLh swlLches and wlLh a dlsplay panel When Lhe swlLch 1 pressed Lhen
conLroller glves Lhe command and dlsplay Lhe message on Slmllarly when Lhe second and Lhlrd swlLch pressed
conLroller do Lhe same [ob as done by swlLch one pressed
Diagram:

Coding:
$regflle m8defdaL"
$crysLal 1000000
' conflguraLlon
onflg cd 20 * 2
onflg cdpln pln b4 porLb0 b3 porLb1 b6 porLb2 b7 porLb3
L porL84 8s porL83
'ush SwlLch onflguraLlon
onflg porLd0 lnpuL
onflg porLd1 lnpuL
onflg porLd2 lnpuL
SeL porLd0
SeL porLd1
Niciocontiollei Lab
2011



r e p a r e d 8 y M u h a m m a d S a a d ( m s a a d _ m s n [ h o L m a l l c o m )

age 2
SeL porLd2
' clear and LesL dlsplay
ls
cd 1esL rogram"
'Maln rogram
o
ebounce plnd0 0 Sw1 Swb
ebounce plnd1 0 Sw2 Swb
ebounce plnd2 0 Sw3 Swb
WalLms 100
oop
Lnd
'8uLLon SubrouLlnes
Sw1
ls
cd 1
owerllne
cd 8uLLon1 ressed!"
8eLurns
Sw2
ls
cd 2
owerllne
cd 8uLLon2 ressed!"
8eLurns
Sw3
ls
cd 3
owerllne
cd 8uLLon3 ressed!"
8eLurns

You might also like