Introduction
To use the software block you need to use CX-Programmer 5.0 or CX-One.
Importing a Function Block in CX-Programmer
Right click on "Function Blocks"
From the context menu, select "Insert Block function" and then select the option "From
file ... "
Navigate to the folder in which they were copied and select the function block "Sysway_master_cj_cs_232.cxf". |
Configuring the RS232 port on the PLC Master
The serial port configuration is done through the settings editor of the PLC. Double-click on the "Settings". |
In the settings of the PLC, select "Port Host Link" After setting the parameters select the configuration under "Transfer to PLC from the options menu. The PLC must be in "Program". |
Parameter Descriptions
Communication Settings | To change the port configuration it is necessary to select "Personal" |
Speed | Communication speed is adjustable from 300 to 115,200 baud according to the specifications of the slave |
Format | Set the combination of Data Bits, Stop Bits and parity necessary for communication with the slaves. The default for the Hostlink protocol is 7.2, ie E 7 Data Bits, 2 stop bits and parity Equal (E). |
Mode | Select the "RS-232C" |
Order Code | Select the "Code Set" and set the code 0x000D |
Delay | Transmission delay specified by the user, leave at 0 |
Specifications
Input Parameters:
Name | Type | Description | ||
EN | BOOL | Enabling input of function block. For a proper operation, it must be kept high for the duration of the communication. The input can be connected to the Bit P_On. |
||
Slave_Table | UINT |
|
||
Blocks | UINT | Number of blocks definition (> 0) The FB does not provide an upper limit of blocks. |
||
Timeout | WORD | Waiting time for the slaves response expressed in tenths of second. If set to 0 the default will be20 (2 seconds). |
Outputs
Name | Type | Description | ||||||||||||||||||||||||
ENO | BOOL | This output reflects the state of entry EN and then the state of the enabled function block | ||||||||||||||||||||||||
Error | BOOL | If you make a mistake in carrying out the sequence of communication Bit is increased to the same On and updates the contents of ERROR_CODE word. |
||||||||||||||||||||||||
Error_Code | WORD | This output word contains a code that allows you to trace the cause of communication error. |
||||||||||||||||||||||||
Current_Block | WORD | This output indicates the number of the block definition in the course of processing. The numbering starts at 0. |
||||||||||||||||||||||||
Slave_Ok | DWORD |
The 32 Bit represents Hostlink nodes from 0 to 31. If the bit is 1 it means that
|
||||||||||||||||||||||||
Slave_Error | DWORD |
The 32 Bit represents Hostlink nodes from 0 to 31. The state of Bit 1 indicates a
|
Slave Definitions
Word | Description |
n | Node number 0 - 31 (00 - 1F hex) |
n+1 | Command 1-4, see table commands |
n+2 | Word starting from 0 to 9999 (0000 - 270F hex) |
n+3 | Number of word from 1 to 30 (0000 - 001E hex) |
n+4 | Address of the first word of data exchange in PLCs. From 00,000 to 32,767 per read / write access to the area D, from 0000 to 6143 for operations on CIO. |
Supported Hostlink Commands
Command Code | Hostlink Command | Description |
01 | RR | Read the CIO (IR on PLC series C). |
02 | RD | Reading the Data Memory |
03 | WR | Writing of the CIO (IR on PLC Series C) |
04 | WD | Writing of the Data Memory |
Error Codes
Code (Hex) | Description |
0000 | No errors |
E000 | Timeout, the slave did not respond within the allotted time (default 2 sec) |
E001 | FCS error in the received message |
E002 | Modbus slave address out of range (> 31) |
E003 | The command is not defined |
E004 | Modbus slave address out of range (> 247) |
E005 | Number of records / Bit too high (> 30) or equal to 0 |
EE01 | Command not executable in RUN mode |
EE04 | The address does not exist in the slave device |
EE13 | FCS error in the message that the slave device has received |
EE14 | The format of the message is not supported by slave |
EE15 | The amount of data is outside the range allowed by the slave |
EE16 | Command not supported by slave |
EE19 | Operation unworkable |
EE21 | an error in the CPU prevents the response |
Using the SYSWAY Function Block
The function block uses the RS232 serial port of the CPU, so it is possible to use only one FB. If you wish to use multiple instances of the same block, they must be mutually
exclusive. Two or more Master Sysway FBs can not operate on a single port.
The definition of data exchange between master and slave is done by means of a table composed of definition blocks. Each block, consisting of 5 words, defines the number of slave node, the command to perform (read / write data area and CIO / D), the source address of the number of words exchanged, and the first word of data exchange on the master. There is no limit to the number of definition blocks set. For each transaction read or write, you can exchange a 30-word maximum.
For diagnosis there is a generic error bit that occurs in case of a communication error. The "ERROR_CODE" contains the specific error code The description of the errors can be found above. It comes as two double words representing the state of slave. The Bit 0 to 31 of each word represents Hostlink nodes from 0 to 31. The word "Slave_Ok" indicates which slave is exchanging data with the Master while the word "Slave_Error" indicates that the slave reported errors of communication.
The setting range of addresses for data areas and CIO Data Memory is adjustable from 0 to 9999. The actual availability of such guidelines in the slave depends on the specifics
of the device. An attempt to access areas outside the area will result in an error code "EEyy".
Use
The input "EN" in the function block must be connected to an On Bit and remain so for the entire duration of the block's operations. It uses the Bit "P_On" (Always On).
An example of the Function Block's use.
Example of table definition of the exchange data
Example 1. Reading / writing to the same area on multiple nodes.
The master is connected to (three) PLCs configured as slaves with node numbers 0 and 1. The slaves read 20 words starting at D100 and write 4 words of I/O starting at CIO200. Master data from D will be placed from D7500 and the data of the CIO starting from 3200.
The beginning of the table definition is placed at D1200.
Address | Value (HEX) | Description |
D1200 | 0(0000) | Node 0 |
D1201 | 2(0002) | D area |
D1202 | 100(0064) | Word starts D100 |
D1203 | 20(0014) | Number word = 20 |
D1204 | 7500(1D4C) | Address in Master D7500 |
D1205 | 0(0000) | Node 0 |
D1206 | 3(0003) | Writing CIO area |
D1207 | 200(00C8) | Word starts CIO200 |
D1208 | 4(0004) | Number word = 4 |
D1209 | 3200(0C80) | Address in Master CIO3200 |
D1210 | 1(0001) | Node 1 |
D1211 | 2(0002) | D area |
D1212 | 100(0064) | Word starts D100 |
D1213 | 20(0014) | Number word = 20 |
D1214 | 7520(1D60) | Address in Master D7520 |
D1215 | 1(0001) | Node 1 |
D1216 | 3(0003) | Writing CIO area |
D1217 | 200(00C8) | Word starts CIO200 |
D1218 | 4(0004) | Number word = 4 |
D1219 | 3204(0C84) | Address in Master CIO3204 |
Example2. Read / write data to more areas on the same node.
The master is connected to a single slave (node 0) from which it reads 10 CIO words starting from CIO0, reads 25 words from D500, writes 8 words from CIO10 and 40 words from D1000.
When reading, the data will be starting from CIO6000 to D2500. For
writing the data starts from D10300.
The beginning of the table of definitions is placed at D100
Address | Value (HEX) | Description |
D100 | 0(0000) | Node 0 |
D101 | 1(0001) | CIO area |
D102 | 0(0000) | Word starts CIO0000 |
D103 | 10(000A) | Number word = 10 |
D104 | 6000(1770) | Address in Master CIO6000 |
D105 | 6(0006) | Node 0 |
D106 | 2(0002) | D area |
D107 | 500(01F4) | Word starts D500 |
D108 | 25(0019) | Number word = 25 |
D109 | 2500(09C4) | Address in Master D2500 |
D110 | 0(0000) | Node 0 |
D111 | 3(0003) | Writing CIO area |
D112 | 10(000A) | Word starts CIO10 |
D113 | 8(0008) | Number word = 8 |
D114 | 5230(146E) | Address in Master CIO5230 |
D115 | 0(0000) | Node 0 |
D116 | 4(0004) | D area |
D117 | 1000(03E8) | Word starts D1000 |
D118 | 30(001E) | Number word = 30 |
D119 | 10300(283C) | Address in Master D10300 |
D120 | 0(0000) | Node 0 |
D121 | 4(0004) | D area |
D122 | 1030(0406) | Word starts D1030 |
D123 | 10(000A) | Number word = 10 |
D124 | 10330(285A) | Address in Master D10330 |
Setting the slave PLC
If the device is a slave Omron PLC, you must configure the communication port as follows:
Set Communication (A) parameters to adapt them to your Master. Select the mode (B) on "Host link". If the connection is made with more than one slave, assign each node a number of between 0 and 31 (C). |
To write data in the areas of Slave PLC, the operating mode PLC at (A) should be set to "Monitor". |
Examples of Wiring
Note: It is recommended to use the converter SYS-SCU02-OEE-I. For PLC CP1H series and CP1L you can use the adapter CP1W-CIF11.
Pinout of the RS232 port of the PLC
Pin No. | Signal | Name | Direction |
1 | FG | Protection earth | --- |
2 | SD(TXD) | Send data | Output |
3 | RD(RXD) | Receive data | Input |
4 | RS(RTS) | Request to send | Output |
5 | CS(CTS) | Clear to send | Input |
6 | 5V | Power supply | --- |
7 | DR(DSR) | Data set ready | Input |
8 | ER(DTR) | Data terminal ready | Output |
9 | SG(OV) | Signal ground | --- |
Connector Hood | FG | Protection earth | --- |
RS232 connection point to point.
CP1W-SCU11 Adapter
CP1H and CP1L series PLCs can use this form of communication in place of the standard RS232.
Pin | Setting | |
1 | ON Inserted | Termination resistance |
OFF Not inserted | ||
2 | ON Wires | Mode selection: RS422 (4 wire) or RS485 (2 wires) |
OFF Wires | ||
3 | ON Wires | Mode selection: RS422 (4 wire) or RS485 (2 wires) |
OFF Wires | ||
4 | Not used | |
5 | ON RTS Control enabled | Direction control (RTS) for receiving |
OFF RTS Control not enabled | ||
6 | ON RTS Control enabled | Direction control (RTS) for the transmission |
OFF RTS Control not enabled |
RS422: To work set the pin 6 to ON, the pin 2, 3 and 5 to OFF. Pin 1 must be
ON if the device is one of the ends of the network.
RS485: To work set pins 2, 3, 5, 6 to ON. Pin 1 must be ON if the
device is one of the ends of the network.
Connection between the nodes.
SYS-converter SCU02-OEE-I