0% found this document useful (0 votes)
241 views9 pages

N4D8B08 8-Channel RS485 IO Input and Output Controller Commamd

The document provides detailed instructions for using the N4D8B08 8CH RS485 IO controller with MODBUS commands, including function codes for reading and writing data. It specifies the required HEX format for commands, the structure of the commands, and examples for controlling channels and reading statuses. Additionally, it outlines baud rate settings and the expected responses for various commands.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
241 views9 pages

N4D8B08 8-Channel RS485 IO Input and Output Controller Commamd

The document provides detailed instructions for using the N4D8B08 8CH RS485 IO controller with MODBUS commands, including function codes for reading and writing data. It specifies the required HEX format for commands, the structure of the commands, and examples for controlling channels and reading statuses. Additionally, it outlines baud rate settings and the expected responses for various commands.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

N4D8B08 8CH RS485 IO controller commamd

MODBUS Command (function code 06 is Control command,03 is Read status command


0x0001-0x0008 registers support 16 (0X10) Command)

Note :
1 MODBUS command must be HEX
2 Slave ID (device address) must be consistent with the DIP switches (A0-A5)

9600 Band ,8 Data bits,None Parity,1 Stop Bit。

Function code
RS485 address Function (1) Register Read CRC16 (2)
(Station address) address number (2)
(1) (2)
03 Read
06 Write
16(0x10)
Write multiple registers

Function Register Register Numbe Register Remarks


code address contents r of value
bytes
03 06 0x0001-0x0008 Output port 2 0X0000 0X0000 Relay Close
16(0X10) status 0X0001 0X0001 Relay Open
03 0x0081-0x0088 Input port 2 0X0000 NPN Input
status 0X0001 0X0000 Input Off
0X0001 Input On
03 06 0x00FD Input and 2 0X0000- 0x0000 Unrelated
output 0X0003 0x0001 Self-locking
relationship relationship (default)
0x0002 Interlocking relationship
0x0003 Momentary relationship
Other values are the same as 0
03 06 0x00FE Baud rate 2 0x0000- 0~5 0:1200
0x0005 1:2400 2:4800
3:9600(default)
4:19200
5: Factory reset
MODBUS 06 Command (Control command ,HEX):
Bytes 1 2 3 4 5 6 7 8
Number
MODBUS Slave ID Function Address Data CRC Check
Definitions
Function Device Function Channel Command Delay CRC Check
Address number time
Open 0x00- 0x06 0x0001- 0x01 0x00 2Bytes CRC
0x2F 0x0008
Close 0x00- 0x06 0x0001- 0x02 0x00 2Bytes CRC
0x2F 0x0008
Toggle (Self- 0x00- 0x06 0x0001- 0x03 0x00 2Bytes CRC
locking) 0x2F 0x0008
Latch Inter- 0x00- 0x06 0x0001- 0x04 0x00 2Bytes CRC
locking) 0x2F 0x0008
Momentary 0x00- 0x06 0x0001- 0x05 0x00 2Bytes CRC
(Non- 0x2F 0x0008
locking)
Delay 0x00- 0x06 0x0001- 0x06 0x00- 2Bytes CRC
0x2F 0x0008 0xff
Open all 0x00- 0x06 0x0000 0x07 0x00 2Bytes CRC
0xFE
Close all 0x00- 0x06 0x0000 0x08 0x00 2Bytes CRC
0xFE
Input and 0x00- 0x06 0x00FD 0x0000 Unrelated
output 0xFE 0x0001 Self-locking relationship (default)
relationship 0x0002 Interlocking relationship
0x0003 Momentary relationship
Other values are the same as 0
Baud rate 0x00- 0x06 0x00FE 0x00 0x00-
0xFE 0x05
Remarks:
1 Momentary mode, delay time is 1 seconds
2 Delay mode, delay time is 0-255 seconds
3 0x0001-0x0008 registers not only support 06 function code, but also support 16 (0X10) function
code

Return command:
Command is active, return to send commands; instruction is invalid no return.

MODBUS 03 Command (Read status command ,HEX):


