A.4.2 dialmodem example (for cr1000) – Campbell Hausfeld COM220 User Manual

Page 22

Advertising
background image

Appendix A. Changing COM220 Settings


ModemCallBack(Result,ComSDC7,9600,0,"5551212","",40,60,Abort)
CallTable

Test5

NextScan
End Program

A.4.2 DialModem Example (for CR1000)

The program below does 2-minute callbacks via the COM220 configured for
SDC7. DialModem is set equal to a variable, so that the success/failure result
can be used by the EndDialSequence instruction. If the call fails, the link will
be terminated at the EndDialSequence instruction. If the call is successful, the
device will be kept on-line until the SendVariables command is completed.
Note, that for data callbacks to occur, callback enable must be selected in
LoggerNet Setup both for the comport and for the datalogger.

'Replace DialModem phone number with your PC's phone number

Public batt_volt, Result
Public PTemp, TCvalue_F, dummy
Public RespStrng, DialSuccess, AccumDialFails as LONG

DataTable (DC1,1,1000)
DataInterval (0,0,Sec,10)
Sample (1,PTemp,FP2)
Sample (1,TCvalue_F,FP2)
Sample (1,DialSuccess,FP2)
EndTable

DialSequence (4094)

'Establishes a phone connection if there isn't one already.

DialSuccess =DialModem (ComSDC7,-115200,"5551212","") ' " Param 2 baudrate setting affects
sdc bit rate." Param 4 allows OS to accept any listed modem response.

If DialSuccess = 0 then AccumDialFails = AccumDialFails + 1
EndDialSequence (DialSuccess)

‘ -1 = success, 0 = failure of response to match Param 4


BeginProg
Scan (2,Min,3,0)
PanelTemp (PTemp,250)
Battery (Batt_volt)
dummy = 0
TCDiff (TCvalue_F,1,mV2_5C,1,TypeT,PTemp,True ,0,250,1.8,32)
SendVariables (Result,ComSDC7,4094,4094,0000,3500,"Public","Callback",dummy,1)
'Establishes static route to LN
'35 sec timeout allows time to dial/train

CallTable

DC1


NextScan
EndProg

A-8

Advertising