I connected normally static IP with my program at our office, in the city - urban areas.
In our some stations, we can not connected with exactly same configurations and same program at suburban areas.
I checked modem with directly connected to the PC and I get the IP address after manual attemps at suburban areas.
How can I connect this station?
I attached only important section of the program.
Const GPRSDialString = ";;AT+CGDCONT=1,"+CHR(34)+"IP"+CHR(34)+","+CHR(34)+APN+CHR(34)+";;ATM0;ATX3;ATD*99***1#" 'enable this if using APN
Const AT_FactoryReset = "AT&F"+CHR(13)
Const AT_SetGPRSBaudrate = "AT+IPR="+GPRSBaudRate+CHR(13)
Const AT_HandshakeEnable = "AT\Q3"+CHR(13)
Const AT_CHAPDisable = "AT^SGAUTH=0"+CHR(13)
Const AT_SaveSettings = "AT&W"+CHR(13)
BeginProg
SetStatus("USRDriveSize",51700)
SetStatus("pppUsername",GPRSUserName)
SetStatus("pppPassword",GPRSPassword)
SetStatus("pppDial",GPRSDialString)
SetSecurity(SecurityLevel1,SecurityLevel2,SecurityLevel3)
Call init()
Call GoOnline()
'------------------------------------------------------------------------------------------------------------------------------------------------
Sub ModemAutoConfig_GPRS() 'SubRoutine to autoconfig GSM Modem
'------------------------------------------------------------------------------------------------------------------------------------------------
Call PortOpen(BaudRate)
SerialOut(COMRS232,AT_FactoryReset,CmdWaitString,CmdNumberOfTries,CmdEchoDelay )
Delay(1,ModemCmdDelay,msec)
SerialOut(COMRS232,AT_SetGPRSBaudRate,CmdWaitString,CmdNumberOfTries,CmdEchoDelay )
Delay(1,ModemCmdDelay,msec)
If Baudrate <> GPRSBaudRate Then
SerialFlush(COMRS232)
SerialClose(COMRS232)
SerialOpen(COMRS232,GPRSBaudrate,0,10,50)
EndIf
SerialOut(COMRS232,AT_HandshakeEnable,CmdWaitString,CmdNumberOfTries,CmdEchoDelay )
Delay(1,ModemCmdDelay,msec)
SerialOut(COMRS232,AT_CHAPDisable,CmdWaitString,CmdNumberOfTries,CmdEchoDelay )
Delay(1,ModemCmdDelay,msec)
SerialIn(TempString2,COMRS232,100,"K",10)
SerialOut(COMRS232,AT_SaveSettings,CmdWaitString,CmdNumberOfTries,CmdEchoDelay )
SerialClose(COMRS232)
BaudRate = GPRSBaudRate
EndSub
'------------------------------------------------------------------------------------------------------------------------------------------------
Sub GoOnline()'Establish GPRS Connection
'------------------------------------------------------------------------------------------------------------------------------------------------
ip_adress = PPPOpen() 'if there is already a PPP Connection, the ip is assigned
If StrComp(ip_adress,NoIp) = 0 Then 'if there is not a PPPConnection, init Modem and establish connection
PPPClose()
Delay(1,1,sec)
Call ModemOn() 'check baudrate
If ModemPresent = true Then
Delay(1,1,sec)
Call ModemAutoConfig_GPRS()
SetStatus("RS232Power",true)
ip_adress = PPPOpen()
GPRSReady = true
Else
PPPClose() 'if there is no modem connected, close PPP, so that we can use RS232 for direct connection
GPRSReady = false
ModemStatus = Off
ModemState = Off
EndIf
Else'There is already a PPP connection established, therefore Modem is on and present, we do not need to init modem again!
GPRSReady = true
ModemStatus = On
ModemState = On
ModemPresent = true
ModemResponse = true
BaudRate = 115200
EndIf
EndSub