OneFex CS-IO204 User manual

1
/ 13
CS-IO204 User Manual
CS-IO204
Serial I/O Module
Manual

2
/ 13
CS-IO204 User Manual
CS-IO204.......................................................................................................................................................1
1PRODUCT INTRODUCTION ..............................................................................................................5
1.1 FEATURES ............................................................................................................................................5
1.2 PARAMETER .........................................................................................................................................5
1.3 ITEM SELECTION...................................................................................................................................6
1.4 DIMENSION........................................................................................................................................... 6
2WIRING INSTRUCTIONS....................................................................................................................6
2.1 TERMINAL DEFINITION.......................................................................................................................... 6
2.2 COMMUNICATION WIRING.................................................................................................................... 7
2.2.1 RS485 Wiring......................................................................................................................7
2.3 DO WIRING ..........................................................................................................................................7
2.3.1 Low Load Wiring.................................................................................................................8
2.3.2 AC 220V Load Device Wiring.............................................................................................8
2.3.3 AC 380V Load Device Wiring 【With Zero Line】.............................................................9
2.3.4 AC 380V Load Device Wiring【Without Zero Line】.........................................................9
2.4 DIGITAL INPUT WIRING.......................................................................................................................10
3PARAMETERS AND WORKING MODE CONFIGURATION ........................................................10
3.1 DEVICE AND PC CONNECTION SETTINGS .........................................................................................10
3.2 DEVICE ADDRESS...............................................................................................................................10
3.2.1 Introduction.......................................................................................................................10
3.2.2 Device Communication Address Reading........................................................................11
3.2.3 Offset Address Setting and Reading ................................................................................11
3.2.4 Baud Rate Reading and Setting.......................................................................................12
3.3 WORKING MODE ................................................................................................................................12
3.3.1 Normal Mode ....................................................................................................................12
3.3.2 NOLock Linkage Mode Mode...........................................................................................12
3.3.3 Lock Linkage Mode...........................................................................................................13
3.3.4 All Channel Lock Linkage.................................................................................................13
3.3.5 2Device NOLock Linkage.................................................................................................13
3.3.6 2Device Lock Linkage.......................................................................................................14
3.3.7 Working Mode Configuration............................................................................................14
4DEVELOPMENT DATA INSTRUCTION..........................................................................................15
4.1 COMMUNICATION PROTOCOL INSTRUCTION......................................................................................15
4.2 MODBUS REGISTER INSTRUCTION..................................................................................................... 15
4.3 COMMAND LIST ..................................................................................................................................17
4.4 COMMAND DETAILS............................................................................................................................17
4.4.1 Control DO........................................................................................................................17
4.4.2 Query DO Status ..............................................................................................................18
4.4.3 Optocoupler Input .............................................................................................................18
4.4.4 Flash ON Flash OFF Command.......................................................................................19
4.4.5 All ON and All OFF Command .........................................................................................20
4.4.6 Active Reporting Protocol.................................................................................................21
5PRODUCT MAINTENANCE..............................................................................................................21
5.1 DEVICE USAGE ENVIRONMENT..........................................................................................................21
5.2 FAQ.................................................................................................................................................... 21
5.2.1 RS485 /RS232 communication, no response when device control .................................21
5.2.2 The DO can only be turned on but not turned off.............................................................22
5.2.3 485 interface cannot be used to establish communication and control After the I/O
module powered on......................................................................................................................22

3
/ 13
CS-IO204 User Manual
5.2.4 Multiple devices on the 485 bus and ON/OFF operation failed to send the broadcast
address 254..................................................................................................................................23
5.2.5 PLC and the device cannot communicate normally .........................................................23
6AFTER-SALE SERVICE....................................................................................................................24
6.1 COMMITMENT .....................................................................................................................................24
6.2 DISCLAIMER........................................................................................................................................ 24
7UPDATE HISTORY............................................................................................................................24

