You are on page 1of 14

2

CHAPTER TWO

Communication

IN THIS CHAPTER
• Communication options (protocols, connections) ...........................................34
• Motion Planner™ communication features .....................................................34
• Communications Server...................................................................................35
• Serial Communication:
− Controlling multiple serial ports ................................................................41
− RS-232C daisy-chaining ............................................................................42
− RS-485 multi-drop .....................................................................................45
Communication Options

RS-232 (“COM1” port)


• Set up for use as the
primary RS-232 port;
configurable for RP240.
Ethernet Port

RS-232/485 (“COM2” port).


• Set up for use with an RP240;
configurable for RS-485 or as
the primary RS-232 port.

USING MULTIPLE PORTS


You can communicate to either the Ethernet port or the RS-232
port (COM1) at any give time; the port that you communicate to
first is the only one that is recognized until you cycle power.
You can communicate to the Ethernet port or the RS-232 port
(COM1) while the 6K is also communicating with an RP240 via
the RS-232/485 port (COM2).

Motion Planner Communication Features


Motion Planner provides easy direct communication links to the product:
• Communicate directly from any Motion Planner utility (Editor, Terminal, and Panels).
• Communication setup parameters (Ethernet and serial communication).
• Download the 6K product's soft operating system. The operating system is loaded at the
factory, but may use this feature to download upgrades.
• Download motion programs to the controller, and upload motion programs from the
controller.

Communications Server: Also available on the Motion Planner CD is a 32-bit OLE


automation server for adding 6K communication capability to your custom applications
created with programming languages such as Visual Basic or Visual C++.

34 6K Series Programmer’s Guide


Communications Server

The 6K Communications Server is an 32-bit OLE automation server which facilitates


communications between 6K controllers and PC software applications. It is compatible with
any 32-bit software application or programming environment which can utilize an OLE
automation component, including the Visual Basic, Visual C++, and Delphi.
To begin communications, an application simply needs to request a connection to a 6K
controller through the Communications Server. The Communications Server manages the
actual connection to each 6K controller, and can feed information from a particular controller
to all client applications which require the information.
Although the Communications Server only makes one connection to each 6K controller, it can
feed the information from that one connection to multiple client applications. This means, for
example, that a terminal application created in Visual Basic and a terminal in Motion Planner
can be connected to the same 6K at the same time. They will both receive the same responses
coming from the controller, instead of competing for the data. It is also possible for an
application to request multiple connections to multiple 6K units via the Communications
Server. Each connection can be either Ethernet or RS-232.
For RS-232 connections, you need to specify the PC COM port on which to connect. For
Ethernet connections, you need to specify the controller’s IP address. Each controller is set
with a default IP address (192.168.10.30), but it may be necessary to change the address
(using the NTADDR command) if there is an address conflict with other devices on the
network.
The syntax for requesting a connection to the Communications Server varies depending on the
programming environment being used. Following are some examples in a variety of
programming formats.

Visual Basic 'create an object variable, initialize it to an


Example 'Ethernet interface and make a connection
Dim commserver As Object
Set commserver = CreateObject("COM6SRVR.NET")
commserver.Connect("192.168.10.30")
'-----------------------------------------------
'create an object variable, initialize it to a
'RS-232 interface and make a connection to PC COM1
Dim MyMachine As Object
Set MyMachine = CreateObject("COM6SRVR.RS232")
MyMachine.Connect(1)

Note: When using VBScript, the syntax is identical to the example above except that the
variable declaration should omit the “As Object” keywords.

Visual C++ /* create an object variable, initialize it to an


Example Ethernet interface and make a connection */
Inet commserver;
commserver.CreateDispatch ("COM6SRVR.NET");
commserver.Connect("172.20.34.145");
/*==============================================*/
/* create an object variable, initialize it to a
RS-232 interface and make a connection to COM2 */
IRS232 MyMachine;
MyMachine.CreateDispatch ("COM6SRVR.RS232");
MyMachine.Connect(2);

Once the proper object variable has been created and a connection is established, there is a
standard set of methods and properties which the client application(s) can access. Below are
descriptions of the methods and properties available via the RS-232 and Ethernet interfaces.

Chapter 2. Communication 35
Using the Communications Server with RS-232

