SerialInChk (Number of Serial In Characters)

The SerialInChk function is used to return the number of characters available in the datalogger's serial buffer, which can be read by SerialIn or SerialInBlock.

Syntax

SerialInChk ( ComPort )

Remarks

A variable can hold the result of the SerialInChk function (variable = SerialInChk(Comport)) or the function can be used in an expression (If SerialInChk(Comport)>20 Then…). If the serial port has not been opened (using SerialOpen), a -1 is returned. If the serial port buffer overflows before it has been read, it is reset to 0 and the remainder of the bytes available is returned by the function. For instance, if you have a buffer of 100 bytes, and 120 bytes come in before the buffer is read, SerialInChk returns a value of 20 (the last 20 bytes received). In this instance, there is no way to detect that the buffer has overflowed and been reset.

Beginning with OS 13.0, SerialInChk() will flush the hardware buffer to the serial buffer immediately when the SerialInChk() fiunction is executed. Prior to the OS change, data may not appear in the serial port buffer until there is at least 50 ms of idle communication time. If the SerialIn instruction's TimeOut is set at too short of an interval, the instruction may time out even though data has been received in thehardware buffer (though not yet passed on to the serial port buffer). This should be taken into consideration when setting that instruction's TimeOut parameter.

This instruction can also be used along with other serial instructions to set up and control the SDM-SIO1A or SDM-SIO4A or SDM-SIO2R.

Parameter

ComPort_Serial_In (Communications Port Serial In)

The COM port that will be used by the instruction. Right-click to display a list.

Alphanumeric Description
ComRS232 RS232 port of the datalogger
ComUSB Datalogger's USB port
ComMe Datalogger's CS I/O port;modem enabled
Com310 Datalogger's CS I/O port; Com310 modem
Com320 Datalogger's CS I/O port; Com320 modem
ComSDC7 Datalogger's CS I/O port; SDC7
ComSDC8 Datalogger's CS I/O port; SDC8
ComSDC10 Datalogger's CS I/O port; SDC10
ComSDC11 Datalogger's CS I/O port; SDC11
ComC1 Datalogger's control ports 1 (TX) & 2 (RX)
ComC3 Datalogger's control ports 3 (TX) & 4 (RX)
ComU1 Universal terminal pair U1 (TX) & U2 (RX)
ComU3 Universal terminal pair U3 (TX) & U4 (RX)
ComU5 Universal terminal pair U5 (TX) & U6 (RX)
ComU7 Universal terminal pair U7 (TX) & U8 (RX)
ComU9 Universal terminal pair U9 (TX) & U10 (RX)
ComU11 Universal terminal pair U11 (TX) & U12 (RX)
ComRF Integrated RF communication

Type: Constant. For all instructions except SerialOpen, this parameter can also be a variable. However, if a variable is used, the port must be opened previously by SerialOpen (Open Communication Port)

A variable can be used in the ComPort parameter for use with functions that return a communication port. If communication occurs using TCP/IP, enter the variable for the socket returned by TCPOpen.