Bytes Number 1 2 3 4 5 6 7 8
MODBUS Slave ID Function Address Data CRC
Definitions Check
Function Device Function Starting Register CRC
Address register length Check
address
Read Channel 1 0x00-0x2F 0x03 0x0001 0x0001
State
Read Channel 2 0x00-0x2F 0x03 0x0002 0x0001
State
Read 2 consecutive 0x00-0x2F 0x03 0x0001- 0x0002
channels status 0x0003
Read 3 consecutive 0x00-0x2F 0x03 0x0001- 0x0003
channels status 0x0002
Read all 8 channels 0x00-0x2F 0x03 0x0001 0x0008
status

Read input1 status 0x00-0xFE 0x03 0x0081 0x0001

Read input2 status 0x00-0xFE 0x03 0x0082 0x0001

Read input3 status 0x00-0xFE 0x03 0x0083 0x0001

Read input4 status 0x00-0xFE 0x03 0x0084 0x0001

Read the status of 2 0x00-0xFE 0x03 0x0081- 0x0002


consecutive input 0x0087
ports
Read the status of 3 0x00-0xFE 0x03 0x0081- 0x0003
consecutive input 0x0086
ports
Read 8 input port 0x00-0xFE 0x03 0x0081 0x0008
status

Input and output 0x00-0xFE 0x03 0x00FD 0x0000-


relationship 0x0003
Baud rate 0x00-0xFE 0x03 0x00FE 0x0000-
0x0005

Read status command returns (function code 03, HEX format):


Bytes length 1 1 1 2
MODBUS Slave ID Function data data CRC16 Check
Definitions length
Function Device Function data Relay state CRC16 Check
Address length 0x0001 open
0x0000 close
Channel 1 0x00-0x1F 0x03 0x02 0x0001
open
Channel 1 0x00-0x1F 0x03 0x02 0x0000
close
Channel 2 0x00-0x1F 0x03 0x02 0x0001
open
Channel 2 0x00-0x1F 0x03 0x02 0x0000
close
Channel 1 open 0x00-0x1F 0x03 0x04 0x0001 0x0001
Channel 2 open
Channel 1 open 0x00-0x1F 0x03 0x04 0x0001 0x0000
Channel 2 close
Channel 1 close 0x00-0x1F 0x03 0x04 0x0000 0x0001
Channel 2 open
Channel 1 close 0x00-0x1F 0x03 0x04 0x0000 0x0000
Channel 2 close

Input 1 On 0x00-0xFE 0x03 0x02 0x0001

Input 1 Off 0x00-0xFE 0x03 0x02 0x0000

Input 2 On 0x00-0xFE 0x03 0x02 0x0001

Input 2 Off 0x00-0xFE 0x03 0x02 0x0000

Input 1 On 0x00-0xFE 0x03 0x04 0x0001 0x0001


Input 2 On
Input 1 On 0x00-0xFE 0x03 0x04 0x0001 0x0000
Input 2 Off
Input 1 Off 0x00-0xFE 0x03 0x04 0x0000 0x0001
Input 2 On
Input 1 Off 0x00-0xFE 0x03 0x04 0x0000 0x0000
Input 2 Off

MODBUS commands you can use "Modbus Poll" input, as shown below
(CRC check generated automatically)
You can also use HyperTerminal serial input, as shown below
(Manually add CRC check)

Examples (Slave ID is 1,DIP switch state)


Channel 1 Open :01 06 00 01 01 00 D9 9A
Channel 1 Close :01 06 00 01 02 00 D9 6A
Channel 1 Toggle:01 06 00 01 03 00 D8 FA
Channel 1 Latch:01 06 00 01 04 00 DA CA
Channel 1 Momentary: 01 06 00 01 05 00 DB 5A
Channel 1 Delay 10 seconds : 01 06 00 01 06 0A 5B AD
Channel 1 Delay 100 seconds: 01 06 00 01 06 64 DA 41

Channel 2 Open :01 06 00 02 01 00 29 9A


Channel 2 Close :01 06 00 02 02 00 29 6A
Channel 2 Toggle :01 06 00 02 03 00 28 FA
Channel 2 Latch :01 06 00 02 04 00 2A CA
Channel 2 Momentary : 01 06 00 02 05 00 2B 5A
Channel 2 Delay 10 seconds : 01 06 00 02 06 0A AB AD
Channel 2 Delay 100 seconds : 01 06 00 02 06 64 2A 41