NOTE
This section covers RS-232 methods, there are no RS-232 properties for the
Communications Server.

Connect ( port ) The Connect method, opens a connection to a 6K controller. The integer port argument
represents the PC COM port numbers (1 - 4). The method returns a TRUE value if the
connection is successfully opened, otherwise a FALSE value is returned.

Disconnect ( ) The Disconnect method closes a previously opened connection. There are no arguments for this
method and no return value.

GetFile ( filename ) The GetFile method is used to upload programs currently stored in the controller. The filename
argument represents the name of the file to store the uploaded program. If the filename is an
empty string then the user will be prompted for the filename. The method returns a zero if the
operation is successful or an error code otherwise.

LoadOS ( ) The LoadOS method, downloads the soft operating system to a 6K controller. There are no
arguments for this method. The user will be prompted for the operating system file. The
method returns a TRUE value if the operation is successful, otherwise a FALSE value is
returned.

Read ( ) The Read method, retrieves command responses from the controller. There are no arguments
for this method. The read method does not wait for incoming responses from the controller. It
returns immediately with a string containing the controller’s response at the time of the request.
If no response is available, this method will return NULL string.

SendFile ( filename ) The SendFile method is used to download program files to the controller. The filename
argument represents the name of the program file to be downloaded. If the filename is an
empty string, then the user will be prompted for the filename. The method returns a zero if the
operation is successful or an error code otherwise.

UploadOS ( ) The UploadOS method is used to retrieve the soft operating system from the controller. There
are no arguments for this method. You will be prompted to store the operating system to a file.
The method returns a TRUE value if the operation is successful, otherwise a FALSE value is
returned.

Write ( cmd ) The Write method is used to send commands to the controller. cmd is a string of commands to
be sent. Multiple commands can be sent, but each command should be separated with a valid
6K command delimiter (colon, carriage return, line feed). The command string should be
limited to 1024 characters or less. Excessively large command strings, may cause an overflow
in the 6K’s command buffer. It returns the number of bytes sent.

36 6K Series Programmer’s Guide


Using the Communications Server with Ethernet

Ethernet Methods

Connect ( ipaddr ) The Connect method, opens a connection to a 6K controller. The ipaddr argument is a string
representing the target controller’s IP address. The method returns a TRUE value if the
connection is successfully opened, otherwise a FALSE value is returned.

Disconnect ( ) The Disconnect method, closes a previously opened connection. There are no arguments for
this method and no return value.

GetFile ( filename ) The GetFile method is used to upload programs current stored in he controller. The filename
argument represents the name of the file to store the uploaded program. If the filename is an
empty string then the user will be prompted for the filename. The method returns a zero if the
operation is successful or an error code otherwise.

Read ( ) The Read method, retrieves command responses from the controller. There are no arguments
for this method. The read method does not wait for incoming responses from the controller. It
returns immediately with a string containing the controller’s response at the time of the request.
If no response is available, this method will return NULL string.

SendFile ( filename ) The SendFile method is used to download program files to the controller. The filename
argument represents the name of the program file to be downloaded. If the filename is an
empty string then the user will be prompted for the filename. The method returns a zero if the
operation is successful or an error code otherwise.

Write ( cmd ) The Write method is used to send commands to the controller. cmd is a string of commands to
be sent. Multiple commands can be sent, but each command should be separated with a valid
6K command delimiter (colon, CR, LF). The command string should be limited to 1024
characters or less. Excessively large command strings, may cause an overflow in the 6K’s
command buffer.

Chapter 2. Communication 37
Ethernet Properties Bit Status Convention
When retrieving bit-oriented properties (e.g., AxisStatus, ErrorStatus, Limits, SystemStatus,
etc.) note that the convention in the 6K programming language differs from the convention
used for C and Assembly programming languages. Compumotor’s 6K convention is to refer
to the bits within a 32 bit long integer as bits 1 through 32 (left to right). The C and Assembler
Programmer's convention refers to these as bits 0 through 31 (right to left). When masking
these bits, you should be aware of this subtle difference when referring to 6K documentation.

