SerialClose (Close Communication Port)
The SerialClose function is used to close a communications port that was previously opened by the SerialOpen function.
Syntax
SerialClose ( ComPort )
In the following example, when flag 1 is toggled high
To test this program in the datalogger, wire
SequentialMode
Dim Str As STRING * 1000
Public InCom2 As String * 1000
Public Flag(5)
DataTable (SerialT,True,-1)
Sample (1,Str,String)
Sample (1,InCom2,String)
EndTable
BeginProg
Scan (5,Sec,3,0)
If Flag(1) Then
SerialOpen
(
SerialOpen
(
EndIf
If Flag(2) Then Str = "This is a test"
If Flag(3) Then Str = "Now is the time for all good men to come to the aid of
their country"
If Flag(4) Then Str = "Serial In Out Block Test"
If Flag(5) Then Str = "Last String"
SerialOut (
SerialIn
(InCom2,
CallTable (SerialT)
SerialClose (
SerialClose (
NextScan
EndProg
Remarks
This function returns True (-1) if the port was opened or False (0) if it was already closed.
Note that when executed, SerialClose will drop the DTR line on ComRS232.
Parameter
ComPort (Communication Port)
The communication port that will be used by the instruction.
| Alphanumeric | Description |
|---|---|
| ComUSB | USB port of the datalogger |
| ComRS232 | RS232 port of the datalogger |
| Com1 | Datalogger's control ports 1 (TX) & 2 (RX) |
| ComC1_Tx | Configures control port 1 for transmit only |
| ComC1_Rx | Configures control port 1 for receive only |
| ComC2_Tx | Configures control port 2 for transmit only |
| ComC2_Rx | Configures control port 2 for receive only |
| ComRF | Integrated RF communication |
Type: Constant. For all instructions except SerialOpen, this parameter can also be a variable.