You are on page 1of 12

EXPT. NO.

10 MICROCONTROLLER BASED SECURITY SYSTEM


Aim:
Write a assembly language program for security based system using microcontroller 8051.
Apparatus Reuire!:
1. 8051 Microcontroller trainer kit 1 No.
2. Keyboard 1 No.
3. 82! Keyboard and display board 1 No.
T"e#r$:
"#e microcontroller 8051 is an 8$bit mac#ine. %ts memory is organi&ed in bytes and practically
all its instruction deal 'it# byte (uantities. %t uses an accumulator as t#e primary register for instruction
results. )t#er operands can be accessed using one of t#e four different addressing modes a*ailable+
register implicit, direct, indirect or immediate. )perands reside in one of t#e fi*e memory spaces
"#e microcontroller based digital lock is an access control system t#at allo's only aut#ori&ed
persons to access any restricted di*ision. "#e ma-or components include a keypad, ./0, 1123)M
and t#e micro controller 4"8051.4"80/51 '#ic# #as a 2Kbytes of 3)M for t#e program memory. "#e
electronic control assembly allo's t#e system to unlock t#e de*ice 'it# a pass'ord. 4 t'o digit
predefined pass'ord needs to be specified t#e user. 4 563 matri6 K17240 and a 1862 ./0 #a*e been
used #ere to set t#e pass'ord '#ic# is stored in t#e 123)M so t#at 'e can c#ange it at any time.
W#ile unlocking, if t#e entered pass'ord from keypad matc#es 'it# t#e stored pass'ord, t#en t#e lock
opens and a message is displayed. 4lso an output pin is made #ig# to be used for furt#er purpose.
1*ery time, t#e pass'ord is detected and t#e output is displayed. %f all t#e t'o digits matc# 'it# set
pass'ord, t#e display displays 9): and t#e lock output pin goes #ig# and t#e led glo's. %f t#e security
code is 'rong, 91: is sent to be displayed on t#e display and t#e bu&&er rings '#ic# is connected to t#e
microcontroller. %t #as 'ide applications in t#e present 'orld. %t is mainly used for door alarms,
e(uipment pri*acy locks, cell p#ones, and computers and in many lock systems.
"#e pass'ord is stored in t#e 123)M so t#at 'e can c#ange it at any time. "#e system #as a
keypad by '#ic# t#e pass'ord can be entered t#roug# it. W#en t#e entered pass'ord e(uals 'it# t#e
pass'ord stored in t#e memory t#en t#e relay gets on and so t#at t#e door is opened. %f 'e entered a
'rong pass'ord for more t#an four times t#en t#e 4larm is s'itc#ed on.
Pr#%e!ure:
1. 1nter t#e program starting 'it# initial addressing of 8100
2. 1nter t#e code input code'ord and user code 'ord
3. 16ecute t#e program and obser*e t#e output displayed on t#e display.
5. /#ange t#e user code'ord and c#eck t#e output.
Resu&t:
"#us t#e program is e6ecuted and *erified t#e output for different code 'ords.
Ar%"ite%ture #' Mi%r#%#(tr#&&er )0*1:
+&#, C"art : Pi( Dia-ram:
;"43"
M%/3)/)N"3)..13 8051
M
/

8
0
5
1
/
<
1
/
K

/
)
0
1