AlarmStatus ( bit ) The AlarmStatus property returns the state of the controller’s alarm status. The integer bit
argument specifies the status bit of the alarm status to return. It can be a number between 0 and
32. Values between 1-32 represent the alarm bits as described in the table below (refer also to
the INTHW command). Specifying a bit value of 0 returns the entire 32 bit alarms status as a
long value; otherwise a value of 1 or 0 is returned to indicate the state of any single bit. When
any single bit status is retrieved using the AlarmStatus property, that bit status is automatically
cleared by the Communications Server. If a bit value of 0 is used then all alarm status bits are
cleared.

Bit # Function ** Bit # Function


1 Software (forced) Alarm #1 17 Reserved
2 Software (forced) Alarm #2 18 Reserved
3 Software (forced) Alarm #3 19 Limit Hit - hard or soft limit, on any axis
4 Software (forced) Alarm #4 20 Stall Detected (stepper)
5 Software (forced) Alarm #5 or Position Error (servo) on any axis
6 Software (forced) Alarm #6 21 Timer (TIMINT)
7 Software (forced) Alarm #7 22 Reserved
8 Software (forced) Alarm #8 23 Input - any of the inputs defined by
9 Software (forced) Alarm #9 INFNCi-I or LIMFNCi-I
10 Software (forced) Alarm #10 24 Command Error
11 Software (forced) Alarm #11 25 Motion Complete on Axis 1
12 Software (forced) Alarm #12 26 Motion Complete on Axis 2
13 Command Buffer Full 27 Motion Complete on Axis 3
14 ENABLE input Activated 28 Motion Complete on Axis 4
15 Program Complete 29 Motion Complete on Axis 5
16 Drive Fault on any Axis 30 Motion Complete on Axis 6
31 Motion Complete on Axis 7
32 Motion Complete on Axis 8

** Bits 1-12: software alarms are forced with the INTSW command.

AnalogInput ( channel ) The AnalogInput property returns the specified analog input value (in counts). The channel
argument specifies the analog input channel value to return (1 or 2).

AxisStatus ( axis ) The AxisStatus property returns a long value representing the current axis status for the
specified axis. The axis argument can be a number from 1 to 8.

CommandCount The CommandCount property, returns a long value representing the number of 6000 commands
which have been executed outside of defined programs, since the 6K controller was powered
up. This property is intended to allow users to track when commands being sent to the
controller via the communications ports have been executed. The value is reset to zero each
time power is cycled on the 6K.

Counter ( axis ) The Counter property returns an integer value representing the current Time Frame Counter
value. The Time Frame Counter is a free running timer in the controller.

38 6K Series Programmer’s Guide


EncoderPos ( axis ) The EncoderPos property returns a long value representing the current encoder position (TPE)
in counts for the specified axis. The axis argument can be a number from 1 to 8.

ErrorStatus The ErrorStatus property returns a long value representing the current error status (TER) of
task 0.

FastStatus The FastStatus property returns a variant which represents the value of the entire FastStatus
data structure. This property allows for faster more efficient retrieval of the FastStatus
information if multiple FastStatus items need to be checked at once. The variant is essentially a
byte array which can be mapped into a FastStatus structure (see table below for FastStatus
structure).

Packet Data Definition (280 bytes total)


Type Description Bytes
WORD wUpdateID Unique update ID for synch channel 2
WORD wCounter Time Frame Counter 2
DWORD dwMotorPos[8] Commanded Position (TPC) 32
DWORD dwEncPos[8] Encoder Position (TPE) 32
DWORD dwMotorVel[8] Commanded Velocity (TVEL) 32
DWORD dwAxisStatus[8] Axis Status (TAS) 32
DWORD dwSystemStatus System Status (TSS) 4
DWORD dwErrorStatus Error Status (TER) 4
DWORD dwUserStatus User Status (TUS) 4
DWORD dwTimer Timer (TTIM) 4
DWORD dwLimits Limit Status (TLIM) 4
DWORD dwInputs[4] Input Status (TIN) 16
DWORD dwOutputs[4] Output Status (TOUT) 16
DWORD dwTriggers Trigger Status (TTRIG) 4
WORD wAnalogIn[2] Analog Input Value (TANI - in counts) 4
DWORD dwVarb[10] Binary Variable Values (VARB1 through VARB10) 40
DWORD dwVari[10] Integer Variable Values (VARI1 through VARI10) 40
DWORD dwIPAddress IP Address (NTADDR) 4
DWORD dwCmdCount Command Count 4

