67
Serial Communications
Section 4-1
Example:
Consider a MCW151-E connected to the NT11S Programmable Terminal
using port 2 (RS-422A). The Host Link Slave can be configured by using the
following program:
‘ Define Host Link Slave node
HLS_NODE = 15
‘ Define Host Link Slave model code
HLS_MODEL = $FA
‘ Set up Host Link Slave for port 2
SETCOM(9600,7,2,2,2,5)
The MC Unit is now set up to communicate with the Programmable Terminal.
4-1-3
General-purpose
The MCW151 provide a set of commands to implement any user-defined pro-
tocol. The list of commands is provided here.
Refer to SECTION 6 BASIC Motion Control Programming Language for fur-
ther details on the commands.
Example:
Consider a MCW151-E connected to a general-purpose device using port 2
(RS-422A). The following problem will receive a series of data elements and
write it to VR variables:
‘ Set up General-purpose protocol for port 2
SETCOM(9600,7,2,2,2,0)
‘ Receive input
FOR i=0 to 99
INPUT#2, VR(i)
NEXT i
BASIC Command
Description
SETCOM
SETCOM configures the serial communication port,
including enabling the Host Link protocols.
GET
GET assigns the ASCII code of a received charac-
ter to a variable.
INPUT
INPUT will assign numerical input string values to
the specified variables.
KEY
KEY returns TRUE or FALSE depending on if a
character has been received.
LINPUT
LINPUT assigns the ASCII code of the characters to
an array of variables.
PRINT outputs a series of characters to a serial
port.