
Interfacing the MICROCOM DESIGN GTX Modulator to the Campbell Scientific CR1000 Data Logger PRELIMINARY
PASS THROUGH
MODE
The second serial port (COM4) on the CR1000 can be connected to the PC on another
COM port and to a terminal emulator to observe communications of, and talk to, the
GTX. The following code was written to implement the pass through operation.
' Program: GTXRand.cr1
' Description: GTX Passthrough Mode Attempt
'program author: R. Schwarz Microcom Design Incorporated
'program date: Original Code May 1, 2005
'
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Declare Public Variables'''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Public GTXInString as string * 1000
Public GTXOutString as string * 1000
Public DummyString as string * 10
Public CR as string * 1
Public LF as string * 1
Public CRLF as string * 2
Public SizeRead,Fred
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Main Program'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
BeginProg
' Use Com1 as an ECHO output port to view on Com1
SerialOpen (Com1,9600,0,0,1000)
' Setup Com4 serial port to GTX
SerialOpen (Com4,9600,0,0,1000)
' Setup Com4 serial port to GTX
SerialOpen (ComRS232,9600,0,0,1000)
CR=CHR(13)
LF=CHR(10)
CRLF=CHR(13)+CHR(10)
Do
GTXInString=""
SerialIn (GTXInString,Com4,1,10,100) 'read in from GTX
'SerialIn (DummyString,Com4,1,10,1) 'read in from GTX
if (GTXInString <> "") then
SerialOut (ComRS232, GTXInString+LF,"",0,0) 'send to PC Util
SerialOut (Com1, "G2C->"+GTXInString+CRLF,"",0,0)
SerialOut (Com1, CRLF,"",0,100)
endif
GTXOutString =""
SerialIn (GTXOutString,ComRs232,1,10,100) 'read in from PC util
if (GTXOutString <> "") then
SerialOut (Com4, GTXOutString,"",0,0)' send to GTX
SerialOut (Com1, "C2G->"+GTXOutString+CRLF,"",0,0)
SerialOut (Com1, CRLF,"",0,100)
endif
Loop
' Infinite loop to be executed every ten seconds
Scan (10,msec,0,0)
NextScan
EndProg
© 2005 Microcom Design Inc. All rights reserved voice: 401.771.1070 Fax:410.771.0018
uAPP222 (v1.0) July 12, 2005 http://www.microcomdesign.com 16
Comentários a estes Manuais