FSEnabled The FSEnabled property is a read/write property that sets or returns the state of FastStatus
polling. If this property is set to TRUE, then FastStatus information is automatically retrieved
from the controller on a continual basis. If this property is set to FALSE then automatic
FastStatus polling is turned off and the FastStatus information is updated only once at the time
when the property is set. Enabling automatic FastStatus polling provides fresh data from the
controller on a continual basis, but this will impair the controller’s processing time. Disabling
FastStatus polling provides a means of getting fresh information at a specific point in time
without impairing the controller’s command processing or communications processing abilities.
NOTE: The FSEnabled property must be enabled to receive valid data from these properties:
AnalogInput, AxisStatus, CommandCount, Counter, EncoderPos, ErrorStatus, FastStatus,
Inputs, IPAddress, Limits, MotorPos, MotorVel, Outputs, SystemStatus, Timer, Triggers,
UserStatus, VarB and VarI.

FSUpdateRate The FSUpdateRate property is used to set the millisecond interval on which the controller
automatically updates its FastStatus information. This property should be set before, the
FSEnabled property is set to TRUE. Setting a larger value for this property means that
information will be update less frequently, thereby consuming less of the controller’s
processing resources. A small value will provide for more frequent updates, but consume more
processing time. Valid values for this property are from 10 to 65536.

Inputs ( brick ) The Inputs property returns a long value representing the current state of the inputs for the
specified brick. The brick argument can be a number from 0 to 3. Brick 0 represents the
onboard inputs. Brick 1-3 represent expanded I/O input bricks 1-3.

Chapter 2. Communication 39
IPAddress The IPAddress property returns long value representing controllers IP Address (NTADDR).

Limits The Limits property returns a long value representing the current limit status (TLIM).

MotorPos ( axis ) The MotorPos property returns a long value representing the current commanded position
(TPC) in counts for the specified axis. The axis argument can be a number from 1 to 8.

MotorVel ( axis ) The MotorVel property, returns a long value representing the current motor velocity (TVEL) in
counts/sec for the specified axis. The axis argument can be a number from 1 to 8.

Outputs ( brick ) The Outputs property, returns a long value representing the current state of the outputs for the
specified brick. The brick argument can be a number from 0 to 3. Brick 0 represents the
onboard outputs. Brick 1-3 represent expanded I/O input bricks 1-3.

Status The Status property indicates the status of the Ethernet connection:
0......... Closed
1......... Open
2......... Listening
3......... Connection Pending
4......... Resolving Host
5......... Host Resolved
6......... Connecting
7......... Connected
8......... Closing
9......... Error

While the Connect method and the Disconnect method are under program control, the
connection could be lost/broken (e.g., disconnected Ethernet cable or a network failure). If the
connection is lost/broken, the Status property will be change.

SystemStatus The SystemStatus property returns a long value representing the system status (SS) for task 0.

Timer The Timer property returns a long value representing the current limit Timer value (TTIM) for
task 0.

Triggers The Triggers property returns a long value representing the current state of the on board
triggers.

UserStatus The UserStatus property returns a long value representing the current state of the user status
(TUS).

VarB ( n ) The VarB property, returns a long value representing the value of the specified binary variable
(VARB). The integer argument, n, can be a number from 1 to 10

VarI ( n ) The VarI property, returns a long value representing the value of the specified integer variable
(VARI). The integer argument, n, can be a number from 1 to 10.

40 6K Series Programmer’s Guide


Serial Communication

In this section:
• Controlling Multiple Serial Ports
• RS-232 Daisy Chaining
• RS-485 Multi-Drop

Controlling Multiple Serial Ports


Every 6K Series product has two serial ports. The “RS-232” connector is referenced as the
“COM1” serial port, and the “RS-232/485” connector is referenced as the “COM2” serial port.

XON/XOFF
The XONOFF command was created to enable or disable XON/XOFF ASCII handshaking.
(XONOFF1 enables XON/XOFF, XONOFFØ disables XON/XOFF) Defaults: XONOFF1 for the
COM1 port, XONOFFØ for the COM2 port.
Controllers on a multi-drop do not support XON/XOFF; to ensure that XON/XOFF is
disabled for COM2, send the PORT2 command followed by the XONOFFØ command.

