سلام نیاز فوری
هر کار میکنم ماژول پیامک دریافت نمیکنه ولی به راحتی میفرسته
$regfile = "m32def.dat"
$crystal = 8000000
$baud = 19200
$hwstack = 64
$swstack = 64
$framesize = 64
'========================================= ==
'========================================= ==
Config Portc = Output
Config Pind.2 = Input
Config Lcd = 16 * 2
Config Lcdpin = Pin , Db4 = Portb.4 , Db5 = Portb.5 , Db6 = Portb.6 , _
Db7 = Portb.7 , E = Portb.3 , Rs = Portb.2
Config Adc = Single , Prescaler = Auto
Config Timer0 = Timer , Prescale = 8
Enable Interrupts
Enable Timer0
On Timer0 Reza
Timer0 = 6
Dim D As Word , D1 As Word , G As Word , Z As Long , V As Byte , Pl As Byte
Dim B As Byte , U As Byte , S As Byte , , T As Byte , F As Byte
Dim R As String * 15 , L As String * 15 , Sms As String * 250
'///////////////////////////////////////////////////////////////////////////////
Cursor Off
Locate 1 , 1
Lcd "Reza "
Locate 2 , 1
Lcd "0930****778"
Wait 3
U = 25 : V = 0
'///////////////////////////////////////////////////////////////////////////////
Enable Adc
Start Timer0
Print "AT"
Waitms 200
Print "AT+CMGD=0,4"
Waitms 200
Print "AT+CMGDA=DEL ALL"
Waitms 200
Print "AT+IPR=19200"
Waitms 200
Print "AT+CMGF=1"
Waitms 200
Cls
Do
Select Case S
Case 0 To 1:
T = 0
Locate 1 , 1
Lcd "Waiting...Sensor"
Locate 2 , 1
Lcd "is ganna ready"
Case Else:
'///////////////////////////////////////////////////////////////////////////////
D = Getadc(0)
D1 = D / 2
Select Case D1
Case Is <= U:
Portc.0 = 0
Case Is >= U:
Portc.0 = 1
End Select
Locate 1 , 1
Lcd "Dama : " ; D1 ; " "
'///////////////////////////////////////////////////////////////////////////////
G = Getadc(1)
Select Case G
Case 0 To 614:
T = 0
Portc.1 = 0
Locate 2 , 1
Lcd "Gas : Safe "
Case 615 To 1023:
While T = 0
Locate 2 , 1
Lcd "Gas : Danger"
T = 1
Portc.1 = 1
Print "AT"
Waitms 200
Print "AT+IPR=19200"
Waitms 200
Print "AT+CMGS=" ; Chr(34) ; "0930****778" ; Chr(34)
Waitms 200
Print "Danger" ; Chr(26)
Waitms 200
Wend
End Select
End Select
'///////////////////////////////////////////////////////////////////////////////
If Pind.2 = 0 Then F = 4
While F > 2
Print "AT"
Waitms 200
Print "AT+IPR=19200"
Waitms 200
Print "AT+CMGR=1"
Sms = ""
B = Inkey()
If B > 0 Then
Select Case B
Case 13:
If Sms <> "" Then Exit While
Case 10:
If Sms <> "" Then Exit While
Case Else
Sms = Sms + Chr(b)
F = 0
End Select
End If
Wend
If Sms = "dama" Then
U = Val(sms)
End If
If Sms = "on" Then
Portc.2 = 1
End If
If Sms = "off" Then
Portc.2 = 0
End If
Loop
'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
Reza:
Stop Timer0
Z = Z + 1
If Z = 180000 Then
Z = 0
S = S + 1
Cls
If S > 200 Then S = 6
End If
Timer0 = 6
Start Timer0
Return
'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
هر کار میکنم ماژول پیامک دریافت نمیکنه ولی به راحتی میفرسته
$regfile = "m32def.dat"
$crystal = 8000000
$baud = 19200
$hwstack = 64
$swstack = 64
$framesize = 64
'========================================= ==
'========================================= ==
Config Portc = Output
Config Pind.2 = Input
Config Lcd = 16 * 2
Config Lcdpin = Pin , Db4 = Portb.4 , Db5 = Portb.5 , Db6 = Portb.6 , _
Db7 = Portb.7 , E = Portb.3 , Rs = Portb.2
Config Adc = Single , Prescaler = Auto
Config Timer0 = Timer , Prescale = 8
Enable Interrupts
Enable Timer0
On Timer0 Reza
Timer0 = 6
Dim D As Word , D1 As Word , G As Word , Z As Long , V As Byte , Pl As Byte
Dim B As Byte , U As Byte , S As Byte , , T As Byte , F As Byte
Dim R As String * 15 , L As String * 15 , Sms As String * 250
'///////////////////////////////////////////////////////////////////////////////
Cursor Off
Locate 1 , 1
Lcd "Reza "
Locate 2 , 1
Lcd "0930****778"
Wait 3
U = 25 : V = 0
'///////////////////////////////////////////////////////////////////////////////
Enable Adc
Start Timer0
Print "AT"
Waitms 200
Print "AT+CMGD=0,4"
Waitms 200
Print "AT+CMGDA=DEL ALL"
Waitms 200
Print "AT+IPR=19200"
Waitms 200
Print "AT+CMGF=1"
Waitms 200
Cls
Do
Select Case S
Case 0 To 1:
T = 0
Locate 1 , 1
Lcd "Waiting...Sensor"
Locate 2 , 1
Lcd "is ganna ready"
Case Else:
'///////////////////////////////////////////////////////////////////////////////
D = Getadc(0)
D1 = D / 2
Select Case D1
Case Is <= U:
Portc.0 = 0
Case Is >= U:
Portc.0 = 1
End Select
Locate 1 , 1
Lcd "Dama : " ; D1 ; " "
'///////////////////////////////////////////////////////////////////////////////
G = Getadc(1)
Select Case G
Case 0 To 614:
T = 0
Portc.1 = 0
Locate 2 , 1
Lcd "Gas : Safe "
Case 615 To 1023:
While T = 0
Locate 2 , 1
Lcd "Gas : Danger"
T = 1
Portc.1 = 1
Print "AT"
Waitms 200
Print "AT+IPR=19200"
Waitms 200
Print "AT+CMGS=" ; Chr(34) ; "0930****778" ; Chr(34)
Waitms 200
Print "Danger" ; Chr(26)
Waitms 200
Wend
End Select
End Select
'///////////////////////////////////////////////////////////////////////////////
If Pind.2 = 0 Then F = 4
While F > 2
Print "AT"
Waitms 200
Print "AT+IPR=19200"
Waitms 200
Print "AT+CMGR=1"
Sms = ""
B = Inkey()
If B > 0 Then
Select Case B
Case 13:
If Sms <> "" Then Exit While
Case 10:
If Sms <> "" Then Exit While
Case Else
Sms = Sms + Chr(b)
F = 0
End Select
End If
Wend
If Sms = "dama" Then
U = Val(sms)
End If
If Sms = "on" Then
Portc.2 = 1
End If
If Sms = "off" Then
Portc.2 = 0
End If
Loop
'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
Reza:
Stop Timer0
Z = Z + 1
If Z = 180000 Then
Z = 0
S = S + 1
Cls
If S > 200 Then S = 6
End If
Timer0 = 6
Start Timer0
Return
'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
دیدگاه