Você está na página 1de 5

01.33 3 comments http://suparno-mikrokontroler.blogspot.com/2012/12/simulator-pengendali-motor-dc-putar.

html Pada artikel kali ini saya posting sebuah simulator pengendali motor DC dengan Proteus untuk : 1. 2. 3. 4. Putar kanan Putar Kiri Stop Overload

dilengkapi dengan tampilan LCD 2 x 16 yang dapat melihat kondisi jalannya program : Gambar Rangkaianya lengkap :

List Code Bascom AVR :

$regfile = "m8535.dat" $crystal = 4000000 Declare Sub Kanan() Declare Sub Kiri() Declare Sub Berhenti() Declare Sub Ol() Declare Sub Siap() Ddrc.0 = 0 : Portc.0 = 1 Ddrc.1 = 0 : Portc.1 = 1 Ddrc.2 = 0 : Portc.2 = 1 Ddrc.3 = 0 : Portc.3 = 1 Ddrc.4 = 0 : Portc.4 = 1 Portb = 8 Config Portb = Output Config Portc = Input Config Lcd = 16 * 2 Config Lcdpin = Pin , Db4 = Portd.4 , Db5 = Portd.5 , Db6 = Portd.6 , Db7 = Portd.7 , E = Portd.3 , Rs = Portd.2 Cursor Off Locate 1 , 1 Lcd " MOTOR READY " Locate 2 , 1 Lcd "BINA ELEKTRONIKA" Wait 2

Do If Pinc.0 = 0 And Portb = 8 Then Locate 1 , 1 Lcd "MOTOR SEDANG " Locate 2 , 1 Lcd "PUTAR KANAN >>> " Gosub Kanan End If If Pinc.1 = 0 And Portb = 8 Then Locate 1 , 1 Lcd "MOTOR SEDANG " Locate 2 , 1 Lcd "PUTAR KIRI <<< "

Gosub Kiri End If If Pinc.2 = 0 Then Locate 1 , 1 Lcd "MOTOR BERHENTI " Locate 2 , 1 Lcd " " Gosub Berhenti End If If Pinc.3 = 0 Then Locate 1 , 1 Lcd "WADUH OVERLOAD " Locate 2 , 1 Lcd "SILAHKAN RESET " Gosub Ol End If If Pinc.4 = 0 Then Locate 1 , 1 Lcd "MOTOR SIAP " Locate 2 , 1 Lcd "DIJALANKAN " Gosub Siap End If Loop Kanan: Portb = 2 Waitms 0.3 Return Kiri: Portb = 1 Waitms 0.3 Return Berhenti: Portb = 8 Waitms 0.3 Return Ol: Portb = 4

Waitms 0.3 Return Siap: Portb = 8 Waitms 0.3 Return End

Tampilan LCD menggunakan Mikro ATMega8535 dan Bahasa BASCOM-AVR


13.44 Bascom AVR 3 comments Belajar menggunakan LCD dengan ATMega8535 tidaklah sulit, dengan menggunakan bahasa Bascom AVR hal ini menjadi mudah dilakukan terutama bagi pemula. Berikut adalah rangkaian konfigurasi pin pada mikro ATMega8535 dan contoh program yang dapat dicoba. Selamat Mencoba. Gambar Rangkaian :

Rangkaian Tampilan LCD. List program :

$regfile = "m8535def.dat" $crystal = 4000000 Enable Interrupts Config Portd = Output Config Lcd = 16 * 2 Config Lcdpin = Pin , Rs = Portd.4 , E = Portd.5 , Db4 = Portd.0 Config Lcdpin = Pin , Db5 = Portd.1 , Db6 = Portd.2 , Db7 = Portd.3 Config Date = Mdy , Separator = / Config Clock = Soft Date$ = "11/26/08" Time$ = "08:16:00" '----------------------Cls Do Locate 1 , 1 Lcd "Tanggal:" ; Date$ Locate 2 , 1 Lcd "Pukul:" ; Time$ Loop End Kirimkan Ini lewat Email BlogThis! Berbagi ke Twitter Berbagi ke Facebook

Você também pode gostar