- Putar kanan
- Putar Kiri
- Stop
- Overload
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
Selamat mencoba dan semoga bermanfaat ......
Yg pakai Code Vision AVR gmna pak,,mhon bantuanya,,,!!bingung ni tgas akhir pak.
BalasHapusSaya agak susah dengan bahasa pemrograman C Codevision mas
BalasHapusmaav pak mau tanya, kalo program untuk mengontrol suhu dengan driver yang ada firing triac & zerocross ada postingannya gak?
BalasHapuskeren
BalasHapushttp://blog.adisanjaya.com/2014/09/android-water-level-monitoring-dengan.html