Kamis, 17 November 2016

Laporan Putar Kanan & Kiri Bascom AVR



LAPORAN PRAKTEK  
Membuat Rangkaian MEMBUAT KENDALI MOTOR DC Untuk Putar Kanan,Kiri,Dengan "START","STOP","OL" Dan "RESET"

·  Tujuan :
Setelah siswa praktek diharapkan dapat :

·         Melakukan Program Mikrokontroler Dengan Bahasa Basic (BASCOM).
·         Menguji Coba Rangkaian Dengan Benar.
·         Membuat Rangkaian MEMBUAT KENDALI MOTOR DC Untuk Putar Kanan,Kiri,Dengan "START","STOP","OL" Dan "RESET"

·  Alat Dan Bahan :
  1. Alat :
    • Komputer Dengan Software Proteus.
    • Gambar Rencana Kerja.
    • Rencana Program.

  1. Bahan :
    • Ic AT89S51
    • 3 LED
    • Resistor 1K
    • motor
    • relay
    • kondensator
    • AND
    • counter
    • lcd 16*2
    • button
    • resistor pack

·  Keselamatan Kerja :
  • Berdo'alah sebelum melakukan Praktek.
  • Dilarang Bersendau-gurau Saat Pelaksanaan Praktek.
  • Menghidupkan dan Mematikan Komputer dengan Prosedur Yang Benar.

·  Instruksi Kerja :
  • Memastikan alat dan bahan siap digunakan.
  • Memastikan telah memahami gambar kerja dan source code program.
  • Menulis source program dengan bascom 89s51.
  • Membuat rangkaian simulator rangkaian dengan proteus.
  • Membuat komplier kode program untuk mendapatkan file *HEX.
  • Melakukan uji coba rangkaian simulator.
·  Gambar Kerja :
Description: C:\Users\Komp TOI 003\AppData\Roaming\PixelMetrics\CaptureWiz\LastCaptures\2016-11-18_07-49-25-392.png
·  Source Code :
$regfile = "m8535.dat"
$crystal = 16000000

Cursor Off

Declare Sub Kanan()
Declare Sub Kiri()
Declare Sub Berhenti()
Declare Sub Ol()
Declare Sub Siap()

Ddrd.0 = 0 : Portd.0 = 1
Ddrd.1 = 0 : Portd.1 = 1
Ddrd.2 = 0 : Portd.2 = 1
Ddrd.3 = 0 : Portd.3 = 1
Ddrd.4 = 0 : Portd.4 = 1
Config Portb = Output
Config Portd = Input
Config Lcdpin = Pin , Rs = Portc.0 , E = Portc.2 , Db4 = Portc.4,
Config Lcdpin = Pin , Db5 = Portc.5 , Db6 = Portc.6 , Db7 = Portc.7
Config Lcd = 16 * 2
Cursor Off
Cls
Locate 1 , 1
Lcd "   PENGENDALI      "
Locate 2 , 1
Lcd "    MOTOR DC       "
Portb = 8

Do
'Motor Putar Kanan
If Pind.0 = 0 And Portb = 8 Then
Locate 1 , 1
Lcd "  MOTOR SEDANG     "
Locate 2 , 1
Lcd " PUTAR KANAN>>>    "
Gosub Kanan
End If

'Motor Putar Kiri
If Pind.1 = 0 And Portb = 8 Then
Locate 1 , 1
Lcd "  MOTOR SEDANG     "
Locate 2 , 1
Lcd " PUTAR KIRI <<<    "
Gosub Kiri
End If

'stop
If Pind.2 = 0 And Pinb.2 = 0 Then
Locate 1 , 1
Lcd "MOTOR BERHENTI     "
Locate 2 , 1
Lcd "    <<STOP>>       "
Gosub Berhenti
End If

If Pind.3 = 0 Then
Locate 1 , 1
Lcd " GAESS OVERLOAD    "
Locate 2 , 1
Lcd " SILAKAN RESET     "
Gosub Ol
End If

If Pind.4 = 0 Then
Locate 1 , 1
Lcd "   MOTOR SIAP      "
Locate 2 , 1
Lcd "   DIJALANKAN      "
Gosub Siap
End If

Loop

Kanan:
Portb = 18
Waitms 0.3
Return

Kiri:
Portb = 17
Waitms 0.3
Return

Berhenti:
Portb = 8
Waitms 0.3
Return

Ol:
Portb = 4
Waitms 50
Portb = 0
Waitms 50
Portb = 4
Waitms 50
Portb = 0
Waitms 50
Portb = 4
Waitms 50
Portb = 0
Waitms 50
Portb = 4
Waitms 50
Portb = 0
Waitms 50
Portb = 4
Waitms 50
Portb = 0
Waitms 50
Locate 1 , 1
Lcd "       OK           "
Locate 2 , 1
Lcd "   RESET DULU       "
Return

Siap:
Portb = 8
Waitms 0.3
Return

End