You are on page 1of 3

Nama: Tegar Tabiin Shofa

Kelas: XI TEI 3
No : 31
LAPORAN PRAKTIK

A. Pemrograman Input/Output Motor DC menggunakan saklar Push Button ( PB )


1. Gambar Rangkaian

2. Program
$regfile = “m32def.dat”

$crystal = 12000000

Config Porta = Output

Config Portb = Input

Declare Sub Geserkanan()

Declare Sub Geserkiri()

Declare Sub Mati()

Portb = 255

Do

If Pinb.0 = 0 Then Goto Geserkanan


If Pinb.1 = 0 Then Goto Geserkiri

If Pinb.2 = 0 Then Goto Mati

Loop

End

Sub Geserkiri()

Do

Porta = &H82 ‘1000.0010

Waitms 10

If Pinb.0 = 0 Then Goto Geserkanan

If Pinb.1 = 0 Then Goto Geserkiri

If Pinb.2 = 0 Then Goto Mati

Loop

End Sub

Sub Geserkanan()

Do

Porta = &H41 ‘0100 , 0001

Waitms 10

If Pinb.0 = 0 Then Goto Geserkanan

If Pinb.1 = 0 Then Goto Geserkiri

If Pinb.2 = 0 Then Goto Mati

Loop

End Sub

Sub Mati()

Do
Porta = &H00

Waitms 10

If Pinb.0 = 0 Then Goto Geserkanan

If Pinb.1 = 0 Then Goto Geserkiri

Loop

End Sub

3. Hasil (berupa link video yang diupload di Google Drive/YouTube/Tiktok/Reel Ig)


https://youtu.be/h1cliTax8sw

You might also like