4
/ 13
CS-IO204 User Manual
Notice
❖Please read this manual carefully before use and save it for reference.
❖Please follow to the operating procedures and precautions in this manual.
❖Please open the package carefully and check whether the device and
accessories have been damaged due to transportation when you receive the device.
Please contact us for return processing once damage occurs.
❖Please do not repair it yourself, and contact our technical support department
directly if the device fails.

5
/ 13
CS-IO204 User Manual
1 Product Introduction
CS-IO series products are serial IO module using standard Modbus-RTU protocol,
supporting RS485/232. Support wide voltage power supply, multi-channel input and
output control, which can be widely used in various application scenarios such as
industrial production, agriculture, smart city and office buildings.
1.1 Features
◆DC 9-28V wide voltage power supply, support anti-reverse connection;
◆2-way DO contact isolation, normally ON and normally OFF, 10A 250VAC / 10A
30VDC;
◆4-way DI, with optocoupler isolation, used for switch detection, supports dry and
wet contacts;
◆LED indication; 1 for power and working status, 4 for DO status;
◆SupportsIsolatedRS485Communicationinterface,power isolationplussignal isolation,
reliable communication;
◆Communication baud rate: 300bps~38400bps (, It is 9600 by default and
can be modified by software);
◆Support standard Modbus RTU protocol, read and write by registeraddress;
◆0-255; Built-in address DIP switch; Set by software
◆Support input and output linkage, such as local linkage or dual-computer
linkage, which is convenient for multi-terminal control;
◆Support debugging software for setting parameters and IO control;
◆Support software and hardware customization. Contact Us for details.
1.2 Parameter
Paremater
Contact capacity
10A/30VDC
10A/250VAC
Durability
100,000 times (Electrical)
10,000,000 times (Mechanical)
Data interface
RS485
Rated voltage
DC 9-28V
Power indication
1 red LED
(power, always on; working: flashing)
Output indication
2 red LEDs (DO on and off)
Working temperature
-40℃~85℃, Industrial Grade
Size
95*50*32mm
Weight
77g
Default communication format
9600,n,8,1
Baud rate
300~38400bps

6
/ 13
CS-IO204 User Manual
Functions
Flash ON Flash OFF
All ON All OFF
NOLock Linkage Mode
Local Self-locking Linkage
Interlock
Dual-machine Non-locking Linkage
Dual-machine Self-locking Linkage
Software support
Working mode change
DO independent control
DI status query
Overall DO control;
Debugging information query;
Support various configuration software;
support Labview, etc.
Installation
Mounting Ears
1.3 Item Selection
Item #
DO
DI
Analog
RS485
Address Dial
CS-IO101
1
1
0
RS485 * 1
Address Dial
CS-IO204
2
4
0
RS485 * 1
Address Dial
CS-IO222A
2
2
2(0-20mA)
RS485 * 1
Address Dial
CS-IO404A
4
0
4(0-20mA)
RS485 * 1
Address Dial
CS-IO404
4
4
0
RS485 * 1
Address Dial
CS-IO606
6
6
0
RS485 * 1
Address Dial
CS-IO808
8
8
0
RS485 + RS232
CS-IO1600DI
0
16
0
RS485 + RS232
Address Dial
CS-IO1600
16
0
0
RS485 + RS232
Address Dial
CS-IO3200
32
0
0
RS485 + RS232
Address Dial
1.4 Dimension
95*50*32mm
2 Wiring Instructions
2.1 Terminal Definition
No.
Pin
Instruction
1
+
Positive Power Supply
2
-
Negative Power Supply
3
A+
RS485 communication A+
4
B-
RS485 communication B-