Open all:01 06 00 00 07 00 8B FA
Close all:01 06 00 00 08 00 8E 0A

16 (0X10) function code (only supports 0x0001-0x0008 registers)


Open all:01 10 00 01 00 08 10 01 00 01 00 01 00 01 00 01 00 01 00 01 00 01 00 89 3A
Close Channels1-4:01 10 00 01 00 04 08 02 00 02 00 02 00 02 00 CB 5A
Close Channels 5-8:01 10 00 05 00 04 08 02 00 02 00 02 00 02 00 3A 95

Read state (assuming that the channel 1 is open, the channel 2 is close).
Read channel 1 state :01 03 00 01 00 01 D5 CA
Return open:01 03 02 00 01 79 84

Read channel 2 state :01 03 00 02 00 01 25 CA


Return close:01 03 02 00 00 B8 44

Read channel 1 and channel 2 state :01 03 00 01 00 02 95 CB


Return channel open and channel 2 close :01 03 04 00 01 00 00 AB F3

Read 1-8 channel input status:01 03 00 81 00 08 14 24


Return all input channels OFF:01 03 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E4 59
Return input channel 1 ON:01 03 10 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 25 59

1. Read baud rate


Send data
RS485 address Functio Register Read number CRC16
(Station n (1) address (2) (2) (2)
address)
(1)
Returns data
RS485 address Functio Number of bytes (1) data (n) CRC16
(Station n (1) (2)
address)
(1)

Function code 0x03


Register address:0x00FE
Read number:0x0001
For example:
send data(RS485 address is 1):01 03 00 FE 00 01 E5 FA
Returns data:01 03 02 00 03 F8 45
01 RS485 address,03 Function,02 length,F8 45 crc16
03 means the current baud rate is 9600bps
Baud rate corresponds to the number: 0: 1200 1: 2400 2: 4800 3: 9600 4: 19200

2. Write baud rate


Send data
RS485 address Function Register Setting CRC16
(Station (1) address (2) Content (2) (2)
address)
(1)

Returns data
RS485 address Function Register Register value CRC16
(Station (1) address (2) (2)
address) (2)
(1)

Function code 0x06


Register address:0x00FE
Setting Content:2Bytes(0-4)

For example, Change the baud rate to 4800bps:


send data(RS485 address is 1):01 06 00 FE 00 02 69 FB
Returns data:01 06 00 FE 00 02 69 FB
Baud rate corresponds to the number: 0: 1200 1: 2400 2: 4800 3: 9600 4: 19200
5: Factory reset
Note: 1 The baud rate will be updated when the module is powered up again!
2 The factory setting can be restored when the baud rate corresponding to the number is 5. For
example: 01 06 00 FE 00 05 28 39
3. Read input and output relation register
Send data
RS485 address Functio Register Read number CRC16
(Station n (1) address (2) (2) (2)
address)
(1)

Returns data
RS485 address Functio Number of bytes (1) data (n) CRC16
(Station n (1) (2)
address)
(1)

Function code 0x03


Register address:0x00FD
Read number:0x0001
For example:
send data(RS485 address is 1):01 03 00 FD 00 01 15 FA
Returns data:01 03 02 00 01 79 84
01 RS485 address,03 Function,02 length,15 FA crc16
Register corresponding value:
0x0000 Unrelated
0x0001 Self-locking relationship (default)
0x0002 Interlocking relationship
0x0003 Momentary relationship
Other values are the same as 0

4. Write input and output relation register


Send data
RS485 address Function Register Setting CRC16
(Station (1) address (2) Content (2) (2)
address)
(1)

Returns data
RS485 address Function Register Register value CRC16
(Station (1) address (2) (2)
address) (2)
(1)

Function code 0x06


Register address:0x00FD
Setting Content:2Bytes(0-3)
For example, Set the input and output to be unrelated, and change the register
value to 0X0000:
Send data(RS485 address is 1):01 06 00 FD 00 00 18 3A
Returns data:01 06 00 FD 00 00 18 3A

Register corresponding value:


0x0000 Unrelated
0x0001 Self-locking relationship (default)
0x0002 Interlocking relationship
0x0003 Momentary relationship
Other values are the same as 0

You might also like