4
=
4
%
.
4
>
.
%
"
7
0%;2.47 9 ):
0%;2.47 9 1:
YES
NO
Pr#-ram:
8100 mo* 51<,?10 5 51 10 @iAp pass'ordB
8103 mo* 52<,?20 5 52 20 @iAp pass'ordB
8108 mo* 53<,?30 5 53 30 @iAp pass'ordB
810! mo* 55<,?50 5 55 50 @iAp pass'ordB
810/ mo*55<,?88 5 55 88 @pass,#r!B
810C mo* 31,?51 ! 51
8111 mo* 33,?05 > 05
8113 mo*r32,?08 4 08 @countB
8115 mo* 02"3, ?CC/2 !0 CC /2
8118 mo* 4, ?00 5 00
8114 mo*6 D02"3, 4 C0
811> mo* 4,?// 5 // @clear displayB
8110 mo*6 D02"3,4 C0
8111 mo* 4,?!0 5 !0 @'rite displayB
8120 mo*6 D02"3, 4 C0
8121 mo* 4,?CC 5 CC @clear display 34M$blank t#e displayB
8123 mo*02"3,?CC/0 !! CC /0
8128 loop mo* D02"3,4 C0 @loopB
812 0ENF 32,loop C4,CC
812! again mo* 4,D31 1 @read status 'ordB 'ait
8124 /EN1 4, 55<, N1G >5 55 0>
8120 %N/ 31 0!
8121 0ENF 33, again 0> 1!
8130 mo* 02"3,?CC/0 !0 CC /0
8133 mo* 4, ?0/ 5 0/ @c#ar H)IB
8135 mo*6D02"3, 4 C0
8138 loop1 ;EM2 loop1 80 C1
8138 ne( mo* 02"3, ?CC/0 !0 CC /0 + N1G
813> mo* a,?88 5 88 @ c#ar H1IB
8130 mo*6 D02"3, 4 C0
8131 loop2 s-mp loop2 80 C1
E.pt.N#.11 EC/O CANCELLATION USIN0 MATLAB PRO0RAMMIN0
AIM:
"o 'rite a program for ec#o cancellation using M4".4> soft'are.
APPARATUS RE1UIRED:
2ersonal /omputer $ 1No.
M4".4> ;oft'are
T/EORY:
1c#o is t#e repetition of a 'a*eform due to reflection from points '#ere t#e c#aracteristics of
t#e medium t#roug# '#ic# t#e 'a*e propagates c#anges. 1c#o is usefully employed in sonar and
radar for detection and e6ploration purposes. %n telecommunication, ec#o can degrade t#e (uality of
ser*ice, and ec#o cancellation is an important part of communication systems. "#e de*elopment of
ec#o reduction continues today as ne' integrated landline and 'ireless cellular net'orks put additional
re(uirement on t#e performance of ec#o cancellers.
"#ere are t'o types of ec#o in communication systems+ acoustic ec#o and telep#one line
#ybrid ec#o.
4coustic ec#o+
4coustic ec#o due to acoustic coupling bet'een t#e speaker and t#e microp#one in #ands$free
p#ones, mobile p#ones and teleconference systems. . 4coustic ec#o may be reflected from a multitude
of different surfaces, suc# as 'alls, ceilings and floors, and tra*els t#roug# different pat#s.
1lectrical line ec#o+
1lectrical line ec#o due to mismatc# at t#e #ybrid circuit connecting a 2$'ire subscriber line to a
5$'ire truck line in t#e public s'itc#ed telep#one net'ork. "#e perceptual effects of an ec#o depend on
t#e time delay bet'een t#e incident and reflected 'a*es, t#e strengt# of t#e reflected 'a*es, and t#e
number of pat#s t#roug# '#ic# t#e 'a*es are reflected. "elep#one line ec#oes, and acoustic feedback
ec#oes in teleconference and #earing aid systems, are undesirable and annoying and can be
disrupti*e.
.
1c#o can se*erely affect t#e (uality and intelligibility of *oice con*ersation in a telep#one
system. "#e percei*ed effect of an ec#o depends on its amplitude and time delay. %n general, ec#oes
'it# appreciable amplitude and a delay of more t#an 1ms are noticeable. 2ro*ided t#e round$trip
delay is on t#e order of a fe' milliseconds, ec#o gi*es a telep#one call a sense of Hli*elinessI.
<o'e*er, ec#oes become increasingly annoying and ob-ectionable 'it# t#e increasing round$trip
delay and amplitude in particular for delays of more t#an 20 ms. <ence ec#o cancellation is an
important aspect of t#e design of modern telecommunication systems suc# as con*entional 'ire line
telep#ones, #ands$free p#ones, cellular mobile @'irelessB p#ones, or teleconference systems
<ybrid ec#o suppression+

1c#o suppressors 'ere first employed to manage t#e ec#o generated primarily in satellite
circuits. 4n ec#o suppresser @Cig .2B is primarily a s'itc# t#at lets t#e speec# signal t#roug# during t#e
speec#$acti*e periods and attenuates t#e line ec#o during t#e speec#$inacti*e periods. 4 line ec#o
suppresser is controlled by a speec#Aec#o detection de*ice. "#e ec#o detector monitors t#e signal
le*els on t#e incoming and outgoing lines, and decides if t#e signal on a line from, say, speaker > to
speaker 4 is t#e speec# from t#e speaker > to t#e speaker 4, or t#e ec#o of speaker 4. %f t#e ec#o
detector decides t#at t#e signal is an ec#o t#en t#e signal is #ea*ily attenuated. "#ere is a similar ec#o
suppression unit from speaker 4 to speaker >. "#e performance of an ec#o suppresser depends on t#e
accuracy of t#e ec#oAspeec# classification subsystem. 1c#o of speec# often #as a smaller amplitude
le*el t#an t#e speec# signal, but ot#er'ise it #as mainly t#e same spectral c#aracteristics and statistics
as t#ose of t#e speec#. "#erefore t#e only basis for discrimination of speec# from ec#o is t#e signal
le*el. 4s a result, t#e speec#Aec#o classifier may 'rongly classify and let t#roug# #ig#$le*el ec#oes as
speec#, or attenuate lo'$le*el speec# as ec#o.
Cor terrestrial circuits, ec#o suppressers #a*e been 'ell designed, 'it# an acceptable le*el of
false decisions and a good performance. "#e performance of an ec#o suppresser depends on t#e time
delay of t#e ec#o. %n general, ec#o suppressers perform 'ell '#en t#e round$trip delay of t#e ec#o is
less t#an 100 ms. Cor a con*ersation routed *ia a geostationary satellite t#e round$trip delay may be
as muc# as 800ms. ;uc# long delays can c#ange t#e pattern of con*ersation and result in a significant
increase in speec#Aec#o classification errors. W#en t#e delay is long, ec#o suppressers fail to perform
satisfactorily, and t#is results in c#oppy first syllables and artificial *olume ad-ustment. 4 system t#at is
effecti*e 'it# bot# s#ort and long time delays is t#e adapti*e ec#o canceller
4dapti*e 1c#o /ancellation+
"#e first ec#o cancellation systems 'ere e6perimentally implemented across satellite
communication net'orks to demonstrate net'ork performance for long$distance calls. Cigure 3
illustrates t#e operation of an adapti*e line ec#o canceller. "#e speec# signal on t#e line from speaker
4 to speaker > is input to t#e 5A2 'ire #ybrid > and to t#e ec#o canceller. "#e ec#o canceller monitors
t#e signal on line from > to 4 and attempts to model and synt#esis a replica of t#e ec#o of speaker 4.
"#is replica is used to subtract and cancel out t#e ec#o of speaker 4 on t#e line from > to 4. "#e ec#o
canceller is basically an adapti*e linear filter.
"#e coefficients of t#e filter are adapted so t#at t#e energy of t#e signal on t#e line is
minimi&ed. "#e ec#o canceller can be an infinite impulse response @%%3B or a finite impulse response
@C%3B filter. "#e main ad*antage of an %%3 filter is t#at a long$delay ec#o can be synt#esi&ed by a
relati*ely small number of filter coefficients. %n practice, ec#o cancellers are based on C%3 filters. "#is is
mainly due to t#e practical difficulties associated 'it# t#e adaptation and stable operation of adapti*e
%%3 filters.
/on*ergence of .ine 1c#o /anceller+
"#e ec#o canceller s#ould #a*e a fast con*ergence rate, so t#at it can ade(uately track
c#anges in t#e telep#one line and t#e signal c#aracteristics. "#e con*ergence of an ec#o canceller is
affected by t#e follo'ing factors+
1. Non$stationary c#aracteristics of telep#one line and speec#.
2. ;imultaneous con*ersation.
3. "#e adaptation algorit#m.
PROCEDURE:
1. 1nter t#e program in M4".4> edit 'indo'.
2. 16ecute t#e program and obser*e an input and output 'a*eforms
3. )bser*e t#e output for *arious input parameters.
RESULT:
"#us t#e ec#o cancellation program 'as e6ecuted using M4".4> soft'are.
Cig 1+ %llustration of ec#o in a mobile to land line system.
Cig 2+ 1c#o suppression system.
Pr#-ram:
clear allJ
mule K .01J L .arger *alues for fast con*
ma6Mrun K 200J
for runK1+ma6MrunJ
taps K 10J L4dapti*e Cilter "aps ?
fre( K 1000JL;ignal Cre(
' K &eros@1,tapsBJLstate of adapti*e filter
time K .2JLleng#t of simulation @secB
samplerate K 5000JLsamplesAsec
samples K timeNsamplerateJ
ma6Miterations K samples$tapsO1J
iterations K 1+ma6MiterationsJL=ector of iterations
tK1Asamplerate+1Asamplerate+timeJ
rand@PstateP,sum@100NclockBBJL3eset 3andome Qenerator
noiseK.02Nrand@1,samplesBJLnoise added to signal
sK.5Nsin@2NpiNfre(NtBJL2ure ;ignal
6KnoiseOsJLinput to adapti*e filter
ec#oMampMper K .5J L1c#o percent of signal
Lrand@PstateP,sum@100NclockBBJL3eset 3andome Qenerator
ec#oMtimeMdelay K .085J
ec#oMdelayKec#oMtimeMdelayNsamplerateJ
ec#o K ec#oMampMperNR&eros@1,ec#oMdelayB 6@ec#oMdelayO1+samplesBSJ
L.M;
for iK1+ma6MiterationsJ
y@iBK'N6@i+iOtaps$1BPJ
e@run,iBKec#o@iB$y@iBJ
Lmule@iB K .5A@6@i+iOtaps$1BN6@i+iOtaps$1BPO .01BJ
' K ' O 2NmuleNe@run,iBN6@i+iOtaps$1BJ
end
end
LLMean ;(uare 1rror
mseKsum@e.T2,1BAma6MrunJ
bK6Oec#oJ
L)uput of ;ystem
outKb@1+lengt#@yBB$yJ
subplot@3,1,1B,plot@bBJ
title@P;ignal and 1c#oPBJ
ylabel@P4mpPBJ
6label@P"ime secPBJ
subplot@3,1,2B,plot@outBJ
title@P)utput of ;ystemPBJ
ylabel@P4mpPBJ
6label@P"ime secPBJ
subplot@3,1,3B,semilogy@mseBJ
grid
title@P.143N%NQ /U3=1 muK.01 ec#o delayK85ms runsK200PBJ
ylabel@P1stimated M;1, d>PBJ
6label@PNumber of %terationsPBJ
Lsubplot@3,1,2B,semilogy@iterations,e@1,+B.T2BJ
Lgrid
Lsubplot@3,1,3B,semilogy@iterations,e@2,+B.T2BJ
Lgrid

You might also like