7
/ 13
CS-IO204 User Manual
5
IN1
1st DI
6
IN2
2nd DI
7
IN3
3rd DI
8
IN4
4th DI
9
Normally ON
The 2nd DO normally ON terminal
10
Public
The 2nd DO public terminal
11
Normally OFF
The 2nd DO normally ON terminal
12
Normally ON
The 1st DO normally ON terminal
13
Public
The 1st DO public terminal
14
Normally OFF
The 1st DO normally ON terminal
2.2 Communication Wiring
By default, its address is 1, The host computer software can use the
default address 1 to communicate with the device (or broadcast address 254,
which is only applicable when one device is mounted on the network).
2.2.1 RS485 Wiring
2.3 DO Wiring
The DO is single-pole, double-throw, and each circuit has three terminals, one
group is normally ON and the other is normally OFF (normally ON contacts are
generally used), and the terminal identification is subject to the indications on the
film.

8
/ 13
CS-IO204 User Manual
2.3.1 Low Load Wiring
Applicable for non-resistive load current< 3A or resistive load current < 5A
2.3.2 AC 220V Load Device Wiring

9
/ 13
CS-IO204 User Manual
2.3.3 AC 380V Load Device Wiring 【With Zero Line】
2.3.4 AC 380V Load Device Wiring【Without Zero Line】

10
/ 13
CS-IO204 User Manual
Please add an AC contactor/intermediate relay between this device and the load in
the following four cases:
1. Load rated voltage>30VDC
2. Load rated voltage>250VAC
3. Non-Resistive Load Current>3A
4. Resistive load current>5A
2.4 Digital Input Wiring
3 Parameters and Working Mode Configuration
3.1 Device and PC Connection Settings
The USB end of the USB to RS485 converter is directly connected to the USB
port of computer, and 485end is wired according to the wiring method in "Chapter
2.2 Communication Wiring".
Serial port number query method: Open "My Computer - Device Manager - Port
(COM and LPT)" and the COM number that appears after the USB to 485 device is
inserted is the serial port number.
3.2 Device Address
3.2.1 Introduction
The Offset Address of this device is 1 by default, and the broadcast address is
254 to communicate, but 0 cannot be used.
Communication address = Hardware address (DIP switch address) + Offset
address.
The device’s Factory default settings of communication address is 1.
With DIP switch, users can quickly modify the device address.
(1)The address is "31" when all 5 dial codes are dialed above;
(2)The address is "0" When all t5 dial codes are dialed below;
(3)The leftmost 1 is the lowest digit in binary;;

11
/ 13
CS-IO204 User Manual
(4)DIP address table:
3.2.2 Device Communication Address Reading
After the device connected normally, the IO module debugging software read
the current address 254 [only support broadcast read address when there is one
device on the bus].
3.2.3 Offset Address Setting and Reading
Click "Read" or "Set" to read or set the Offset Address of the device (address
parameters stored in the device).

12
/ 13
CS-IO204 User Manual
3.2.4 Baud Rate Reading and Setting
Click "Read" and "Set" to read and set the baud rate and address respectively,
which will take effect immediately after the operation.
3.3 Working Mode
3.3.1 Normal Mode
The DO takes corresponding actions after ON or OFF command.
3.3.2 NOLock Linkage Mode Mode
It is a board module with optocoupler input and DO. In this mode, the input
optocoupler and DO are directly linked.
The optocoupler input signal takes effect -> the corresponding DO is pulled in,
The optocoupler input signal is canceled -> the corresponding DO is
disconnected.
In this mode, due to mechanical and program delay, there will be a certain delay
between the optocoupler input signal and DO action, but the maximum will not
exceed 0.05 seconds.
In this mode, all DOs are directly linked by the optocoupler, so the serial port
cannot operate DO. This is not an abnormal phenomenon, but after the serial port

