Code List :
$regfile = "m8def.dat" $crystal = 1000000 $hwstack = 64 $swstack = 64 $framesize = 64 Config Kbd = Portb , Debounce = 150 , Delay = 200 Config Portb = Input Config Portc = Output Config Portd = Output Dim A As Byte Speaker Alias Pinc.0 Main: Wait 1 Sound Speaker , 120 , 100 Sound Speaker , 120 , 80 Do A = Getkbd() A = Lookup(a , Read_key) If A < 12 Then Select Case A Case 0: Sound Speaker , 120 , 20 Goto Main0 Case 1: Sound Speaker , 120 , 20 Goto Main1 Case 2: Sound Speaker , 120 , 20 Goto Main2 Case 3: Sound Speaker , 120 , 20 Goto Main3 Case 4: Sound Speaker , 120 , 20 Goto Main4 Case 5: Sound Speaker , 120 , 20 Goto Main5 Case 6: Sound Speaker , 120 , 20 Goto Main6 Case 7: Sound Speaker , 120 , 20 Goto Main7 Case 8: Sound Speaker , 120 , 20 Goto Main8 Case 9: Sound Speaker , 120 , 20 Goto Main9 Case 11: Sound Speaker , 120 , 20 Goto Main11 Case 10: Sound Speaker , 120 , 20 Goto Main10 End Select End If Loop End '_______________________________________________________________________________ Read_key: Data 1 , 4 , 7 , 11 , 2 , 5 , 8 , 0 , 3 , 6 , 9 , 10 '_______________________________________________________________________________ Main0: A = Getkbd() A = Lookup(a , Read_key) If A < 12 Then Select Case A Case 0 To 9: Sound Speaker , 120 , 500 Case 11: Portc.5 = 1 Sound Speaker , 120 , 100 Sound Speaker , 120 , 80 Sound Speaker , 120 , 60 Goto Main Case 10: Portc.5 = 0 Sound Speaker , 120 , 60 Sound Speaker , 120 , 80 Sound Speaker , 120 , 100 Goto Main End Select End If jmp main0 Main1: A = Getkbd() A = Lookup(a , Read_key) If A < 12 Then Select Case A Case 0 To 9: Sound Speaker , 120 , 500 Case 11: Portc.4 = 1 Sound Speaker , 120 , 100 Sound Speaker , 120 , 80 Sound Speaker , 120 , 60 Goto Main Case 10: Portc.4 = 0 Sound Speaker , 120 , 60 Sound Speaker , 120 , 80 Sound Speaker , 120 , 100 Goto Main End Select End If jmp main1 Main2: A = Getkbd() A = Lookup(a , Read_key) If A < 12 Then Select Case A Case 0 To 9: Sound Speaker , 120 , 500 Case 11: Portc.3 = 1 Sound Speaker , 120 , 100 Sound Speaker , 120 , 80 Sound Speaker , 120 , 60 Goto Main Case 10: Portc.3 = 0 Sound Speaker , 120 , 60 Sound Speaker , 120 , 80 Sound Speaker , 120 , 100 Goto Main End Select End If jmp main2 Main3: A = Getkbd() A = Lookup(a , Read_key) If A < 12 Then Select Case A Case 0 To 9: Sound Speaker , 120 , 500 Case 11: Portc.2 = 1 Sound Speaker , 120 , 100 Sound Speaker , 120 , 80 Sound Speaker , 120 , 60 Goto Main Case 10: Portc.2 = 0 Sound Speaker , 120 , 60 Sound Speaker , 120 , 80 Sound Speaker , 120 , 100 Goto Main End Select End If jmp main3 Main4: A = Getkbd() A = Lookup(a , Read_key) If A < 12 Then Select Case A Case 0 To 9: Sound Speaker , 120 , 500 Case 11: Portc.1 = 1 Sound Speaker , 120 , 100 Sound Speaker , 120 , 80 Sound Speaker , 120 , 60 Goto Main Case 10: Portc.1 = 0 Sound Speaker , 120 , 60 Sound Speaker , 120 , 80 Sound Speaker , 120 , 100 Goto Main End Select End If jmp main4 Main5: A = Getkbd() A = Lookup(a , Read_key) If A < 12 Then Select Case A Case 0 To 9: Sound Speaker , 120 , 500 Case 11: Portd.0 = 1 Sound Speaker , 120 , 100 Sound Speaker , 120 , 80 Sound Speaker , 120 , 60 Goto Main Case 10: Portd.0 = 0 Sound Speaker , 120 , 60 Sound Speaker , 120 , 80 Sound Speaker , 120 , 100 Goto Main End Select End If jmp main5 'www.bargh20.com Main6: A = Getkbd() A = Lookup(a , Read_key) If A < 12 Then Select Case A Case 0 To 9: Sound Speaker , 120 , 500 Case 11: Portd.1 = 1 Sound Speaker , 120 , 100 Sound Speaker , 120 , 80 Sound Speaker , 120 , 60 Goto Main Case 10: Portd.1 = 0 Sound Speaker , 120 , 60 Sound Speaker , 120 , 80 Sound Speaker , 120 , 100 Goto Main End Select End If jmp main6 Main7: A = Getkbd() A = Lookup(a , Read_key) If A < 12 Then Select Case A Case 0 To 9: Sound Speaker , 120 , 500 Case 11: Portd.2 = 1 Sound Speaker , 120 , 100 Sound Speaker , 120 , 80 Sound Speaker , 120 , 60 Goto Main Case 10: Portd.2 = 0 Sound Speaker , 120 , 60 Sound Speaker , 120 , 80 Sound Speaker , 120 , 100 Goto Main End Select End If jmp main7 Main8: A = Getkbd() A = Lookup(a , Read_key) If A < 12 Then Select Case A Case 0 To 9: Sound Speaker , 120 , 500 Case 11: Portd.3 = 1 Sound Speaker , 120 , 100 Sound Speaker , 120 , 80 Sound Speaker , 120 , 60 Goto Main Case 10: Portd.3 = 0 Sound Speaker , 120 , 60 Sound Speaker , 120 , 80 Sound Speaker , 120 , 100 Goto Main End Select End If jmp main8 Main9: A = Getkbd() A = Lookup(a , Read_key) If A < 12 Then Select Case A Case 0 To 9: Sound Speaker , 120 , 500 Case 11: Portd.4 = 1 Sound Speaker , 120 , 100 Sound Speaker , 120 , 80 Sound Speaker , 120 , 60 Goto Main Case 10: Portd.4 = 0 Sound Speaker , 120 , 60 Sound Speaker , 120 , 80 Sound Speaker , 120 , 100 Goto Main End Select End If jmp main9 Main11: Wait 3 A = Getkbd() A = Lookup(a , Read_key) If A = 11 Then Sound Speaker , 120 , 100 Sound Speaker , 120 , 80 Sound Speaker , 120 , 60 Portc.5 = 1 Portc.4 = 1 Portc.3 = 1 Portc.2 = 1 Portc.1 = 1 Portd.0 = 1 Portd.1 = 1 Portd.2 = 1 Portd.3 = 1 Portd.4 = 1 Goto Main Else Goto Main End If Main10: Wait 3 A = Getkbd() A = Lookup(a , Read_key) If A = 10 Then Sound Speaker , 120 , 60 Sound Speaker , 120 , 80 Sound Speaker , 120 , 100 Portc.5 = 0 Portc.4 = 0 Portc.3 = 0 Portc.2 = 0 Portc.1 = 0 Portd.0 = 0 Portd.1 = 0 Portd.2 = 0 Portd.3 = 0 Portd.4 = 0 Goto Main Else Goto Main End If
Salam Kenal Pak...
BalasHapusIni udah pernah di coba pak?
ada gak skematik yg jelas?
cara kerja nya gimana pak?
terima kasih
cara kerjanya , misal kita ingin menyalakan relay (lampu5) tekan no 5 di keypad kemudian tekan tombol start ( tombol bintang di keypad) dan untuk mematikan sebaliknya tekan tombol 5 di keypad kemudian tekan tombol pagar (#). Untuk lampu yang lain cara yang sama, mudah mudahan jadi jelas !
BalasHapusuntuk skematik yang jelas nanti saya siapkan kalu di inginkan !
BalasHapusmaaf pak .. saya boleh minta skema yang jelas.?
BalasHapuskemudian relay nya itu berapa volt ya.?
untuk melihat rangkaian lebih jelas silahkan download di sini
BalasHapushttp://downloads.ziddu.com/download/23659363/relay.docx.html
salam kenal. saya mau nanya pak ,punya sekema lampu otomatis pake key pake atmega8 yang pake bascom
BalasHapusMatursuwon pak sangat bermanfaat
BalasHapus