Praktikum Mikrokontroller Dan Interface
Praktikum Mikrokontroller Dan Interface
PERCOBAAN 2
PERCOBAAN 2
LCD DAN KEYPAD
LCD DAN KEYPAD
I.
Tuuan!
I.
Tuuan!
••
Mahasiswa mengerti cara membuat program C pada mikrokontroller ARM untuk
Mahasiswa mengerti cara membuat program C pada mikrokontroller ARM untuk
melakukan pemrograman pada modul LCD
melakukan pemrograman pada modul LCD
••
Mahasiswa mengerti cara membuat program C pada mikrokontroller ARM untuk
Mahasiswa mengerti cara membuat program C pada mikrokontroller ARM untuk
melakukan pemrograman pada modul keypad
melakukan pemrograman pada modul keypad
••
Mahasiswa
Mahasiswa mampu m
mampu mengintegrasikan antara
engintegrasikan antara keypad dan
keypad dan LCD pada
LCD pada mikrokontroller
mikrokontroller
ARM
ARM
II.
II. Peralatan
Peralatan "an#
"an# $i#unakan!
$i#unakan!
••
Modul
Modul ARM
ARM
••
Modul
Modul LCD
LCD
••
Modul
Modul Keypad
Keypad
••
Software
Software STM!
STM! Cube
Cube M"
M"
••
Software
Software Keil
Keil u#ision
u#ision
III. Da%ar Teori
III. Da%ar Teori
$ambar %& LCD character 'tampak (isual)
$ambar %& LCD character 'tampak (isual)
$ambar !& *iring Diagram LCD Karakter !+"!
$ambar !& *iring Diagram LCD Karakter !+"!
Tabel&%& ,in -ut LCD character
Pin%
De%cri&tion
%
$round
!
#cc
Contrast #oltage
.
/R0S/ 12nstruction0Register Select
3
/R0*/ 1Read0*rite LCD Registers
4
/5/ Clock
6 7 %.
Data 20- ,ins 'D+&&D6)
%3
Anoda '8) backlight
%4
Katoda '7) backlight
$ambar & Rangkaian pengatur kontras tampilan LCD
Tabel&!& Daftar 2nstruksi LCD Character
R'( R') D* D+ D, D- D D2 D/ D0
In%truction'De%cri&tion
-
,
/- / /2 // /0
1
* Pin%
+
+
+
+
+
+
+
+
+
% Clear
Display
+
+
+
+
+
+
+
+
%
9 Return Cursor and LCD to :ome ,osition
+
+
+
+
+
+
+
% 2D S Set Cursor Mo(e Direction
+
+
+
+
+
+
%
D C ; 5nable Display0Cursor
+
+
+
+
+
% SC RL 9
9 Mo(e Cursor0Shift Display
+
+
+
+
% DL <
=
9
9 Set 2nterface Length
+
+
+
%
A A
A A A A Mo(e Cursor into C$RAM
+
+
%
A A A
A A A A Mo(e Cursor to Display
+
%
;= 9
9
9
9
9
9
9 ,oll the /;usy =lag/
%
+
D D D D
D D D D
*rite a Character to the Display at the Current
Cursor ,osition
%
%
D D D D
D D D D
Read the Character on the Display at the Current
The bit descriptions for the different commands are>
"*" - Not Used/Ignored. This bit can be either "1" or "0" Set Cursor Move Direction
ID - Incre!ent the Cursor #ter $ach %&te 'ritten to Dis()a& i# Set S - Shi#t Dis()a& hen %&te 'ritten to Dis()a&
$nab)e Dis()a&/Cursor
D - Turn Dis()a& +n,1/+##,0 C - Turn Cursor +n,1/+##,0 % - Cursor %)in +n,1/+##,0 Move Cursor/Shi#t Dis()a&
SC - Dis()a& Shi#t +n,1/+##,0
- Direction o# Shi#t ight,1/e#t,0 Set Inter#ace ength
D - Set Data Inter#ace ength ,1/2,0 N - Nu!ber o# Dis()a& ines 1,0/3,1 4 - Character 4ont 5610,1/567,0 8o)) the "%us& 4)ag"
%4 - This bit is set hi)e the CD is (rocessing Move Cursor to C9M/Dis()a&
- ddress
ead/'rite SCII to the Dis()a& D - Data
,roses inisialisasi pemrograman LCD dalam mode . four bit>
%& *ait more than %3 msecs after power is applied&
!& *rite +"+ to LCD and wait 3 msecs for the instruction to complete
& *rite +"+ to LCD and wait %4+ usecs for instruction to complete
.& *rite +"+ A$A2< to LCD and wait %4+ usecs 'or poll the ;usy =lag)
3& Set the -perating Characteristics of the LCD
o
*rite +"+! to the LCD to 5nable =our ;it Mode
All follo3in# in%truction'Data )rite% re4uire t3o ni55le 3rite%.
o
*rite /Set 2nterface Length/
o
*rite +"+%0+"++ to turn off the Display
o*rite +"++0+"+% to Clear the Display
o
*rite /Set Cursor Mo(e Direction/ Setting Cursor ;eha(iour ;its
o*rite /5nable Display0Cursor/ ? enable Display and -ptional Cursor
$ambar .& Daftar Kode Karakter yang bisa ditampilkan di LCD karakter
=ungsi7fungsi yang sudah disediakan dalam pustaka 'library) file LCD&:>
•
1lcd1ready')
memeriksa kesiapan LCD untuk melakukan perintah selan@utnya
'memeriksa status busy flag)
•
1lcd1write1data'unsigned char data)
beri perintah ke LCD
•
lcd1write1byte'unsigned char addr unsigned char data)
write a byte to the LCD
character generator or display RAM
•
unsigned char lcd1read1byte'unsigned char addr)
read a byte from the
LCD
character generator or display RAM
•
lcd1goto"y'unsigned char " unsigned char y)
set the LCD display
position "B+&& yB+&&
•
lcd1clear')
clear the LCD
•
lcd1putchar'char c)
write the string str located in SRAM to the LCD
•lcd1puts'char 9str)
write the string str located in SRAM to the LCD
•
lcd1putsf'char flash 9str)
write the string str located in =LAS: to the LCD
I6.
Al#orit7ma Pemro#raman
%& ,ercobaan %
Tampilkan tulisan ET5ST LCDF dengan cara masing masing huruf keluar
secara bergantian dari T kemudian 5 kemudian S sampai huruf yang terakhir
yaitu D dengan delay waktu % detik untuk pemunculan tiap hurufnya&
!& ,ercobaan !
Tampilkan huruf dan angka yang ditekan pada keypad .". pada LCD
dengan cara saat keypad ditekan maka huruf atau angka tersebut akan tampil
pada LCD dan saat dilepas keypadnya maka tidak akan tampil lagi&
& ,ercobaan
•
Gika keypad % ditekan maka relay % akan aktif
•Gika keypad ! ditekan maka relay ! akan aktif
•Gika keypad ditekan maka relay akan aktif
•Gika keypad . ditekan maka relay . akan aktif
•Gika keypad 3 ditekan maka relay 3 akan aktif
•Gika keypad 4 ditekan maka relay 4 akan aktif
•Gika keypad 6 ditekan maka relay 6 akan aktif
•Gika keypad H ditekan maka relay H akan aktif
•
Gika keypad A ditekan maka relay %!. akan aktif
•Gika keypad ; ditekan maka relay 346H akan aktif
•Gika keypad C ditekan maka semua relay akan aktif
•
Gika keypad 9 ditekan maka akan meng7lock perintah terakhir dan tidak
merespon perintah keypad lainnya
•
Gika keypad I ditekan maka akan meng7unlock dan keypad
akan merespon kembali perintah yang diberikan
•
Gika keypad 9 dan I ditekan bersamaan maka relay akan menyala sacara
bergantian dari relay % sampai relay H dengan delay waktu % detik setiap
pergantiannya
6.
Pro#ram
Perco5aan /
:inc)ude "st!;3#266<ha).h" :inc)ude ")cd<character.h" :inc)ude "stdio.h" void S&ste!C)oc<Con#ig,void= static void M><98I+<Init,void= int !ain,void ? @<Init,= S&ste!C)oc<Con#ig,= M><98I+<Init,= )cd<init,= )cd<goto6&,0A0= )cd<(uts,"T"= @<De)a&,1000= )cd<goto6&,1A0= )cd<(uts,"$"= @<De)a&,1000= )cd<goto6&,3A0= )cd<(uts,"S"= @<De)a&,1000= )cd<goto6&,;A0= )cd<(uts,"T"= @<De)a&,1000= )cd<goto6&,5A0= )cd<(uts,""= @<De)a&,1000= )cd<goto6&,BA0= )cd<(uts,"C"= @<De)a&,1000= )cd<goto6&,7A0= )cd<(uts,"D"= @<De)a&,1000= hi)e ,1 ? void S&ste!C)oc<Con#ig,void ? CC<+scInitT&(eDe# CC<+scInitStruct= CC<C)InitT&(eDe# CC<C)InitStruct= 8'<C<$N%$,= @<8'<E+T9$SCIN9<C+N4I9,8'<$9UT+<E+T9$<SC$1= CC<+scInitStruct.+sci))atorT&(e F CC<+SCIT+TG8$<@S$= CC<+scInitStruct.@S$State F CC<@S$<+N= CC<+scInitStruct.8.8State F CC<8<+N= CC<+scInitStruct.8.8Source F CC<8S+UC$<@S$= CC<+scInitStruct.8.8M F = CC<+scInitStruct.8.8N F ;;B= CC<+scInitStruct.8.88 F CC<88<DIE3=CC<+scInitStruct.8.8H F 2= @<CC<+scCon#ig,CC<+scInitStruct= CC<C)InitStruct.C)ocT&(e F CC<C+CTG8$<SGSCJCC<C+CTG8$<8C1 JCC<C+CTG8$<8C3= CC<C)InitStruct.SGSCSource F CC<SGSCS+UC$<8C= CC<C)InitStruct.@%CDivider F CC<SGSC<DIE1= CC<C)InitStruct.8%1CDivider F CC<@C<DIE2= CC<C)InitStruct.8%3CDivider F CC<@C<DIE3= @<CC<C)ocCon#ig,CC<C)InitStructA 4S@<T$NCG<5= @<SGSTIC<Con#ig,@<CC<9et@C4reK,/1000= @<SGSTIC<CSourceCon#ig,SGSTIC<CS+UC$<@C= @<NEIC<Set8riorit&,S&sTic<IHnA 0A 0= void M><98I+<Init,void ? 98I+<InitT&(eDe# 98I+<InitStruct= /* 98I+ 8orts C)oc $nab)e */ 98I+@<C<$N%$,=
98I+D<C<$N%$,=
/*Con#igure 98I+ (ins 8D0 8D1 8D3 8D; 8D2 8D5 8DB 8D7 */ 98I+<InitStruct.8in F 98I+<8IN<0J98I+<8IN<1J98I+<8IN<3J98I+<8IN<; J98I+<8IN<2J98I+<8IN<5J98I+<8IN<BJ98I+<8IN<7= 98I+<InitStruct.Mode F 98I+<M+D$<+UT8UT<88= 98I+<InitStruct.8u)) F 98I+<N+8U= 98I+<InitStruct.S(eed F 98I+<S8$$D<@I9@= @<98I+<Init,98I+DA 98I+<InitStruct= :i#de# US$<4U<SS$T
void assert<#ai)ed,uint<t* #i)eA uint;3<t )ine ? :endi#
Perco5aan 2
:inc)ude "st!;3#266<ha).h" :inc)ude ")cd<character.h" :inc)ude "stdio.h" :inc)ude "e&(ad<262.h" void S&ste!C)oc<Con#ig,void= static void M><98I+<Init,void= char si!(anL1000= int !ain,void ? @<Init,= S&ste!C)oc<Con#ig,= M><98I+<Init,= )cd<init,= e&(ad<init,=hi)e ,1 ? s(rint#,si!(anA"e& !eansFc"Ae&(ad<get<e&<va)ue,= )cd<goto6&,0A0= )cd<(uts,si!(an= void S&ste!C)oc<Con#ig,void ? CC<+scInitT&(eDe# CC<+scInitStruct= CC<C)InitT&(eDe# CC<C)InitStruct= 8'<C<$N%$,= @<8'<E+T9$SCIN9<C+N4I9,8'<$9UT+<E+T9$<SC$1= CC<+scInitStruct.+sci))atorT&(e F CC<+SCIT+TG8$<@S$= CC<+scInitStruct.@S$State F CC<@S$<+N= CC<+scInitStruct.8.8State F CC<8<+N= CC<+scInitStruct.8.8Source F CC<8S+UC$<@S$= CC<+scInitStruct.8.8M F = CC<+scInitStruct.8.8N F ;;B= CC<+scInitStruct.8.88 F CC<88<DIE3= CC<+scInitStruct.8.8H F 2= @<CC<+scCon#ig,CC<+scInitStruct= CC<C)InitStruct.C)ocT&(e F CC<C+CTG8$<SGSCJCC<C+CTG8$<8C1 JCC<C+CTG8$<8C3= CC<C)InitStruct.SGSCSource F CC<SGSCS+UC$<8C= CC<C)InitStruct.@%CDivider F CC<SGSC<DIE1= CC<C)InitStruct.8%1CDivider F CC<@C<DIE2= CC<C)InitStruct.8%3CDivider F CC<@C<DIE3= @<CC<C)ocCon#ig,CC<C)InitStructA 4S@<T$NCG<5= @<SGSTIC<Con#ig,@<CC<9et@C4reK,/1000= @<SGSTIC<CSourceCon#ig,SGSTIC<CS+UC$<@C= /* S&sTic<IHn interru(t con#iguration */
@<NEIC<Set8riorit&,S&sTic<IHnA 0A 0=
void M><98I+<Init,void ?
98I+<InitT&(eDe# 98I+<InitStruct= /* 98I+ 8orts C)oc $nab)e */ 98I+@<C<$N%$,=
98I+D<C<$N%$,= 98I+$<C<$N%$,=
/*Con#igure 98I+ (ins 8D0 8D1 8D3 8D; 8D2 8D5 8DB 8D7 */ 98I+<InitStruct.8in F 98I+<8IN<0J98I+<8IN<1J98I+<8IN<3J98I+<8IN<; J98I+<8IN<2J98I+<8IN<5J98I+<8IN<BJ98I+<8IN<7= 98I+<InitStruct.Mode F 98I+<M+D$<+UT8UT<88= 98I+<InitStruct.8u)) F 98I+<N+8U= 98I+<InitStruct.S(eed F 98I+<S8$$D<@I9@= @<98I+<Init,98I+DA 98I+<InitStruct=
/*Con#igure 98I+ (ins 8$13 8$1; 8$12 8$15 */
98I+<InitStruct.8in F 98I+<8IN<13J98I+<8IN<1;J98I+<8IN<12J98I+<8IN<15= 98I+<InitStruct.Mode F 98I+<M+D$<+UT8UT<88=
98I+<InitStruct.8u)) F 98I+<N+8U=
@<98I+<Init,98I+$A 98I+<InitStruct=
/*Con#igure 98I+ (ins 8$ 8$O 8$10 8$11 */
98I+<InitStruct.8in F 98I+<8IN<J98I+<8IN<OJ98I+<8IN<10J98I+<8IN<11= 98I+<InitStruct.Mode F 98I+<M+D$<IN8UT= 98I+<InitStruct.8u)) F 98I+<8UD+'N= @<98I+<Init,98I+$A 98I+<InitStruct= :i#de# US$<4U<SS$T
void assert<#ai)ed,uint<t* #i)eA uint;3<t )ine ? :endi#
Perco5aan
:inc)ude "st!;3#266<ha).h" :inc)ude ")cd<character.h" :inc)ude "stdio.h" :inc)ude "e&(ad<262.h" void S&ste!C)oc<Con#ig,void= static void M><98I+<Init,void= char si!(anL1000= char e&= int ubahF1= int !ain,void ? @<Init,= S&ste!C)oc<Con#ig,= M><98I+<Init,= )cd<init,= e&(ad<init,= hi)e ,1 ? e&Fe&(ad<get<e&<va)ue,= s(rint#,si!(anA"e& !eansFc"Ae&(ad<get<e&<va)ue,= )cd<goto6&,0A0= )cd<(uts,si!(an= i#,e&(ad<get<e&<va)ue,FFP.P ubahF0=e)se i#,e&(ad<get<e&<va)ue,FFP:P ubahF1= i#,ubah ? i#,e&FFP1P ? @<98I+<'rite8in,98I+$A98I+<8IN<0A1= @<98I+<'rite8in,98I+$A98I+<8IN<1J98I+<8IN<3J98I+<8IN<; J98I+<8IN<2J98I+<8IN<5J98I+<8IN<BJ98I+<8IN<7A0= e)se i#,e&FFP3P ? @<98I+<'rite8in,98I+$A98I+<8IN<1A1= @<98I+<'rite8in,98I+$A98I+<8IN<0J98I+<8IN<3J98I+<8IN<; 98I+<8IN<2J98I+<8IN<5J98I+<8IN<BJ98I+<8IN<7A0= e)se i#,e&FFP;P ? @<98I+<'rite8in,98I+$A98I+<8IN<3A1= @<98I+<'rite8in,98I+$A98I+<8IN<0J98I+<8IN<1J98I+<8IN<; J98I+<8IN<2J98I+<8IN<5J98I+<8IN<BJ98I+<8IN<7A0=
e)se i#,e&FFP2P ? @<98I+<'rite8in,98I+$A98I+<8IN<;A1= @<98I+<'rite8in,98I+$A98I+<8IN<0J98I+<8IN<1J98I+<8IN<3 J98I+<8IN<2J98I+<8IN<5J98I+<8IN<BJ98I+<8IN<7A0= e)se i#,e&FFP5P ? @<98I+<'rite8in,98I+$A98I+<8IN<2A1= @<98I+<'rite8in,98I+$A98I+<8IN<0J98I+<8IN<1J98I+<8IN<3 J98I+<8IN<;J98I+<8IN<5J98I+<8IN<BJ98I+<8IN<7A0= e)se i#,e&FFPBP ? @<98I+<'rite8in,98I+$A98I+<8IN<5A1= @<98I+<'rite8in,98I+$A98I+<8IN<0J98I+<8IN<1J98I+<8IN<3 J98I+<8IN<;J98I+<8IN<2J98I+<8IN<BJ98I+<8IN<7A0= e)se i#,e&FFP7P ? @<98I+<'rite8in,98I+$A98I+<8IN<BA1= @<98I+<'rite8in,98I+$A98I+<8IN<0J98I+<8IN<1J98I+<8IN<3 J98I+<8IN<;J98I+<8IN<2J98I+<8IN<5J98I+<8IN<7A0= e)se i#,e&FFPP ? @<98I+<'rite8in,98I+$A98I+<8IN<7A1= @<98I+<'rite8in,98I+$A98I+<8IN<0J98I+<8IN<1J98I+<8IN<3 J98I+<8IN<;J98I+<8IN<2J98I+<8IN<5J98I+<8IN<BA0= e)se i#,e&FFPP ? @<98I+<'rite8in,98I+$A98I+<8IN<0J98I+<8IN<1J98I+<8IN<3 J98I+<8IN<;A1= @<98I+<'rite8in,98I+$A98I+<8IN<2J98I+<8IN<5J98I+<8IN<B J98I+<8IN<7A0= e)se i#,e&FFP%P ? @<98I+<'rite8in,98I+$A98I+<8IN<0J98I+<8IN<1J98I+<8IN<3 J98I+<8IN<;A0= @<98I+<'rite8in,98I+$A98I+<8IN<2J 98I+<8IN<5J98I+<8IN<B J98I+<8IN<7A1= e)se i#,e&FFPCP ? @<98I+<'rite8in,98I+$A98I+<8IN<0J98I+<8IN<1J98I+<8IN<3 J98I+<8IN<; 98I+<8IN<2J98I+<8IN<5J98I+<8IN<BJ98I+<8IN<7A1=
e)se i#,e&FFP:Pe&FFP.P /* unning e)a& */
? @<98I+<'rite8in,98I+$A98I+<8IN<0J98I+<8IN<1J98I+<8IN<3 J98I+<8IN<;J98I+<8IN<2J98I+<8IN<5J98I+<8IN<BJ98I+<8IN<7A0= @<98I+<'rite8in,98I+$A98I+<8IN<0A1= @<De)a&,1000= @<98I+<'rite8in,98I+$A98I+<8IN<0A0= @<98I+<'rite8in,98I+$A98I+<8IN<1A1= @<De)a&,1000= @<98I+<'rite8in,98I+$A98I+<8IN<3A1= @<98I+<'rite8in,98I+$A98I+<8IN<1A0= @<De)a&,1000= @<98I+<'rite8in,98I+$A98I+<8IN<;A1= @<98I+<'rite8in,98I+$A98I+<8IN<3A0= @<De)a&,1000= @<98I+<'rite8in,98I+$A98I+<8IN<2A1= @<98I+<'rite8in,98I+$A98I+<8IN<;A0= @<De)a&,1000= @<98I+<'rite8in,98I+$A98I+<8IN<5A1= @<98I+<'rite8in,98I+$A98I+<8IN<2A0= @<De)a&,1000= @<98I+<'rite8in,98I+$A98I+<8IN<BA1= @<98I+<'rite8in,98I+$A98I+<8IN<5A0= @<De)a&,1000= @<98I+<'rite8in,98I+$A98I+<8IN<BA0= @<98I+<'rite8in,98I+$A98I+<8IN<7A1=
@<De)a&,1000= @<98I+<'rite8in,98I+$A98I+<8IN<7A0= @<98I+<'rite8in,98I+$A98I+<8IN<A1= void S&ste!C)oc<Con#ig,void ? CC<+scInitT&(eDe# CC<+scInitStruct= CC<C)InitT&(eDe# CC<C)InitStruct= 8'<C<$N%$,= @<8'<E+T9$SCIN9<C+N4I9,8'<$9UT+<E+T9$<SC$1= CC<+scInitStruct.+sci))atorT&(e F CC<+SCIT+TG8$<@S$= CC<+scInitStruct.@S$State F CC<@S$<+N= CC<+scInitStruct.8.8State F CC<8<+N= CC<+scInitStruct.8.8Source F CC<8S+UC$<@S$= CC<+scInitStruct.8.8M F = CC<+scInitStruct.8.8N F ;;B= CC<+scInitStruct.8.88 F CC<88<DIE3= CC<+scInitStruct.8.8H F 2= @<CC<+scCon#ig,CC<+scInitStruct= CC<C)InitStruct.C)ocT&(e F CC<C+CTG8$<SGSCJCC<C+CTG8$<8C1 JCC<C+CTG8$<8C3= CC<C)InitStruct.SGSCSource F CC<SGSCS+UC$<8C= CC<C)InitStruct.@%CDivider F CC<SGSC<DIE1= CC<C)InitStruct.8%1CDivider F CC<@C<DIE2= CC<C)InitStruct.8%3CDivider F CC<@C<DIE3= @<CC<C)ocCon#ig,CC<C)InitStructA 4S@<T$NCG<5= @<SGSTIC<Con#ig,@<CC<9et@C4reK,/1000= @<SGSTIC<CSourceCon#ig,SGSTIC<CS+UC$<@C= /* S&sTic<IHn interru(t con#iguration */
@<NEIC<Set8riorit&,S&sTic<IHnA 0A 0=
void M><98I+<Init,void ?
98I+<InitT&(eDe# 98I+<InitStruct= /* 98I+ 8orts C)oc $nab)e */ 98I+@<C<$N%$,=
98I+D<C<$N%$,= 98I+$<C<$N%$,=
/*Con#igure 98I+ (ins 8D0 8D1 8D3 8D; 8D2 8D5 8DB 8D7 */ 98I+<InitStruct.8in F 98I+<8IN<0J98I+<8IN<1J98I+<8IN<3J98I+<8IN<; J98I+<8IN<2J98I+<8IN<5J98I+<8IN<BJ98I+<8IN<7= 98I+<InitStruct.Mode F 98I+<M+D$<+UT8UT<88= 98I+<InitStruct.8u)) F 98I+<N+8U= 98I+<InitStruct.S(eed F 98I+<S8$$D<@I9@= @<98I+<Init,98I+DA 98I+<InitStruct=
/*Con#igure 98I+ (ins 8$13 8$1; 8$12 8$15 */
98I+<InitStruct.8in F 98I+<8IN<13J98I+<8IN<1;J98I+<8IN<12J98I+<8IN<15= 98I+<InitStruct.Mode F 98I+<M+D$<+UT8UT<88=
98I+<InitStruct.8u)) F 98I+<N+8U=
@<98I+<Init,98I+$A 98I+<InitStruct=
/*Con#igure 98I+ (ins 8$0 8$1 8$3 8$; 8$2 8$5 8$B 8$7 */ 98I+<InitStruct.8in F 98I+<8IN<0J98I+<8IN<1J98I+<8IN<3J98I+<8IN<; J98I+<8IN<2J98I+<8IN<5J98I+<8IN<BJ98I+<8IN<7= 98I+<InitStruct.Mode F 98I+<M+D$<+UT8UT<88= 98I+<InitStruct.8u)) F 98I+<N+8U= 98I+<InitStruct.S(eed F 98I+<S8$$D<@I9@= @<98I+<Init,98I+$A 98I+<InitStruct=
/*Con#igure 98I+ (ins 8$ 8$O 8$10 8$11 */
98I+<InitStruct.8in F 98I+<8IN<J98I+<8IN<OJ98I+<8IN<10J98I+<8IN<11= 98I+<InitStruct.Mode F 98I+<M+D$<IN8UT= 98I+<InitStruct.8u)) F 98I+<8UD+'N= @<98I+<Init,98I+$A 98I+<InitStruct= :i#de# US$<4U<SS$T
void assert<#ai)ed,uint<t* #i)eA uint;3<t )ine ?
:endi#
6I.
8lo3 C7art
Perco5aan /
START
$oto"y'++)
Cetak'ETF)
Delay %s
$oto"y'4+)
Cetak'ECF)
Delay %s
$oto"y'%+)
Cetak'E5F)
Delay %s
$oto"y'6+)
Cetak'EDF)
Delay %s
$oto"y'!+)
Cetak'ESF)
Delay %s
5<D
$oto"y'+)
Cetak'ETF)
Delay %s
$oto"y'3+)
Cetak'ELF)
Delay %s
Perco5aan 2
START
Simpan B Ekey means B
JcFkeypad1get1key1(alue
$oto"y'++)
Cetak'Simpan)
A<D
Perco5aan
START
KeyBkeypad1get1key1(alue
Simpan B Ekey means B
JcFkeypad1get1key1(alue
$oto"y'++)
Cetak'Simpan)
KeyBB&
KeyBBI
LAbahB+
LAbahB%
A
A
bahBB%
LAKeyBB%
LA,2<5&+B%
KeyBB!
KeyBB
KeyBB.
KeyBB3
KeyBB4
KeyBB6
KeyBBH
KeyBBA
LA,2<5&%B%
LA,2<5&!B%
LA,2<5&B%
LA,2<5&.B%
LA,2<5&3B%
LA,2<5&4B%
LA,2<5&6B%
LA,2<5&+B ,2<5&%B,2<5&!B,2<5&B%
C
;
D
C
;
D
KeyBB;
KeyBBC
KeyBB9
??
KeyBI
LA,2<5&.B ,2<5&3B,2<5&4B,2<5&6B%
LA,2<5&+B ,2<5&%B,2<5&!B,2<5&B%
,2<5&.B ,2<5&3B,2<5&4B,2<5&6B%
,2<5&+B% delay %S
,2<5&%B% delay %S
LA,2<5&!B% delay %S
,2<5&B% delay %S
,2<5&.B% delay %S
,2<5&3B% delay %S
,2<5&4B% delay %S
,2<5&6B% delay %S
5<D
6II.
9am5ar Ran#kaian
Relay % Relay % Relay % Relay % Relay % ,5 + & & & & & ,D + N ,D 6