Configuring the To control the applicable port for setting up serial communication and transmitting ASCII text
COM Port strings, use the PORT command. PORT1 selects COM1 and PORT2 selects COM2.
• Serial communication setup commands (see list below) affect the COM port selected
with the last PORT command. For example, to configure the COM2 port for 6K
language commands only (e.g., to communicate to the 6K product over an RS-485
interface), execute the PORT2 command, then execute the DRPCHKØ command.
DRPCHK ........ RP240 Check
E.................... Enable Serial Communication
ECHO............. Enable Communication Echo
BOT ............... Beginning of Transmission Characters
BAUD............. Serial Communication Baud Rate
EOT ............... End of Transmission Characters
EOL ............... End of Line Terminating Characters
ERRBAD ........ Error Prompt
ERRDEF ........ Program Definition Prompt
ERRLVL ........ Error Detection Level
ERRORK ........ Good Prompt
XONOFF ........ Enable or disable XON/XOFF

• The PORT command also selects the COM port through which the WRITE and READ
commands transmit ASCII text strings. If an RP240 is connected, the DWRITE
command (and all other RP240 commands) will affect the RP240 regardless of the
PORT command setting. If no RP240 is detected, the commands are sent to the COM2
port. DWRITE text strings are always terminated with a carriage return.

Chapter 2. Communication 41
Setup for 6K To configure the COM ports for use with 6K language commands or an RP240, use the
Language or RP240 DRPCHK command. The DRPCHK command affects the COM port selected with the last PORT
command. The default for COM1 is DRPCHKØ; the default for COM2 is DRPCHK3. The
DRPCHK setting is automatically saved in non-volatile memory. NOTE: Only one COM port
may be set to DRPCHK2 or DRPCHK3 at any given time.
DRPCHKØ...... Use the COM port for 6K language commands only. This is the default
setting for COM1, and if using RS-485 half duplex on COM2. Power-up
messages appear on all ports set to DRPCHKØ.
DRPCHK1...... Check for the presence of an RP240 at power-up/reset. If an RP240 is
present, initialize the RP240. If an RP240 is not present, use the port only
for 6K language commands. NOTE: RP240 commands will be sent at
power-up and reset.
DRPCHK2...... Check for the presence of an RP240 every 5-6 seconds. If an RP240 is
plugged in, initialize the RP240.
DRPCHK3...... Check for the presence of an RP240 at power-up/reset. If an RP240 is
present, the initialize the RP240. If an RP240 is not present, use the COM
port for DWRITE commands only, and ignore received characters. This is
the default setting for COM2, unless you are using RS-485 multi-drop
communication (in which case the default changes to DRPCHKØ).

RS-485 compatible products: If you are using RS-485 communication in a multi-drop


(requires you to change an internal jumper to select half duplex), the default setting for COM2
is DRPCHKØ. If the internal jumper setting is left at full duplex, the default setting for COM2
is DRPCHK3.

Selecting a To define the port (COM port) through which the 6K product sends its responses, you have 3
Destination Port for options:
Transmitting from
the Controller • Do nothing different. The response will be sent to the COM port through which the
request was made. If the command is in a stored program, the report will be sent to the
COM port selected by the most recent PORT command.
• Prefix the command with [. This causes the response to be sent to both COM ports.
(e.g., the [TFS command response will be sent through both COM ports)
• Prefix the command with ]. This causes the response to be sent to the alternative COM
port. For example, if a report back (e.g., ]TAS) is requested from COM1, the response
is sent through COM2. If the command is in a stored program, the report will be sent
out the alternate port from the one selected by the most recent PORT command.

RS-232C Daisy-Chaining
Up to ninety-nine stand-alone 6K Series products may be daisy-chained. There are two
methods of daisy-chaining: one uses a computer or terminal as the controller in the chain; the
other uses one 6K product as the master controller. Refer to you product’s Installation Guide
for daisy-chain connections.
Follow these steps to implement daisy-chaining:
Step 1 To enable and disable communications on a particular controller unit in the chain, you must use
the Daisy-Chain Address (ADDR) command to establish a unique device address for each the
unit. The ADDR command automatically configures unit addresses for daisy chaining. This
command allows up to 99 units on a daisy chain to be uniquely addressed.
Sending ADDRi to the first unit in the daisy chain sets its address to be (i). The first unit in turn
transmits ADDR(i + 1) to the next unit to set its address to (i + 1). This continues down the
daisy chain until the last unit of (n) daisy-chained units has its address set to (i + n).
Note that a controller with the default device address of zero (0) will send an initial power-up