13
/ 13
CS-IO204 User Manual
operates the DO, it is linked by the optocoupler state before the DO is still in action.
3.3.3 Lock Linkage Mode
In this mode, each time the optocoupler inputs a signal, the corresponding DO is
flipped once.
The optocoupler input signal takes effect -> the DO flips (the pull-in changes to
disconnect, the disconnect changes to pull-in);
The optocoupler input signal is canceled -> the DO does not act;
This mode also has the delay problem of unlocked mode, but the delay time is
also not greater than 0.05 seconds. This mode can be mainly used for external
signal triggering to control the start and stop of the device. For example, an
optocoupler is connected to a button, and the corresponding DO is connected to an
electrical device. Each time the button is pressed, the device will switch to a start-
stop state.
3.3.4 All Channel Lock Linkage
The module itself has a board module with optocoupler input and DO. In this
mode, each time the optocoupler inputs a signal, the corresponding DO will be
pulled in, and DOs of the other optocouplers will be disconnected if no signal is
input.
The optocoupler input signal takes effect -> the corresponding DO is pulled in
and other DOs are disconnected;
The optocoupler input signal is canceled -> the DO does not act;
This mode also has a delay problem, but the delay time is also not greater than
0.05 seconds. This mode can be mainly used for external signal triggering to control
the start and stop of different devices, such as
The multi-channel optocoupler is not connected to a button, and the
corresponding DO is connected to an electrical device. If you press a button, the
corresponding device will switch to the start state, and other devices will stop
running.
3.3.5 2Device NOLock Linkage
This mode requires two devices with the same address and mode to complete.
After the two devices are connected through direct connection 485 or cross 232, the
optocoupler state of module 1 will directly control the state of the corresponding DO
of module 2.
No. 1 optocoupler input signal of module 1 is valid—> No. 1 DO of module 2 is
OFF
No. 1 optocoupler input signal of module 1 disappears -> No. 1 DO of module 2
is disconnected
The DO response delay time in this mode is longer than the previous modes,
but not more than 0.1 second (9600 baud rate).

14
/ 13
CS-IO204 User Manual
In this mode, if the 485 bus is used, multiple devices can be connected in
parallel, and the addresses of the devices match each other, so that the remote
switch value can be transmitted. For example, if there are multiple low-speed
switches on site that need to be transmitted to the control room 500 meters away to
control the alarm lights or bells, it is only necessary to arrange a few modules in the
workshop and connect them to the corresponding modules in the machine room
through two twisted-pair shielded cables. can complete this task. In the same way,
the button signal of the computer room operation can also be directly transmitted to
the DO located in the computer room module.
3.3.6 2Device Lock Linkage
This mode requires two devices with the same address and mode to complete.
After the two devices are connected through direct connection 485 or cross 232, the
optocoupler state of module 1 will take effect and the state of the corresponding DO
of control module 2 will be reversed.
No. 1 optocoupler input signal of module 1 is valid—> No. 1 DO of module 2 is
flipped
No. 1 optocoupler input signal of module 1 disappears -> No. 1 DO of module 2
does not act
The application of this mode is similar to the "dual-machine non-locking linkage"
mode, but it is more suitable for the start and stop of remote-control equipment. Just
install a button on the operation end to realize the action of pressing once to start
and pressing once to stop.
3.3.7 Working Mode Configuration
After the device communicates normally, select the corresponding working
mode setting in the software working mode part, as shown in the following figure:

15
/ 13
CS-IO204 User Manual
4 Development Data Instruction
4.1 Communication Protocol Instruction
This product supports standard Modbus commands. For detailed command
generation and parsing methods, you can refer to "MODBUS Protocol English
Version" based on the register table in this article.
This product supports Modbus RTU format.
4.2 Modbus Register Instruction
Instruction code
Meaning
1
Read coil register [DO]
5
Write a single coil
15
write multiple coils
Register address table:
Register
name
PLC
Register address
Explaination
Coil Control
Coil Control 1
Write coil
Command 1
0000H
00001
The 1st DO
Coil Control 2
0001H
00002
The 2nd DO
Discrete Input
Input 1
Read DI
Command 2
0000H
10001
The 1st DI
Input 2
0001H
10002
The 2nd DI
Input 3
0002H
10003
The 3rd DI
Input 4
0003H
10004
The 4th DI

