Professional Documents
Culture Documents
'------------------------------------------------------------------------------$regfile = "m8535.dat"
$crystal = 12000000
$baud = 19200
'siemens c35,m35,c45
'------------------------------------------------------------------------------'Declarasi subrutin
'-------------------------------------------------------------------------------
'------------------------------------------------------------------------------'Declarasi variabel
'------------------------------------------------------------------------------Dim Bc As Byte
Dim Buf1 As String * Cmaxchar
Dim S As String * 23
Dim Sambung As String * 2
Dim Type As String * 3
Dim Pesan As String * 2
Dim Pesane As String * 2
Dim Hp As String * 7
Dim A As Integer
Dim Smse As String * 14
'------------------------------------------------------------------------------'Salam pembuka
'-------------------------------------------------------------------------------
Cls
Lcd " Diploma TE "
Waitms 500
Lowerline
Lcd "
Wait 1
U_G_M
"
Cls
Lcd "created by
"
Waitms 500
Lowerline
Lcd "Fahmizal
"
Wait 1
Cls
Lcd "KendaliJarakJauh"
Waitms 500
Lowerline
Lcd "
dengan hp "
Wait 1
On Urxc Rec_isr
Cls
Do
Print "AT"
Enable Urxc
Enable Interrupts
Cls
Lcd "CHECK CONNECTION"
Lowerline
Lcd "CHECK UOUR CABLE"
Wait 3
Cls
Lcd "== WAITTING =="
Lowerline
Lcd "=============="
Wait 3
S = Right(buf1 , 4)
Sambung = Left(s , 2)
Disable Urxc
Disable Interrupts
Buf1 = ""
Loop Until Sambung = "OK"
Cls
Lcd " CONNECTION "
Lowerline
Lcd "CONGGRATULATION"
Wait 3
Print "AT+CGMI"
Enable Urxc
Enable Interrupts
Cls
Lcd "What is your HP?"
Lowerline
Lcd "================"
Wait 3
S = Mid(buf1 , 11)
Hp = Left(s , 7)
Cls
Lcd Hp
Disable Urxc
Disable Interrupts
Buf1 = ""
Print "AT+CGMM"
Enable Urxc
Enable Interrupts
Lowerline
Wait 3
S = Mid(buf1 , 11)
Type = Left(s , 3)
Lcd Type
Wait 3
Cls
Disable Urxc
Disable Interrupts
Buf1 = ""
Do
Print "AT+CMGL=0"
Enable Urxc
Enable Interrupts
Cls
Lcd "== ADA PESAN =="
Lowerline
Lcd "==============="
Wait 3
S = Right(buf1 , 22)
Type = Mid(s , 2 , 2)
Smse = Right(buf1 , 13)
Pesane = Mid(smse , 2 , 2)
Cls
If Pesan = "19" Then Call 1nyala()
If Pesan = "11" Then Call 1padam()
If Pesan = "29" Then Call 2nyala()
If Pesan = "21" Then Call 2padam()
If Pesane = "MG" Then
Lcd "Tidak ada pesan"
Wait 3
Else
Lcd Pesane
Wait 3
End If
Disable Urxc
Disable Interrupts
Buf1 = ""
Loop
End
'------------------------------------------------------------------------------'Interupsi Serial
'-------------------------------------------------------------------------------
Rec_isr:
If Bc < Cmaxchar Then
Buf1 = Buf1 + Chr(udr)
End If
Return
'------------------------------------------------------------------------------'program subrutin
'------------------------------------------------------------------------------Sub 1nyala()
A=A+1
Cls
Lcd "================"
Lowerline
Lcd "LAMPU 1 NYALA"
Wait 1
Do
A=A+1
Reset Lampu1
Print "AT+CMGD=1"
Loop Until A = 8
End Sub
Sub 1padam()
A=A+1
Cls
Lcd "================"
Lowerline
Lcd "LAMPU 1 PADAM"
Wait 1
Do
A=A+1
Set Lampu1
Print "AT+CMGD=1"
Loop Until A = 8
End Sub
Sub 2nyala()
A=A+1
Cls
Lcd "==============="
Lowerline
Lcd "LAMPU 2 NYALA"
Wait 1
Do
A=A+1
Reset Lampu2
Print "AT+CMGD=1"
Loop Until A = 8
End Sub
Sub 2padam()
A=A+1
Cls
Lcd "==============="
Lowerline
Lcd "LAMPU 2 PADAM"
Wait 1
Do
A=A+1
Set Lampu2
Print "AT+CMGD=1"
Loop Until A = 8
End Sub