42 6K Series Programmer’s Guide


start message similar to the following:
*PARKER 6K MOTION CONTROLLER
*NO REMOTE PANEL

Step 2 Connect the daisy-chain with a terminal as the master (see diagram in the product’s Installation
Guide).
It is necessary to have the error level set to 1 for all units on the daisy-chain (ERRLVL1).
When the error level is not set to 1, the controller sends ERROK or ERRBAD prompts after
each command, which makes daisy-chaining impossible. Send the ERRLVL1 command to
each unit in the chain. (NOTE: To send a the ERRLVL1 command to one specific unit on the
chain, prefix the command with the appropriate unit's device address and an underline.)
Commands:
1_ERRLVL1 ; Set error level to 1 for unit #1
2_ERRLVL1 ; Set error level to 1 for unit #2
3_ERRLVL1 ; Set error level to 1 for unit #3

After this has been accomplished, a carriage return sent from the terminal will not cause any
controller to send a prompt. Verify this. Instructions below (step 3) show how to set the error
level to 1 automatically on power-up by using the controller's power-up start program (highly
recommended).
After the error level for all units has been set to ERRLVL1, send a 6K series command to all
units on the daisy-chain by entering that command from the master terminal.
Commands:
OUT1111 ; Turn on onboard outputs 1-4 on all units
A50,50 ; Set accel to 50 (all units, axes 1 & 2)

To send a 6K series command to one particular unit on the chain, prefix the command with the
appropriate unit's device address and an underline:
Commands:
2_OUT0 ; Turn off onboard output 1 on unit #2
4_OUT0 ; Turn off onboard output 1 on unit #4

To receive data from a particular controller on the chain, you must prefix the command with
the appropriate unit's device address and an underline:
Commands:
1_A ; Request acceleration information from unit #1
*A50,50 ; Response from unit #1

Use the E command to enable/disable RS-232C communications for an individual unit. If all
6K controller units on the daisy chain are enabled, commands without a device address
identifier will be executed by all units. Because of the daisy-chain's serial nature, the
commands will be executed approximately 1 ms per character later on each successive unit in
the chain (assuming 9600 baud).
Units with the RS-232C disabled (EØ) will not respond to any commands, except E1;
however, characters are still echoed to the next device in the daisy chain.
Commands:
3_E0 ; Disable RS-232C on unit #3
VAR1=1 ; Set variable #1 to 1 on all other units
3_E1 ; Enable RS-232C on unit #3
3_VAR1=5 ; Set variable #1 to 5 on unit #3

Verify communication to all units by using the techniques described above.

Step 3 Now that communication is established, programming of the units can begin (alternatively,
units can be programmed individually by connecting the master terminal to one unit at a time).
To allow daisy-chaining between multiple controllers, the ERRLVL1 command must be used to
prevent units from sending error messages and command prompts. In every daisy-chained unit,

Chapter 2. Communication 43
the ERRLVL1 command should be placed in the program that is defined as the STARTP
program:
Program:
DEF chain ; Begin definition of program chain
ERRLVL1 ; Set error level to 1
GOTO main ; Go to program main
END ; End definition of program chain
STARTP chain ; Designates program chain as the power-up program
To define program main for unit #0:
Program:
0_DEF main ; Begin definition of program main on unit #0
0_GO ; Start motion
0_END ; End definition of program main on unit #0

Step 4 After all programming is completed, program execution may be controlled by either a master
terminal, or by a 6K Series controller used as a master.

Daisy-Chaining Controlling the daisy-chain from a master computer or terminal follows the examples above:
from a Computer or
Commands:
Terminal 0_RUN main ; Run program main on unit #0
1_RUN main ; Run program main on unit #1
2_GO1 ; Start motion on unit #2 axis #1
3_2A ; Get A command response from unit #3 axis #2