16
/ 13
CS-IO204 User Manual
Parameters Configuration
Holding
register
Modbus
Register
address
PLC
Register
address
Explaination
Communication
baud rate
03E8H
41001
See the below corresponding
table of baud rate values, the
default value is 0, and supports 0-
5. This register determines the
communication baud rate of
RS232 and RS485 at the same
time.
Spare
03E9H
41002
Spare, user cannot write any
value.
Offset Address
03EAH
41003
Device address= Offset Address
+ DIP switch address
Workng Mode
03EBH
41004
User can use, store user data
Delay
03ECH
41005
User can use, store user data
(1)The Modbus device command supports the following Modbus addresses:
00001 to 09999 are discrete outputs (coils)
10001 to 19999 are discrete inputs (contacts)
30001 to 39999 are input registers (usually analog inputs)
40001 to 49999 are holding registers (usually store device configuration information)
In 5-bit code format, the first character determines register type, and the remaining 4
characters represent address.
Address 1 starts from 0, such as 00001 corresponds to 0000.
(2)Baud rate value corresponding table
(3)The DO status can be queried through 30002 address or through 00001-
00002 address, but the control can only use 00001-00002 address. 30002 address
data length is 16bit. Up to 16 DOs can be represented.
The responding results as follow:
Bite
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Value
Baud rate
0
9600
1
2400
2
4800
3
9600
4
19200
5
38400

17
/ 13
CS-IO204 User Manual
DO
8
7
6
5
4
3
2
1
16
15
14
13
12
11
10
9
The bit 8 of the data of register 30009 is the same as the data of register 00001.
The same is true for the optocoupler input. Bit8 and bit9 of register 30003 and
registers 10001 and 10002 all correspond to the specified hardware.
The register address is in accordance with the PLC naming rules, the real address is
to remove the highest bit, and then subtract 1
4.3 Command List
Scene
RTU format (send in hexadecimal)
Query 4 DOs ‘status
FE 02 00 00 00 04 6D C6
Return query information
FE 01 01 00 61 9C
Query 2 DIs ‘status
FE 01 00 00 00 02 BD CB
Return query information
FE 01 01 00 61 9C
Control the 1st DO on
FE 05 00 00 FF 00 98 35
Return control information
FE 05 00 00 FF 00 98 35
Control the 1st DO off
FE 05 00 00 00 00 D9 C5
Return control information
FE 05 00 00 00 00 D9 C5
Control the 2nd DO on
FE 05 00 01 FF 00 C9 F5
Control the 2nd DO off
FE 05 00 01 00 00 88 05
4.4 Command Details
4.4.1 Control DO
Control 2 DO (take the first DO OFF as an example, other channels refer to this)
Sending code: FE 05 00 00 FF 00 98 35
Field
Meaning
Note
FE
Device address
It is the broadcast address
05
05 command
Single control command
00 00
Address
Register address of the DO to control
FF 00
Command
DO OFF action
98 35
CRC16
CRC16 checksum of the first 6 bytes of data
DO return information::
Return code:FE 05 00 00 FF 00 98 35

18
/ 13
CS-IO204 User Manual
Field
Meaning
Note
FE
Device address
It is the broadcast address
05
05 command
Single control command
00 00
Address
Register address of the DO to be controlled
FF 00
Command
DO OFF action
98 35
CRC16
CRC16 checksum of the first 6 bytes of data
4.4.2 Query DO Status
Sending Code:FE 01 00 00 00 02 A9 C4
Field
Meaning
Note
FE
Device address
It is the broadcast address
01
01 command
Query DO status command
00 00
Starting address
Register address of the first DO to be queried
00 02
Number of queries
The number of DOs to be queried
A9 C4
CRC16
CRC16 checksum of the first 6 bytes of data
DO return information:
Return code: FE 01 01 00 61 9C
Field
Meaning
Note
FE
Device address
01
01 command
Return command: If the query is wrong, return
0x81
01
Number of bytes
All bytes of return status information. 1+(n-1)/8
00
Status of the query
Returns the DO status.
The return value is hexadecimal, converted to
binary data, 0 means off, 1 means on.
61 9C
CRC16
CRC16 checksum of the first 6 bytes of data
4.4.3 Optocoupler Input
Query optocoupler
Send command code: FE 02 00 00 00 04 6D C6
Field
Meaning
Note
FE
Device address
02
02 command
Query discrete input (optocoupler input) status
command
00 00
Starting address
Register address of the first optocoupler to be
queried

