با سلام.من پروژه زیر رو از سایت دریافت کردم.مال دزدگیره.فقط مشکلم همینه که وقتی بهش مثلا اس میدم که یه شماره رو ذخیره کنه.ومن با اون شماره باهاش در ارتباط باشم.مشکل حل نمیشه و فقط دریافت میکنه.ولی چیزی برام ارسال نمیکنه.این پروژه با ریموتم هست.ریموت کار میکنه.مشکل من اینه که با اس کار نمیکنه.یعنی میبینم که اس میاد و چراغش روشن میشه.ولی پیامی برای تایید ارسال نمیشه
[FONT=Yekan]'===============================================================================[/FONT]'Program Composer : Farhad Akbari
'Web : www.electronics98.com
'Company : Ofogh Ideh Pardazan Shirvan
'===============================================================================
$regfile = "m32def.dat"
$crystal = 11059200
$hwstack = 512
$swstack = 512
$framesize = 512
'************************************************************************** Baud
$baud = 115200
'************************************************************************ TIMER2
Config Timer2 = Timer , Prescale = 1024
Enable Interrupts
Enable Ovf2
On Ovf2 Clock
Start Timer2
'*************************************************************************** ADC
Config Adc = Single , Prescaler = Auto , Reference = Off
Start Adc
Enable Adc
'*************************************************************************** LCD
Config Lcdpin = Pin , Db4 = Pind.3 , Db5 = Pind.4 , Db6 = Pind.5 , Db7 = Pind.6 , Rs = Pinc.0 , E = Pind.7
Config Lcd = 16 * 2
Cursor Off
Cls
'****************************************************************** Config Input
Config Pina.2 = Input 'Charger Status
Config Pina.4 = Input 'Zone1
Config Pina.5 = Input 'Zone2
Config Pina.6 = Input 'Zone3
Config Pina.7 = Input 'Zone4
Config Pinc.1 = Input 'Remote1
Config Pinc.2 = Input 'Remote2
Config Pinc.3 = Input 'Remote3
Config Pinc.4 = Input 'Remote4
Config Pind.2 = Input 'Ring Sim900
'***************************************************************** Config Output
Config Porta.0 = Output
Config Porta.1 = Output
Config Portb = Output 'RLY 1 TO RLY 8
'******************************************************************* Alias Input
Charger_status Alias Pina.2
Zone1 Alias Pina.4
Zone2 Alias Pina.5
Zone3 Alias Pina.6
Zone4 Alias Pina.7
Remote_start Alias Pinc.1
Remote_unlock Alias Pinc.2
Remote_siren Alias Pinc.3
Remote_lock Alias Pinc.4
Ri Alias Pind.2
'****************************************************************** Alias Output
Led_data Alias Porta.0
Alarm_status Alias Porta.1
Rly1 Alias Portb.0
Rly2 Alias Portb.1
Rly3 Alias Portb.2
Rly4 Alias Portb.3
Rly5 Alias Portb.4
Rly6 Alias Portb.5
Rly7 Alias Portb.6
Rly8 Alias Portb.7
'**************************************************************** Dim Var As ...
Dim T As Byte
Dim F0 As Byte
Dim T1 As Byte
Dim T2 As Byte
Dim T3 As Byte
Dim T7 As Byte
Dim T8 As Byte
Dim Mic As Byte
Dim Tik As Byte
Dim Var As Byte
Dim Din As Word
Dim Show As Bit
Dim Lock As Bit
Dim Unlock As Bit
Dim Alarm As Byte
Dim Error As Byte
Dim Sampel As Word
Dim Temp As Single
Dim T_error As Byte
Dim Remot_key As Bit
Dim Time_lcd As Byte
Dim Tik_lock As Byte
Dim Status_rly1 As Bit
Dim Status_rly2 As Bit
Dim Status_rly3 As Bit
Dim Status_rly4 As Bit
Dim Status_rly5 As Bit
Dim Status_rly6 As Bit
Dim Status_rly7 As Bit
Dim Status_rly8 As Bit
Dim Charger_key As Bit
Dim Tik_unlock As Byte
Dim Status_zone1 As Bit
Dim Status_zone2 As Bit
Dim Status_zone3 As Bit
Dim Status_zone4 As Bit
Dim Sms_hi_power As Bit
Dim Time_sensor As Byte
Dim Sms_low_power As Bit
Dim Sms As String * 250
Dim Code As String * 20
Dim T_dn As Eram Single
Dim T_up As Eram Single
Dim T_dn_flash As Single
Dim T_up_flash As Single
Dim Data_in As String * 1
Dim Data_sd As String * 4
Dim Str_var As String * 1
Dim Data_eram As String * 4
Dim Tell1 As Eram String * 14
Dim Tell2 As Eram String * 14
Dim Tell3 As Eram String * 14
Dim Tell4 As Eram String * 14
Dim Code_charge As String * 30
Dim Password As Eram String * 4
'''''''''''''''''''''''''''''''''''''''''Config Data Var
Dim Test1 As Byte
Dim Test2 As Eram Byte
Test1 = Test2
Waitms 20
If Test1 <> 12 Then
Code = "2222"
Password = Code
Waitms 20
T_dn_flash = 20
Waitms 20
T_up_flash = 40
Waitms 20
T_dn = T_dn_flash
Waitms 20
T_up = T_up_flash
Waitms 20
Test1 = 12
Waitms 20
Test2 = Test1
Waitms 20
End If
'''''''''''''''''''''''''''''''''''''''''Config Data Temp Var
T_dn_flash = T_dn
Waitms 20
T_up_flash = T_up
Waitms 20
'''''''''''''''''''''''''''''''''''''''''Config Data Flash Var
Time_sensor = 0 : Alarm = 0 : Status_rly1 = 0 : Status_rly2 = 0
Status_rly3 = 0 : Status_rly4 = 0 : Status_rly5 = 0 : Status_rly6 = 0
Status_rly7 = 0 : Status_rly8 = 0 : T1 = 0 : Mic = 0 : T7 = 0 : Code = ""
Status_zone1 = 0 : Status_zone1 = 0 : Status_zone1 = 0 : Status_zone1 = 0
'*******************************************************************************
Print "AT"
Cls
Locate 1 , 1
Lcd " Please wait... "
Locate 2 , 1
Lcd " Print AT "
Wait 2
Print "AT"
Wait 2
Print "AT"
Wait 4
Print "ATE0"
Cls
Locate 1 , 1
Lcd " Please wait... "
Locate 2 , 1
Lcd " Print ATE0 "
Wait 4
Print "AT+CMGF=1"
Cls
Locate 1 , 1
Lcd " Please wait... "
Locate 2 , 1
Lcd "Print AT+CMGF=1 "
Wait 4
Print "AT+MORING=1"
Cls
Locate 1 , 1
Lcd " Please wait... "
Locate 2 , 1
Lcd " Print AT+MORING"
Wait 2
Print "AT+CSMP=17,167,0,0"
Cls
Locate 1 , 1
Lcd " Please wait... "
Locate 2 , 1
Lcd ">CSMP=17,167,0,0"
Gosub Meno
'******************************************************************** Sub [Meno]
Meno:
Cls
Locate 1 , 1
Lcd " Please wait... "
Locate 2 , 1
Lcd "Setting up a SIM"
Wait 10
Print "AT+CMGD=4,4"
Sms = "" : Show = 1 : Led_data = 0
Do
''''''''''''''''''''''''''''''''''
If Ri = 0 Then
Waitms 200
If Ri = 1 Then Gosub Read_sms
If Ri = 0 And Mic = 1 Then
Led_data = 1
Wait 2
Print "ATA"
Wait 2
Print "AT+CMIC=0,15"
End If
End If
''''''''''''''''''''''''''''''''''
If Sms_low_power = 1 Then
Sms_low_power = 0
Sms = "Error >>> Charger Connection Failed!"
Gosub Data_sms
End If
If Sms_hi_power = 1 Then
Sms_hi_power = 0
Sms = "Ok >>> Charger Connected."
Gosub Data_sms
End If
''''''''''''''''''''''''''''''''''
If T1 = 0 And Error = 1 Then
T1 = 1 : T2 = 0
Sms = "Warning: Siren alarm was activated." + " >>> Zone1=" + Str(status_zone1)
Waitms 20
Sms = Sms + " / Zone2=" + Str(status_zone2)
Waitms 20
Sms = Sms + " / Zone3=" + Str(status_zone3)
Waitms 20
Sms = Sms + " / Zone4=" + Str(status_zone4)
Waitms 20
Gosub Output_call
End If
''''''''''''''''''''''''''''''''''
If T7 >= 129 And Mic = 1 Then
T7 = 0 : Mic = 0
Print "ATH"
Wait 3
Sms = "MIC [ OFF ]"
Gosub Data_sms
End If
Loop
Return
'**************************************************************** Sub [Read_sms]
Read_sms:
Show = 0 : Led_data = 1
Wait 2
Print "AT+CMGR=1"
Sms = "" : Data_in = "" : T = 0 : T3 = 0 : F0 = 1
Do
Var = Inkey()
Select Case Var
Case 0:
Case 13:
Case 10:
Case 34:
Incr T
If T = 8 Then F0 = 2
Case Else
Data_in = Chr(var)
If Data_in = "O" And T = 8 Then Exit Do
If Data_in = "o" And T = 8 Then Exit Do
If F0 = 2 Then
Sms = Sms + Chr(var)
End If
End Select
If T3 >= 3 Then Exit Do
Loop
F0 = 0 : T = 0 : T3 = 0
Data_sd = Mid(sms , 1 , 4)
Waitms 20
If Data_sd = "$$$$" And Len(sms) = 8 Then Gosub Run_mony
If Data_sd = "mic1" Or Data_sd = "Mic1" Or Data_sd = "MIC1" And Len(sms) = 8 Then Gosub Run
If Data_sd = "r1en" Or Data_sd = "R1en" Or Data_sd = "R1EN" And Len(sms) = 8 Then Gosub Run
If Data_sd = "r2en" Or Data_sd = "R2en" Or Data_sd = "R2EN" And Len(sms) = 8 Then Gosub Run
If Data_sd = "r3en" Or Data_sd = "R3en" Or Data_sd = "R3EN" And Len(sms) = 8 Then Gosub Run
If Data_sd = "r4en" Or Data_sd = "R4en" Or Data_sd = "R4EN" And Len(sms) = 8 Then Gosub Run
If Data_sd = "r5en" Or Data_sd = "R5en" Or Data_sd = "R5EN" And Len(sms) = 8 Then Gosub Run
If Data_sd = "r1ds" Or Data_sd = "R1ds" Or Data_sd = "R1DS" And Len(sms) = 8 Then Gosub Run
If Data_sd = "r2ds" Or Data_sd = "R2ds" Or Data_sd = "R2DS" And Len(sms) = 8 Then Gosub Run
If Data_sd = "r3ds" Or Data_sd = "R3ds" Or Data_sd = "R3DS" And Len(sms) = 8 Then Gosub Run
If Data_sd = "r4ds" Or Data_sd = "R4ds" Or Data_sd = "R4DS" And Len(sms) = 8 Then Gosub Run
If Data_sd = "r5ds" Or Data_sd = "R5ds" Or Data_sd = "R5DS" And Len(sms) = 8 Then Gosub Run
If Data_sd = "stat" Or Data_sd = "Stat" Or Data_sd = "STAT" And Len(sms) = 8 Then Gosub Run
If Data_sd = "rin0" Or Data_sd = "Rin0" Or Data_sd = "RIN0" And Len(sms) = 8 Then Gosub Run
If Data_sd = "rin1" Or Data_sd = "Rin1" Or Data_sd = "RIN1" And Len(sms) = 8 Then Gosub Run
If Data_sd = "temp" Or Data_sd = "Temp" Or Data_sd = "TEMP" And Len(sms) = 8 Then Gosub Run
If Data_sd = "tel1" Or Data_sd = "Tel1" Or Data_sd = "TEL1" And Len(sms) = 8 Then Gosub Edit_tell
If Data_sd = "tel2" Or Data_sd = "Tel2" Or Data_sd = "TEL2" And Len(sms) = 8 Then Gosub Edit_tell
If Data_sd = "tel3" Or Data_sd = "Tel3" Or Data_sd = "TEL3" And Len(sms) = 8 Then Gosub Edit_tell
If Data_sd = "tel4" Or Data_sd = "Tel4" Or Data_sd = "TEL4" And Len(sms) = 8 Then Gosub Edit_tell
If Data_sd = "tel1" Or Data_sd = "Tel1" Or Data_sd = "TEL1" And Len(sms) = 19 Then Gosub Edit_tell
If Data_sd = "tel2" Or Data_sd = "Tel2" Or Data_sd = "TEL2" And Len(sms) = 19 Then Gosub Edit_tell
If Data_sd = "tel3" Or Data_sd = "Tel3" Or Data_sd = "TEL3" And Len(sms) = 19 Then Gosub Edit_tell
If Data_sd = "tel4" Or Data_sd = "Tel4" Or Data_sd = "TEL4" And Len(sms) = 19 Then Gosub Edit_tell
If Data_sd = "pass" Or Data_sd = "Pass" Or Data_sd = "PASS" And Len(sms) = 12 Then Gosub Edit_password
If Data_sd = "char" Or Data_sd = "Char" Or Data_sd = "CHAR" And Len(sms) = 23 Then Gosub Run_charge
If Data_sd = "char" Or Data_sd = "Char" Or Data_sd = "CHAR" And Len(sms) = 24 Then Gosub Run_charge
Data_sd = Mid(sms , 1 , 2)
Waitms 20
If Data_sd = "dn" Or Data_sd = "DN" Or Data_sd = "Dn" And Len(sms) = 8 Then Gosub Edit_temp
If Data_sd = "up" Or Data_sd = "UP" Or Data_sd = "Up" And Len(sms) = 8 Then Gosub Edit_temp
Show = 1
Gosub Meno
Return
'*********************************************************** Sub [Edit_password]
Edit_password:
Show = 0
Code = "" : Data_eram = ""
Code = Mid(sms , 5 , 4)
Data_eram = Password
Waitms 10
If Code = Data_eram Then
Code = "" : Data_eram = ""
Code = Mid(sms , 9 , 4)
Password = Code
Waitms 10
'''''''''''''''''''''''''Start Show LCD
Cls
Locate 1 , 1
Lcd "OK>Edit Password"
Locate 2 , 1
Lcd "<electronics 98>"
'''''''''''''''''''''''''END Show LCD
Sms = "OK >>> New Password : " + Code
Gosub Data_sms
End If
Gosub Meno
Return
'**************************************************************** Sub [Run_look]
Run:
Show = 0
Code = "" : Data_eram = ""
Code = Mid(sms , 5 , 4)
Data_eram = Password
Waitms 10
If Code = Data_eram Then
Code = "" : Data_eram = ""


'**********************************************************************


If Data_sd = "mic1" Or Data_sd = "Mic1" Or Data_sd = "MIC1" Then
Cls
Locate 1 , 1
Lcd "OK>Mic On [120s]"
Locate 2 , 1
Lcd "<electronics 98>"
T7 = 0 : Mic = 1
Sms = "MIC [ ON ] For [ 120 s ]"
Gosub Data_sms
End If


'**********************************************************************


If Data_sd = "rin1" Or Data_sd = "Rin1" Or Data_sd = "RIN1" Then
Cls
Locate 1 , 1
Lcd "OK>Alarm System1"
Locate 2 , 1
Lcd "<electronics 98>"
Lock = 1
Sms = "Home Alarm System : [ ON ]"
Gosub Data_sms
End If


'**********************************************************************


If Data_sd = "rin0" Or Data_sd = "Rin0" Or Data_sd = "RIN0" Then
Cls
Locate 1 , 1
Lcd "OK>Alarm System0"
Locate 2 , 1
Lcd "<electronics 98>"
Unlock = 1
Sms = "Home Alarm System : [ OFF ]"
Gosub Data_sms
End If


'**********************************************************************


If Data_sd = "stat" Or Data_sd = "Stat" Or Data_sd = "STAT" Then
Cls
Locate 1 , 1
Lcd "OK>Status System"
Locate 2 , 1
Lcd "<electronics 98>"
Str_var = Str(alarm)
If Alarm = 2 Then
Str_var = "0"
End If
Sms = "Alarm:" + Str_var
Waitms 20
Code = Fusing(temp , "#.#")
Sms = Sms + "/Temp:" + Code + "C"
Waitms 20
Sms = Sms + "/Temp Down:" + Str(t_dn_flash) + "C"
Waitms 20
Sms = Sms + "/Temp up:" + Str(t_up_flash) + "C"
Waitms 20
Str_var = Str(status_rly1)
Sms = Sms + "/R1:" + Str_var
Waitms 20
Str_var = Str(status_rly2)
Sms = Sms + "/R2:" + Str_var
Waitms 20
Str_var = Str(status_rly3)
Sms = Sms + "/R3:" + Str_var
Waitms 20
Str_var = Str(status_rly4)
Sms = Sms + "/R4:" + Str_var
Waitms 20
Str_var = Str(status_rly5)
Sms = Sms + "/R5:" + Str_var
Waitms 20
Str_var = Str(status_rly6)
Sms = Sms + "/Relay Temp Down:" + Str_var
Waitms 20
Str_var = Str(status_rly7)
Sms = Sms + "/Relay Temp Up:" + Str_var
Waitms 20
Str_var = Str(status_rly8)
Sms = Sms + "/Relay Alarm:" + Str_var
Waitms 20
Sms = Sms + "/Z1=" + Str(status_zone1)
Waitms 20
Sms = Sms + "/Z2=" + Str(status_zone2)
Waitms 20
Sms = Sms + "/Z3=" + Str(status_zone3)
Waitms 20
Sms = Sms + "/Z4=" + Str(status_zone4)
Waitms 20
Gosub Data_sms
End If


'**********************************************************************


If Data_sd = "temp" Or Data_sd = "Temp" Or Data_sd = "TEMP" Then
Cls
Locate 1 , 1
Lcd "OK >>> Send Temp"
Locate 2 , 1
Lcd "<electronics 98>"
Code = Fusing(temp , "#.#")
Sms = "Temp : " + Code + " C"
Waitms 20
Sms = Sms + " | Temp Down : " + Str(t_dn_flash) + " C"
Waitms 20
Sms = Sms + " | Temp up : " + Str(t_up_flash) + " C"
Waitms 20
Str_var = Str(status_rly6)
Sms = Sms + " | Relay Temp Down : " + Str_var
Waitms 20
Str_var = Str(status_rly7)
Sms = Sms + " | Relay Temp Up : " + Str_var
Waitms 20
Gosub Data_sms
End If


'**********************************************************************


If Data_sd = "r1en" Or Data_sd = "R1en" Or Data_sd = "R1EN" Then
Cls
Locate 1 , 1
Lcd "OK > Rely [1] ON"
Locate 2 , 1
Lcd "<electronics 98>"
Status_rly1 = 1 : Rly1 = 1
Sms = "Status Relay1 : [ Active ]"
Gosub Data_sms
End If


'**********************************************************************


If Data_sd = "r2en" Or Data_sd = "R2en" Or Data_sd = "R2EN" Then
Cls
Locate 1 , 1
Lcd "OK > Rely [2] ON"
Locate 2 , 1
Lcd "<electronics 98>"
Status_rly2 = 1 : Rly2 = 1
Sms = "Status Relay2 : [ Active ]"
Gosub Data_sms
End If


'**********************************************************************


If Data_sd = "r3en" Or Data_sd = "R3en" Or Data_sd = "R3EN" Then
Cls
Locate 1 , 1
Lcd "OK > Rely [3] ON"
Locate 2 , 1
Lcd "<electronics 98>"
Status_rly3 = 1 : Rly3 = 1
Sms = "Status Relay3 : [ Active ]"
Gosub Data_sms
End If


'**********************************************************************


If Data_sd = "r4en" Or Data_sd = "R4en" Or Data_sd = "R4EN" Then
Cls
Locate 1 , 1
Lcd "OK > Rely [4] ON"
Locate 2 , 1
Lcd "<electronics 98>"
Status_rly4 = 1 : Rly4 = 1
Sms = "Status Relay4 : [ Active ]"
Gosub Data_sms
End If


'**********************************************************************


If Data_sd = "r5en" Or Data_sd = "R5en" Or Data_sd = "R5EN" Then
Cls
Locate 1 , 1
Lcd "OK > Rely [5] ON"
Locate 2 , 1
Lcd "<electronics 98>"
Status_rly5 = 1 : Rly5 = 1
Sms = "Status Relay5 : [ Active ]"
Gosub Data_sms
End If


'**********************************************************************


If Data_sd = "r1ds" Or Data_sd = "R1ds" Or Data_sd = "R1DS" Then
Cls
Locate 1 , 1
Lcd "OK >Rely [1] OFF"
Locate 2 , 1
Lcd "<electronics 98>"
Status_rly1 = 0 : Rly1 = 0
Sms = "Status Relay1 : [ Inactive ]"
Gosub Data_sms
End If


'**********************************************************************


If Data_sd = "r2ds" Or Data_sd = "R2ds" Or Data_sd = "R2DS" Then
Cls
Locate 1 , 1
Lcd "OK >Rely [2] OFF"
Locate 2 , 1
Lcd "<electronics 98>"
Status_rly2 = 0 : Rly2 = 0
Sms = "Status Relay2 : [ Inactive ]"
Gosub Data_sms
End If


'**********************************************************************


If Data_sd = "r3ds" Or Data_sd = "R3ds" Or Data_sd = "R3DS" Then
Cls
Locate 1 , 1
Lcd "OK >Rely [3] OFF"
Locate 2 , 1
Lcd "<electronics 98>"
Status_rly3 = 0 : Rly3 = 0
Sms = "Status Relay3 : [ Inactive ]"
Gosub Data_sms
End If


'**********************************************************************


If Data_sd = "r4ds" Or Data_sd = "R4ds" Or Data_sd = "R4DS" Then
Cls
Locate 1 , 1
Lcd "OK >Rely [4] OFF"
Locate 2 , 1
Lcd "<electronics 98>"
Status_rly4 = 0 : Rly4 = 0
Sms = "Status Relay4 : [ Inactive ]"
Gosub Data_sms
End If


'**********************************************************************


If Data_sd = "r5ds" Or Data_sd = "R5ds" Or Data_sd = "R5DS" Then
Cls
Locate 1 , 1
Lcd "OK >Rely [5] OFF"
Locate 2 , 1
Lcd "<electronics 98>"
Status_rly5 = 0 : Rly5 = 0
Sms = "Status Relay5 : [ Inactive ]"
Gosub Data_sms
End If


'**********************************************************************


End If
Gosub Meno
Return
'*************************************************************** Sub [Edit_tell]
Edit_tell:
Show = 0 : Code = "" : Data_eram = ""
Code = Mid(sms , 5 , 4)
Data_eram = Password
Waitms 10
If Code = Data_eram Then
Code = "" : Data_eram = ""
Code = Mid(sms , 9 , 11)
If Data_sd = "tel1" Or Data_sd = "Tel1" Or Data_sd = "TEL1" Then
'''''''''''''''''''''''''Start Show LCD
Cls
Locate 1 , 1
Lcd "OK >Edit Tell[1]"
Locate 2 , 1
Lcd "<electronics 98>"
'''''''''''''''''''''''''END Show LCD
Tell1 = Code
Waitms 10
Sms = "Phone [ 1 ] Number Saved : [ " + Code + " ]"
Gosub Data_sms
End If
If Data_sd = "tel2" Or Data_sd = "Tel2" Or Data_sd = "TEL2" Then
'''''''''''''''''''''''''Start Show LCD
Cls
Locate 1 , 1
Lcd "OK >Edit Tell[2]"
Locate 2 , 1
Lcd "<electronics 98>"
'''''''''''''''''''''''''END Show LCD
Tell2 = Code
Waitms 10
Sms = "Phone [ 2 ] Number Saved : [ " + Code + " ]"
Gosub Data_sms
End If
If Data_sd = "tel3" Or Data_sd = "Tel3" Or Data_sd = "TEL3" Then
'''''''''''''''''''''''''Start Show LCD
Cls
Locate 1 , 1
Lcd "OK >Edit Tell[3]"
Locate 2 , 1
Lcd "<electronics 98>"
'''''''''''''''''''''''''END Show LCD
Tell3 = Code
Waitms 10
Sms = "Phone [ 3 ] Number Saved : [ " + Code + " ]"
Gosub Data_sms
End If
If Data_sd = "tel4" Or Data_sd = "Tel4" Or Data_sd = "TEL4" Then
'''''''''''''''''''''''''Start Show LCD
Cls
Locate 1 , 1
Lcd "OK >Edit Tell[4]"
Locate 2 , 1
Lcd "<electronics 98>"
'''''''''''''''''''''''''END Show LCD
Tell4 = Code
Waitms 10
Sms = "Phone [ 4 ] Number Saved : [ " + Code + " ]"
Gosub Data_sms
End If
End If
Gosub Meno
Return
'*************************************************************** Sub [Edit_temp]
Edit_temp:
Show = 0
Code = "" : Data_eram = ""
Code = Mid(sms , 5 , 4)
Data_eram = Password
Waitms 10
If Code = Data_eram Then
Code = "" : Data_eram = ""
'//////////////////////////////////////////////////////////Edit Temp Up
If Data_sd = "up" Or Data_sd = "UP" Or Data_sd = "Up" Then
Code = Mid(sms , 3 , 2)
T_up_flash = Val(code)
T_up = T_up_flash
Waitms 10
'''''''''''''''''''''''''Start Show LCD
Cls
Locate 1 , 1
Lcd "OK> Edit Temp Up"
Locate 2 , 1
Lcd "<electronics 98>"
'''''''''''''''''''''''''END Show LCD
Sms = "OK >>> Temp Up : " + Str(t_up_flash) + " C "
Gosub Data_sms
End If
'//////////////////////////////////////////////////////////Edit Temp Down
If Data_sd = "dn" Or Data_sd = "DN" Or Data_sd = "Dn" Then
Code = Mid(sms , 3 , 2)
T_dn_flash = Val(code)
T_dn = T_dn_flash
Waitms 10
'''''''''''''''''''''''''Start Show LCD
Cls
Locate 1 , 1
Lcd "OK> Edit Temp Dn"
Locate 2 , 1
Lcd "<electronics 98>"
'''''''''''''''''''''''''END Show LCD
Sms = "OK >>> Temp Down : " + Str(t_dn_flash) + " C "
Gosub Data_sms
End If
End If
Gosub Meno
Return
'**************************************************************** Sub [Run_mony]
Run_mony:
Show = 0 : Code = "" : Data_eram = ""
Code = Mid(sms , 5 , 4)
Data_eram = Password
Waitms 10
If Code = Data_eram Then
'''''''''''''''''''''''''Start Show LCD
Cls
Locate 1 , 1
Lcd ">Balance Enquiry"
Locate 2 , 1
Lcd "<electronics 98>"
'''''''''''''''''''''''''END Show LCD
Code = "" : Data_eram = ""
Print "ATD*141*1#;"
Sms = "" : Data_in = "" : T3 = 0 : F0 = 1
Do
Var = Inkey()
Select Case Var
Case 0:
Case 13:
Case 10:
Case Else
Data_in = Chr(var)
If Data_in = "+" Then F0 = 2
If F0 = 2 Then
Sms = Sms + Chr(var)
End If
If Data_in = "." Then Exit Do
End Select
If T3 >= 10 Then Exit Do
Loop
F0 = 0 : T3 = 0
Gosub Data_sms
End If
Gosub Meno
Return
'************************************************************** Sub [Run_charge]
Run_charge:
Show = 0 : Code = "" : Data_eram = ""
Code = Mid(sms , 5 , 4)
Data_eram = Password
Waitms 10
If Code = Data_eram Then
'''''''''''''''''''''''''Start Show LCD
Cls
Locate 1 , 1
Lcd "OK >>> Recharge "
Locate 2 , 1
Lcd "<electronics 98>"
'''''''''''''''''''''''''END Show LCD
Code = "" : Data_eram = "#;"
Code = Mid(sms , 9 , 16)
Code = Code + Data_eram
Code_charge = "ATD*140*"
Code_charge = Code_charge + Code
Print Code_charge
Sms = "" : Data_in = "" : T3 = 0 : F0 = 1
Do
Var = Inkey()
Select Case Var
Case 0:
Case 13:
Case 10:
Case Else
Data_in = Chr(var)
If Data_in = "+" Then F0 = 2
If F0 = 2 Then
Sms = Sms + Chr(var)
End If
End Select
If T3 >= 10 Then Exit Do
Loop
F0 = 0 : T3 = 0
Gosub Data_sms
End If
Gosub Meno
Return
'**************************************************************** Sub [Data_sms]
Data_sms:
Var = 0 : Data_eram = "" : Code = ""
Incr T2
If T2 > 4 Then
T2 = 0 : Sms = ""
Gosub Meno
End If
If T2 = 1 Then
Code = Tell1
Waitms 10
Var = Asc(code)
If Var = 255 Or Code = "" Then Gosub Data_sms
End If
If T2 = 2 Then
Code = Tell2
Waitms 10
Var = Asc(code)
If Var = 255 Or Code = "" Then Gosub Data_sms
End If
If T2 = 3 Then
Code = Tell3
Waitms 10
Var = Asc(code)
If Var = 255 Or Code = "" Then Gosub Data_sms
End If
If T2 = 4 Then
Code = Tell4
Waitms 10
Var = Asc(code)
If Var = 255 Or Code = "" Then Gosub Data_sms
End If
Var = 0 : T2 = 5
Print "AT+CMGS=" ; Chr(34) ; Code ; Chr(34)
Wait 1
If Len(sms) < 100 Then
Sms = Sms + "/ www.electronics98.com"
Waitms 20
End If
Print Sms ; Chr(26)
Gosub Data_sms
Return
'************************************************************* Sub [Output_call]
Output_call:
Var = 0 : T8 = 0 : Data_eram = "" : Code = ""
Incr T2
If T2 > 12 Then
T1 = 1 : Error = 0 : T2 = 0 : T3 = 0
Gosub Data_sms
End If
If T2 = 1 Or T2 = 5 Or T2 = 9 Then
Code = Tell1
Waitms 10
Var = Asc(code)
If Var = 255 Or Code = "" Then
Gosub Output_call
End IF
End If
If T2 = 2 Or T2 = 6 Or T2 = 10 Then
Code = Tell2
Waitms 10
Var = Asc(code)
If Var = 255 Or Code = "" Then
Gosub Output_call
End IF
End If
If T2 = 3 Or T2 = 7 Or T2 = 11 Then
Code = Tell3
Waitms 10
Var = Asc(code)
If Var = 255 Or Code = "" Then
Gosub Output_call
End IF
End If
If T2 = 4 Or T2 = 8 Or T2 = 12 Then
Code = Tell4
Waitms 10
Var = Asc(code)
If Var = 255 Or Code = "" Then
Gosub Output_call
End IF
End If
Var = 0 : T8 = 1
Code = "ATD" + Code
Code = Code + ";"
Print Code
Wait 3
Do
Var = Inkey()
Data_in = Chr(var)
If Data_in = "D" Or Data_in = "d" Then
Waitms 50
Print "ATH"
Wait 2
T1 = 1 : Error = 0 : T2 = 0 : T8 = 0
Gosub Data_sms
End If
If T8 > 35 Then
Print "ATH"
Wait 2
T8 = 0
Gosub Output_call
End If
Loop
Gosub Output_call
Return
'******************************************************************* Sub [Clock]
Clock:
'>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>Charger
If Charger_status = 0 And Charger_key = 0 Then
Charger_key = 1 : Sms_low_power = 1
End If
If Charger_status = 1 And Charger_key = 1 Then
Charger_key = 0 : Sms_hi_power = 1
End If
'>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>Remot
If Remote_lock = 1 And Remot_key = 0 Then
Lock = 1 : Tik_lock = 0 : Remot_key = 1
End If
If Remote_unlock = 1 And Remot_key = 0 Then
Unlock = 1 : Tik_unlock = 0 : Remot_key = 1
End If
If Remote_start = 1 And Status_rly1 = 0 And Remot_key = 0 Then
Rly1 = 1 : Status_rly1 = 1 : Remot_key = 1
End If
If Remote_start = 1 And Status_rly1 = 1 And Remot_key = 0 Then
Rly1 = 0 : Status_rly1 = 0 : Remot_key = 1
End If
If Remote_siren = 1 And T_error = 0 And Remot_key = 0 Then
T_error = 1 : Rly8 = 1 : Remot_key = 1
End If
If Remote_siren = 1 And T_error > 0 And Remot_key = 0 Then
Time_sensor = 0 : T_error = 250 : Rly8 = 0 : Remot_key = 1
End If
If Remot_key = 1 And Remote_siren = 0 And Remote_start = 0 And Remote_unlock = 0 And Remote_lock = 0 Then
Remot_key = 0
End If
'>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>lock
If Lock = 1 Then
If T_error > 0 Then
T_error = 250 : Rly8 = 0 : Lock = 0
Else
Alarm = 1 : Rly8 = 1
Incr Tik_lock
If Tik_lock > 10 Then
Time_sensor = 0 : Rly8 = 0 : Lock = 0 : Tik_lock = 0
End If
End If
End If
'>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>unlock
If Unlock = 1 Then
If T_error > 0 Then
T_error = 250 : Rly8 = 0 : Unlock = 0 : Alarm = 0
End If
If T_error = 0 Then
If Tik_unlock = 0 Then Rly8 = 1
Incr Tik_unlock
If Tik_unlock = 5 Then Rly8 = 0
If Tik_unlock = 10 Then Rly8 = 1
If Tik_unlock > 15 Then
Alarm = 0 : Rly8 = 0 : Unlock = 0 : Tik_unlock = 0
End If
End If
End If
'>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ALARM
If Alarm = 1 And Time_sensor >= 30 Then
If Zone1 = 0 Or Zone2 = 0 Or Zone3 = 1 Or Zone4 = 1 Then
If Zone1 = 0 Then Status_zone1 = 1
If Zone1 = 1 Then Status_zone1 = 0
If Zone2 = 0 Then Status_zone2 = 1
If Zone2 = 1 Then Status_zone2 = 0
If Zone3 = 1 Then Status_zone3 = 1
If Zone3 = 0 Then Status_zone3 = 0
If Zone4 = 1 Then Status_zone4 = 1
If Zone4 = 0 Then Status_zone4 = 0
Error = 1 : T_error = 1 : Rly8 = 1
End If
End If
If Alarm = 0 Then
T1 = 0 : Error = 0 : T_error = 0 : Rly8 = 0 : Time_sensor = 0 : Alarm_status = 0
Status_zone1 = 0 : Status_zone2 = 0 : Status_zone3 = 0 : Status_zone4 = 0 : Alarm = 2
End If
'>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Sec
Incr Tik
If Tik >= 42 Then
Tik = 0
Gosub Clock_tik
End If
Return
'*************************************************************** Sub [Clock_tik]
Clock_tik:
'////////////////////////////////////////////////Start Time Sensor
If Alarm = 1 And Time_sensor < 30 Then
Incr Time_sensor
Alarm_status = 1
End If
If Alarm = 1 And Time_sensor >= 30 Then
Toggle Alarm_status
End If
'////////////////////////////////////////////////
If F0 <> 0 And T3 < 20 Then Incr T3
If F0 = 0 And T3 <> 0 Then T3 = 0
'>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> MIC
If Mic = 1 And T7 < 130 Then
Incr T7
End If
If Mic = 0 And T7 <> 0 Then
T7 = 0
End If
'>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Time Output End Call
If T8 > 0 And T8 < 40 Then
Incr T8
End If
'>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> TIME FOR ERROR
If T_error > 0 And T_error < 240 Then
Incr T_error
Rly8 = 1
End If
If T_error >= 240 Then
Time_sensor = 0 : T1 = 0 : Error = 0 : T_error = 0 : Rly8 = 0
Status_zone1 = 0 : Status_zone1 = 0 : Status_zone1 = 0 : Status_zone1 = 0
End If
'''''''''''''''''''''''''''''''''''''''''''''''''''''Temperature Measurement
Incr Time_lcd
If Time_lcd > 7 Then Time_lcd = 0
If Show = 1 Then
If Time_lcd = 0 Or Time_lcd = 1 Then
Cls
If Alarm = 2 Then
Locate 1 , 1
Lcd "> Alarm : [ 0 ] "
Else
Locate 1 , 1
Lcd "> Alarm : [ " ; Alarm ; " ] "
End If
Locate 2 , 1
Lcd "*electronics 98*"
End If
If Time_lcd = 2 Or Time_lcd = 3 Then
Din = Getadc(3)
Temp = Din / 2.04
Cls
Locate 1 , 1
Lcd "> Temp : " ; Fusing(temp , "#.#") ; " c "
Locate 2 , 1
Lcd "Up:" ; Fusing(t_up_flash , "#.#") ; "/Dn:" ; Fusing(t_dn_flash , "#.#")
If Temp <= T_dn_flash Then
Rly6 = 1 : Status_rly6 = 1
End If
If Temp > T_dn_flash Then
Rly6 = 0 : Status_rly6 = 0
End If
If Temp >= T_up_flash Then
Rly7 = 1 : Status_rly7 = 1
End If
If Temp < T_up_flash Then
Rly7 = 0 : Status_rly7 = 0
End If
End If
If Time_lcd = 4 Or Time_lcd = 5 Then
Status_rly1 = Rly1
Status_rly2 = Rly2
Status_rly3 = Rly3
Status_rly4 = Rly4
Cls
Locate 1 , 1
Lcd ">RLY1:" ; Status_rly1 ; " | RLY2:" ; Status_rly2 ;
Locate 2 , 1
Lcd ">RLY3:" ; Status_rly3 ; " | RLY4:" ; Status_rly4 ;
End If
If Time_lcd = 6 Or Time_lcd = 7 Then
Status_rly5 = Rly5
Status_rly6 = Rly6
Status_rly7 = Rly7
Status_rly8 = Rly8
Cls
Locate 1 , 1
Lcd ">RLY5:" ; Status_rly5 ; " | RLY6:" ; Status_rly6 ;
Locate 2 , 1
Lcd ">RLY7:" ; Status_rly7 ; " | RLY8:" ; Status_rly8 ;
End If
End If
Return
'------------------------------END PROGRAM--------------------------------------
'Farhad Akbari
'www.electronics98.com
[FONT=Yekan]'-------------------------------------------------------------------------------[/FONT]