Daisy-Chaining Controlling the daisy-chain from a master 6K controller (the first unit on the daisy-chain)
from a Master 6K requires the programs stored in the master controller to control program and command
Controller execution on the slave controllers. The example below demonstrates the use of the WRITE
command to send commands to other units on the daisy chain.

NOTE
The last unit on the daisy-chain must have RS-232C echo disabled (ECHOØ command).

Master controller's main program:


Program:
DEF main ; Program main
L ; Indefinite loop
WHILE (IN.1 = b0) ; Wait for input #1 to go active
NWHILE
GOL ; Initiate linear interpolated move
WHILE (IN.1 = b1) ; Wait for input #1 to go inactive
NWHILE
WRITE"2_D2000,4000" ; Send message "2_D2000,4000" down daisy chain
WRITE"2_ACK" ; Send message "2_ACK" down the daisy chain
LN ; End of loop
END ; End of program main

Controller unit #2 ack program:


Program:
DEF ack ; Program ack
GO11 ; Start motion on both axes
END ; End of program ack

44 6K Series Programmer’s Guide


Daisy-Chaining and RP240s
RP240s cannot be placed in the controller daisy chain; RP240s can only be connected to the
designated RP240 port on a controller. It is possible to use only one RP240 with a controller
daisy-chain to input data for multiple units on the chain. The example below (for the
controller master with an RP240 connected) reads data from the RP240 into variables #1
(data1) & #2 (data2), then sends the messages 3_Ddata1,data2<CR> and 3_GO<CR>.
Sample portion of code:
L ; Indefinite loop
VAR1=DREAD ; Read RP240 data into variable #1
VAR2=DREAD ; Read RP240 data into variable #2
EOT0,0,0,0 ; Turn off <CR>
WRITE"3_D" ; Send message "3_D" down the daisy chain
WRVAR1 ; Send variable #1 data down the daisy chain
WRITE"," ; Send message "," down the daisy chain
EOT13,0,0,0 ; Turn on <CR>
WRVAR2 ; Send variable #2 data down the daisy chain
WRITE"3_GO" ; Send message "3_GO" down the daisy chain
LN ; End of loop

RS-485 Multi-Drop
Up to 99 6K Series products may be multi-dropped. Refer to your product's Installation
Guide for multi-drop connections.
To establish device addresses, using the ADDR command:
The ADDR command allows you to establish up to 99 unique addresses. To use the ADDR
command, you must address each unit individually before it is connected on the multi
drop. For example, given that each product is shipped configured with address zero, you
could set up a 4-unit multi-drop with the commands below, and then connect them in a
multi drop:
1. Connect the unit that is to be unit #1 and transmit the Ø_ADDR1 command to it.
2. Connect the unit that is to be unit #2 and transmit the Ø_ADDR2 command to it.
3. Connect the unit that is to be unit #3 and transmit the Ø_ADDR3 command to it.
4. Connect the unit that is to be unit #4 and transmit the Ø_ADDR4 command to it.

If you need to replace a unit in the multi drop, send the Ø_ADDRi command to it, where
"i" is the address you wish the new unit to have.

To send a 6K command from the master unit to a specific unit in the multi-drop, prefix the
command with the unit address and an underscore (e.g., 3_OUTØ turns off output #1 on unit
#3). The master unit (if it is not a 6K product) may receive data from a multi-drop unit.

The ECHO command was enhanced with options 2 and 3. The purpose is to accommodate an
RS-485 multi-drop configuration in which a host computer communicates to the “master” 6K
controller over RS-232 (COM1 port) and the master 6K controller communicates over RS-485
(COM2 port) to the rest of the units on the multi-drop. For this configuration, the echo setup
should be configured by sending to the master the following commands executed in the order
shown. In this example, it is assumed that the master's device address is set to 1. Hence, each
command is prefixed with “1_” to address only the master unit.

Chapter 2. Communication 45
1_PORT2............Subsequent command affects COM2, the RS-485 port
1_ECHO2............Echo characters back through the other port, COM1
1_PORT1............Subsequent command affects COM1, the RS-232 port
1_ECHO3............Echo characters back through both ports, COM1 and COM2

NOTE
Controllers on a multi-drop do not support XON/XOFF. To ensure that XON/XOFF is disabled
for COM2, send the PORT2 command followed by the XONOFFØ command.

46 6K Series Programmer’s Guide

You might also like