INCOMM(ch)

Purpose

To return a single 8-bit binary data obtained from comm. channel ch.

ch - must be a numeric constant between 1 and 8. The actual target hardware determines the valid port #. This function returns -1 if there is no data waiting at serial port.

Note: INCOMM is now supported on all COMM ports of T100MD1616+ and T100MX+ families of PLCs.

Examples FOR I=1 to 100
DM[I] = INCOMM(2):
IF DM[I]<0 RETURN :ENDIF
NEXT
Comments: Usually the PLC buffers the serial data arriving at its COMM port so that the program does not need to continuously check the COMM port for data. When the program is ready to process the data it can use the FOR..NEXT loop shown in the above example to read in all the data in the COMM buffer until it encounters a -1, which indicates that the buffer is empty.
See Also OUTCOMM, INPUT$( ), PRINT #

  backbutton.gif (507 bytes)  Basic to TBASIC Reference Manual