Source Code :
$regfile = "reg51.dat"
$crystal = 12000000
Config Lcdpin = Pin , Db4 = P0.4 , Db5 = P0.5 , Db6 = P0.6
Config Lcdpin = Pin ,Db7 = P0.7 , E = P0.0 , Rs = P0.1
Cursor Off
P2 = 0
P3 = 0
Locate 1 , 1
Lcd " MOTOR PUTAR "
Locate 2 , 1
Lcd " KANAN /KIRI"
Wait 2
Locate 1 , 1
Lcd " Oleh "
Locate 2 , 1
Lcd " SUHARDI "
Wait 3
Locate 1 , 1
Lcd " TELAH "
Locate 2 , 1
Lcd " SIAP "
Wait 4
Do
If P1.0 = 0 And P2 = 0 Then
P2 = 1
P3.1 = 1
Locate 1 , 1
Lcd " MOTOR BERPUTAR "
Locate 2 , 1
Lcd " KANAN "
End If
If P1.1 = 0 And P2 = 1 Then
P2 = 0
P3.1 = 0
Locate 1 , 1
Lcd " MOTOR SEDANG "
Locate 2 , 1
Lcd " BERHENTI "
End If
If P1.2 = 0 And P2 = 0 Then
P2 = 2
P3.0 = 1
Locate 1 , 1
Lcd " MOTOR BERPUTR "
Locate 2 , 1
Lcd " KIRI "
End If
If P1.3 = 0 And P2 = 2 Then
P2 = 0
P3.0 = 0
Locate 1 , 1
Lcd " MOTOR SEDANG "
Locate 2 , 1
Lcd " BERHENTI "
End If
If P1.4 = 0 And P2 = 1 Then
P2 = 4
P3 = 4
Locate 1 , 1
Lcd " MOTOR SEDANG "
Locate 2 , 1
Lcd " !!OVERLOAD!! "
End If
If P1.4 = 0 And P2 = 2 Then
P2 = 8
P3 = 4
Locate 1 , 1
Lcd " MOTOR SEDANG "
Locate 2 , 1
Lcd " !!OVERLOAD!! "
End If
If P1.5 = 0 And P2 = 4 Then
P2 = 0
P3 = 0
Locate 1 , 1
Lcd " MOTOR "
Locate 2 , 1
Lcd " READY "
End If
If P1.5 = 0 And P2 = 8 Then
P2 = 0
P3 = 0
Locate 1 , 1
Lcd " MOTOR "
Locate 2 , 1
Lcd " READY "
End If
Loop
Tidak ada komentar:
Posting Komentar