Gambar rangkaian :
Gambar rangkaian dengan Simulator Proteus
Kode Program dengan Bascom (Bas)
1 2 $regfile = "m8def.dat" 3 $crystal = 1000000 4 $hwstack = 40 5 $swstack = 20 6 $framesize = 32 7 8 Declare Sub Actual() 9 10 Config Lcd = 16 * 4 11 Config Lcdpin = Pin , Db4 = Portd.4 , Db5 = Portd.5 , Db6 = Portd.6 , Db7 = Portd.7 , E = Portd.0 , Rs = Portd.1 12 Config Lcdbus = 4 13 Deflcdchar Print , 14 , 32 , 17 , 25 , 21 , 19 , 17 , 17 14 Config Date = Dmy , Separator = / 15 Config Clock = Soft 16 Enable Interrupts 17 18 Dim Minuto As Byte 19 20 21 Ddrd.2 = 1 : Portd.2 = 0 22 Ddrc.0 = 0 : Portc.0 = 1 23 Ddrc.1 = 0 : Portc.1 = 1 24 25 Tombol_select Alias Pinc.0 26 Tombol_set Alias Pinc.1 27 28 29 Date$ = "23/03/11" 30 Time$ = "00:00:00" 31 Minuto = _min 32 33 Cls 34 Cursor Off 35 36 Awal: 37 Locate 1 , 1 : Lcd "BINA ELEKTRONIKA" 38 Locate 3 , 1 : Lcd "JAM :" 39 Locate 2 , 1 : Lcd "TGL :" 40 Locate 4 , 1 : Lcd " " 41 42 Awal1: 43 44 If Tombol_select = 0 Then 45 46 Waitms 5 47 Bitwait Tombol_select , Set 48 Goto Seting_detik 49 50 End If 51 52 Call Actual 53 Goto Awal1 54 55 Seting_detik: 56 57 Locate 4 , 1 : Lcd "SET DETIK" 58 59 Seting_detik1: 60 61 If Tombol_select = 0 Then 62 63 Waitms 5 64 Bitwait Tombol_select , Set 65 Goto Seting_menit 66 67 End If 68 69 If Tombol_set = 0 Then 70 71 Waitms 5 72 _sec = 0 73 Bitwait Tombol_set , Set 74 75 End If 76 77 Call Actual 78 Goto Seting_detik1 79 80 81 Seting_menit: 82 83 Locate 4 , 1 : Lcd "SET MENIT " 84 85 Seting_menit1: 86 87 If Tombol_select = 0 Then 88 89 Waitms 5 90 Bitwait Tombol_select , Set 91 Goto Seting_jam 92 93 End If 94 95 If Tombol_set = 0 Then 96 97 Waitms 5 98 Incr _min 99 If _min = 60 Then 100 _min = 0 101 End If 102 Bitwait Tombol_set , Set 103 104 End If 105 106 Call Actual 107 Goto Seting_menit1 108 109 Seting_jam: 110 111 Locate 4 , 1 : Lcd "SET JAM " 112 113 Seting_jam1: 114 115 If Tombol_select = 0 Then 116 117 Waitms 5 118 Bitwait Tombol_select , Set 119 Goto Seting_hari 120 121 End If 122 123 If Tombol_set = 0 Then 124 125 Waitms 5 126 Incr _hour 127 If _hour = 24 Then 128 _hour = 0 129 End If 130 Bitwait Tombol_set , Set 131 132 End If 133 134 Call Actual 135 Goto Seting_jam1 136 137 Seting_hari: 138 139 Locate 4 , 1 : Lcd "SET TANGGAL " 140 141 Seting_hari1: 142 143 If Tombol_select = 0 Then 144 145 Waitms 5 146 Bitwait Tombol_select , Set 147 Goto Seting_bulan 148 149 End If 150 151 If Tombol_set = 0 Then 152 153 Waitms 5 154 Incr _day 155 If _day = 32 Then 156 _day = 1 157 End If 158 Bitwait Tombol_set , Set 159 160 End If 161 162 Call Actual 163 Goto Seting_hari1 164 165 Seting_bulan: 166 167 Locate 4 , 1 : Lcd "SET BULAN " 168 169 Seting_bulan1: 170 171 If Tombol_select = 0 Then 172 173 Waitms 5 174 Bitwait Tombol_select , Set 175 Goto Seting_tahun 176 177 End If 178 179 If Tombol_set = 0 Then 180 181 Waitms 5 182 Incr _month 183 If _month = 13 Then 184 _month = 1 185 End If 186 Bitwait Tombol_set , Set 187 188 End If 189 190 Call Actual 191 Goto Seting_bulan1 192 193 194 Seting_tahun: 195 196 'Locate 4 , 1 : Lcd "A" 197 'Locate 4 , 2 : Lcd Chr(0) 198 Locate 4 , 1 : Lcd "SET TAHUN " 199 200 Seting_tahun1: 201 202 If Tombol_select = 0 Then 203 204 Waitms 5 205 Bitwait Tombol_select , Set 206 Goto Awal 207 208 End If 209 210 If Tombol_set = 0 Then 211 212 Waitms 5 213 Incr _year 214 If _year = 100 Then 215 _year = 00 216 End If 217 Bitwait Tombol_set , Set 218 219 End If 220 221 Call Actual 222 Goto Seting_tahun1 223 224 225 Actual: 226 227 Locate 2 , 7 : Lcd Date$ 228 Locate 3 , 7 : Lcd Time$ 229 If _min <> Minuto Then 230 231 Minuto = _min 232 Toggle Portd.2 233 234 End If 235 236 Return 237 238 End
Terima kasih infonya gan
BalasHapusini aku juga posting Jam digital dengan tampilan seven segmen dan LCD menggunakan RTC DS1307 dan mikrokontroler AVR atmega 8535
Bisa di check disini
http://bagindra.blogspot.com/2012/02/jam-digital-dengan-tampilan-seven.html
Yan mas gun sama sama tekran pengetahuan ........
BalasHapusmas mau tnya project ini sdh di aplikasikan di hardware blm???
BalasHapussoalnya pas disimulasikan pas,,tp pas di hardware kok g bisa yaw...
mohon pencerahannya
good job
BalasHapustutorial nya gak ada ?
BalasHapussilahkan cek di my channel youtube, JeoNei JN
BalasHapus