NETCMD$ (ch, x$
Purpose

This function sends a multi-point host link command string specified in the x$ via serial port #ch to another F-Series, M-series or H-series PLC. It will then wait for a specified amount of time for a response string from the other PLC and this response string is then returned.

ch - This refer to the communication port #. Please refer to the target PLC for details.

x$ - contains a valid host link command in multi-point format, excluding the Frame Check Sequence (FCS) and the terminator characters (* and CR). NETCMD$ function will automatically compute the FCS and append to the end of x$ and together with the terminator characters will be sent to the other PLC via COMM #ch.

Note:
1) If the target PLC does not respond then this function returns an empty string.

2) This function checks the FCS of the response string, and if the FCS is wrong it indicates an error in the serial reception and it will return an empty string.

Examples A$ = NETCMD$(3, "@05RI00")
Comments: To read the Input channel #0 of the PLC with ID = 05 connected to COMM #3 of this PLC. The response string will be assigned to A$.

Special : If the last character of x$ is a "~" character, NETCMD$ will send out the string without the ‘~’ character, followed by a Carriage Return (&H0D). It will not append the FCS and ‘*’ to the outgoing string, it will also NOT check the response string for FCS. This allow NETCMD$ to be used to interface to third-party ASCII devices with different command/response formats. E.g. A$ = NETCMD$(3, "Hello World~"). The string "Hello World" will be sent out of serial COMM port #3. A$ will receive the full returned string without applying any FCS check on the return string.

See Also READMODBUS, WRITEMODBUS

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