CS-3G Digital Transceiver Kits (including the COM111 modem)
A-4
'Main Program
BeginProg
'Normal measurements in the main scan here
Scan (1,Sec,0,0)
PanelTemp (PTemp,250)
Battery (Batt_volt)
'......etc
NextScan
'-------------------------------------------------------------------
'Modem control slow sequence - can be cut and pasted as self-contained
'Set this constant to match the port the modem is connected to
Const Modemport=COMRS232
Const Modembaud = 115200 'Change to match modem baud rate
SlowSequence
'Run once a minute so can have one minute resolution of timing
Scan (1,Min,3,0)
'Every 12 hours, in this example and only if we are not communicating
If TimeIntoInterval (0,12,hr) Then
'Note that opening the serial port will automatically close any PPP session
SerialOpen (Modemport,Modembaud,0,0,100)
'First send the +++ sequence to get the modem in command mode
SerialOut (Modemport,"+++","OK"+CHR(13),1,150)
'Send the command to reset the modem the connection wait up to 5 sec
SerialOut (Modemport,"AT+CFUN=1"+CHR(13),"OK"+CHR(13),1,500)
Delay(1,20,sec) 'Wait another 20 sec just to make sure the reset is complete and
the modem has time to reconnect
SerialClose(Modemport) 'which will allow PPP to restart if enabled
EndIf
NextScan
'--------------------------------------------------------------------
EndProg