19
/ 13
CS-IO204 User Manual
00 04
Number of queries
Number of optocoupler status to be queried
6D C6
CRC16
CRC16 checksum of the first 6 bytes of data
Optocoupler return information:
Return code: FE 02 01 00 91 9C
Field
Meaning
Note
FE
Device address
02
02 command
Return command: If the query is wrong, return
0x82
01
Number of bytes
All bytes of return status information。
00
Status of the query
Return the state of the optocoupler.
Bit0: Status of the first optocoupler
Bit1: Status of the second optocoupler
. . . . . . .
Bit5: Status of the sixth optocoupler
91 9C
CRC16
CRC16 checksum of the first 6 bytes of data
4.4.4 Flash ON Flash OFF Command
Flash OFF sending code:FE 10 00 03 00 02 04 00 04 00 0A 41 6B
Flash ON sending code:FE 10 00 03 00 02 04 00 02 00 0A A1 6A
Field
Meaning
Note
FE
Device address
10
10 Command
Write multiple register function codes
00 03
DO address
3+5(n-1), n represents which channel
to control, the decimal needs to be
converted to hexadecimal system
00 02
Number of control
commands
2+5(n-1), n represents the number of
controlled channels, only supports
controlling the DO action of a channel
individually
04
Bytes
4+10(n-1), n represents the number of
controlled channels, only supports
controlling the DO action of a channel
individually
00 04 / 00 02
Command
00 04: flash OFF command
00 02: flash ON command
00 0A
Interval time
00 0A is 10 (hexadecimal converted to
decimal)
The interval time is (0.1 seconds*10)
41 6B /A1 6A
CRC16
Check method

20
/ 13
CS-IO204 User Manual
Return code:FE 10 00 03 00 02 A5 C7
Field
Meaning
Note
FE
Device address
10
10 command
Return instruction:If the query is
wrong, return 0x82
00 03
Device address
Query the address of the device
00 02
Number of commands
accepted
The number of commands accepted by
the device
A5 C7
CRC16
check digit
Example: 1s flash OFF/flash ON
1st channel flash OFF command: FE 10 00 03 00 02 04 00 04 00 0A 41 6B
2nd channel flash OFF command: FE 10 00 08 00 02 04 00 04 00 0A 00 D8
1st channel flash ON command: FE 10 00 03 00 02 04 00 02 00 0A A1 6A
2nd channel flash ON command: FE 10 00 08 00 02 04 00 02 00 0A E0 D9
4.4.5 All ON and All OFF Command
All ON sending code: FE 0F 00 00 00 02 01 FF D1 D3
All OFF sending code: FE 0F 00 00 00 02 01 00 91 93
Field
Meaning
Note
FE
Device address
0F
0F command
Return command: If the query is
wrong, return 0x82
00 00
Starting address
00 01
Number of Controls
Number of DOs Controlled
01
Bytes
Bytes of Send command
FF/00
ALL ON/ALL OFF
command
FF: All ON command
00: All OFF command
21 D3/61 93
CRC16
Check digit
Return code:FE 0F 00 00 00 02 C0 05
Field
Meaning
Note
FE
Device address
0F
0F command
Return command: If the query is
wrong, return 0x82
Table of contents
Other OneFex Control Unit manuals