Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

30/1/2021 Note (this machine only supports function codes 03, 10, 06)

Page 1

HSPY3603 instrument uses RS232 or RS485 transmission standard to communicate with computer. The detailed information is as follows:

Note (this machine only supports function code 03 , 10 , 06 )

Baud rate: 9600


Start bit: 1
Data bits: 8
Check Digit: None
Stop bit: 2
One. MODBUS_RTU frame structure
The message transmission must start with a pause interval of at least 3.5 characters; the entire message frame must be used as a continuous data transmission stream, such as
If there is a pause of more than 3.5 characters before the frame is completed, the receiving device will refresh the incomplete message and assume that the next byte is a
The address field of a new message. Similarly, if a new message starts after the previous message in less than 3.5 characters, the receiving device
It will be considered a continuation of the previous news.
The standard structure of a frame of information is as follows:

begin Address domain Functional domainData field CRC check End

T1-T2-T3-T4 8Bit 8Bit n 8Bit 16Bit T1-T2-T3-T4

Address field: The host selects the slave device by putting the address of the slave to be contacted into the address field in the message. The address range of a single slave is
1...15 (decimal).
Function domain: the valid code range is 1...255 (decimal); when a message is sent from the master to the slave, the function code will tell the slave to go
What to do. For example: read/write data content of a set of registers, etc.
Data field: The data field sent by the master to the slave contains additional information necessary for the slave to complete the action of the functional domain; such as: register address
Wait.

CRC check: After the CRC is generated, the low byte is first and the high byte is last.
Note: The response interval between the frame and the frame in the communication of this instrument, when the communication rate is greater than or equal to 9600bps, not greater than 5ms

https://translate.googleusercontent.com/translate_f 1/5
30/1/2021 Note (this machine only supports function codes 03, 10, 06)
Page 2
Number of decimal placesRead and writeParameter communication address
Serial number
name Description range

1 Set-U 0-65535 2 r/w 0000h


Power supply voltage setting

Value

2 Set-I 0-65535 3 r/w 0001h


The current setting of the power supply

Value

3 U 0-65535 2 r 0002h
Power supply voltage display

Indication

4 I 0-65535 3 r 0003h
Power current display

Indication

5 Run-Stop Power output/stop 0, 1 0 r/w 0004h


set up

6 RS-Adder 0 r/w 0005h


Communication address 0~255
setting

7 Key_Lock 0, 1 0 r/w 0006h


Key lock

8 Set_P Power setting 0-65535 1 r/w 0007h

9 p Display value of power 0-65535 1 r 0008h

10 MODE Power supply working mode


0, 1, 2 0 r/w 0009h
formula

11 Up_Start Start/stop at power up 0, 1 0 r/w 000Ah


Stop setting

12 AUTO_Err Output automatic tracking


0, 1 0 r/w 000Bh
make up

13 RS_BT Communication baud rate


0, 3 0 r/w 000Ch

14 RS_Stop_Bit Communication stop bit 1, 2 0 r/w 000Dh

15 CC_CV Constant voltage and constant


0, 1 current state0 R 000Eh

16 AH_H Power high byte 0--65535 0 r 0010h

17 AH_L Energy low byte 0-65535 3 r 0011h

18 U_Err Voltage compensation ±127 0 r/w 0012h

Page 3

19 I_Err Current compensation ±127 0 r/w 0013h

Note: Both 1000H and 0000H address power supplies are supported

MODBUS RTU communication protocol

https://translate.googleusercontent.com/translate_f 2/5
30/1/2021 Note (this machine only supports function codes 03, 10, 06)
Type and format of communication data:
Information transmission is asynchronous, and the unit is byte. The communication information transmitted between the master station and the slave stat
Word format:
Word format (serial data) 10-bit binary
Start bit 1 person
Data bit 8-bit
Parity bit no
Stop bit 1 person

● Communication data (information frame) format

Data Format address code function code Data area CRC check

Data length 1 byte 1 byte N bytes 16-bit CRC code (redundant cyclic code)

1. Communication information transmission process:


When the communication command is sent from the sending device (host) to the receiving device (slave), the slave that matches the corresponding address code receives the communication command, and according to the

And related requirements read the information, if the CRC check is correct, execute the corresponding task, and then return the execution result (data) to the host. Package

Including address code, function code, data after execution and CRC check code. If there is an error in the CRC check, nothing is returned.

1.1 Address code:

The address code is the first byte (8 bits) of each communication information frame, from 0 to 255. This byte indicates that the slave with the address set by the user will receive and send by the master

Information coming. Each slave must have a unique address code, and only the slaves that match the address code can respond to the return message. When the slave sends back information, send back

The data all start with their respective address codes. The address code sent by the master indicates the address of the slave to be sent, and the address code returned by the slave indicates the address of the returned slave.

The corresponding address code indicates where the information comes from.

1.2 Function code:

It is the second byte transmitted in each communication information frame. ModBus communication protocol can define function codes from 1 to 127. Send as host request, through function

The code tells the slave what action should be performed. As the slave response, the function code returned by the slave is the same as the function code sent from the master, and it indicates that the slave has responded to the ma

And related operations have been carried out.

Table 8.1 Some function codes of MODBUS

function code definition Operation (binary)

02 Read switch input DI Read the number of one or more switch status inputs (remote signal)
01 Read status output OUT Read one or more switch output status data
03 Read register data Read the data of one or more registers
05 Write switch output OUT Control a relay "on/off" output, remote control
06 Write single register Write a set of binary data to a single register
10 Write multiple register Write multiple sets of binary data to multiple registers

1.3 Data area:

The data area includes what kind of information or actions need to be sent back from the slave. The information can be data (such as: switch input/output, analog input/

Output, register, etc.), reference address, etc. For example, the master tells the slave to return the value of the register through the function code 03 (including the starting address of the register to be read)

And read the length of the register), the returned data includes the data length and data content of the register. For different slaves, the address and data information are different

Page 4

(The communication information table should be given).

HSPY series power supply adopts Modbus communication protocol, and the host (PLC, RTU, PC, DCS, etc.) uses communication commands (function code 03), which can
It is intended to read its data register (see the appendix for its data information table).

The command format of HSPY response is slave address, function code, data area and CRC code. The data in the data area is two bytes, and the high order is first.
4. Dead time requirement

Before sending data, the static time of the data bus is required, that is, the time of no data transmission is greater than (5ms at 9600 baud rate).

2. Introduction to MODBUS function codes (HSPY programmable power supply only supports the following function codes)

2.1 Function code "03": read multi-channel register input

For example: the master wants to read the data of 2 slave registers with address 01 and starting address 1000.

The address and data of the slave data register are:

Register address Register data (hexadecimal) Corresponding parameters


1000 0E10(36.00V) Set-U

https://translate.googleusercontent.com/translate_f 3/5
30/1/2021 Note (this machine only supports function codes 03, 10, 06)
1001 0BB8(3.000A) Set_I

The message format sent by the host:


Host send Number of bytes Information sent Remarks
Slave address 1 00 Send to the slave with address 01
function code 1 03 Read register
starting address 2 1000 Start address is 0000
Read data length 2 0002 Read 2 registers (4 bytes in total)
CRC code 2 C11A CRC code calculated by the host

The message format returned by the slave in response:


Slave response Information remarks returned by the number of bytes
Slave address 1 00 From slave 01
function code 1 03 Read register
Data length (word 1 04 4 bytes in total
Section number)
Number of register 12 0E10 The contents of the address 0000 register
according to
Number of register 2 C0CB The contents of the address 0001 register
according to
CRC code 2 F849 CRC code calculated by the slave

2.5 Function code " 10 ": write multiple registers

The host uses this function code to save multiple data to the data memory of the HSPY power supply. Register in Modbus communication protocol
Refers to 16 bits (that is, 2 bytes), with the high order first. In this way, the memory of HSPY is two bytes.
For example: the master wants to save 0E10 to the slave register at address 1000 (the slave address code is 01).

The message format sent by the host:

Host send Number of bytes Information sent Remarks

Slave address 1 00 Send to the slave with address 01

Page 5

function code 1 10 Write multiple register

starting address 2 1000 Start address of the register to be written

Save data length 2 0001 Word length to save data

Save data byte length 1 02 The byte length of the saved data (2 bytes)

Save data 1 2 0E10 Data to be written to address 1000

CRC code 2 BFAD CRC code calculated by the host

The message format returned by the slave in response:

Slave response Number of bytes Information sent Remarks

Slave address 1 00 Send to the slave with address 01

function code 1 10 Write multiple register

starting address 2 1000 Start address of the register to be written

Save data length 2 0001 Word length to save data

CRC code 2 04DB CRC code calculated by the slave

3. Error check code ( CRC check):

The master or slave can use the check code to judge whether the received information is correct. Due to electronic noise or some other interference, information sometimes occurs during transmission

Error, error check code (CRC) can check whether the information of the master or slave in the communication data transmission process is wrong, and the wrong data can be abandoned (whether it is

Sending or receiving), which increases the safety and efficiency of the system.

The CRC (redundant cyclic code) of the MODBUS communication protocol contains 2 bytes, that is, a 16-bit binary number. The CRC code is calculated by the sending device (host) and put
Placed at the end of the transmitted information frame. The device (slave) receiving the information recalculates the CRC of the received information, and compares whether the calculated CRC is with the received

Match, if the two do not match, it means an error.

● The calculation method of CRC code is:

https://translate.googleusercontent.com/translate_f 4/5
30/1/2021 Note (this machine only supports function codes 03, 10, 06)
1. Preset a 16-bit register as hexadecimal FFFF (that is, all 1); call this register a CRC register;
2. XOR the first 8-bit binary data (that is, the first byte of the communication information frame) with the lower 8 bits of the 16-bit CRC register, and
The result is placed in the CRC register;
3. Shift the content of the CRC register one bit to the right (toward the low bit) and fill the highest bit with 0, and check the shifted out bit after the right shift;
4. If the shifted bit is 0: repeat step 3 (shift one bit to the right again); if the shifted bit is 1: CRC register and polynomial A001 (1010
0000 0000 0001) XOR;
5. Repeat steps 3 and 4 until the right shift is 8 times, so that the entire 8-bit data is processed;
6. Repeat steps 2 to 5 to process the next byte of the communication information frame;
7. After all bytes of the communication information frame are calculated according to the above steps, the high and low bytes of the 16-bit CRC register obtained are exchanged;
8. The final content of the CRC register is: CRC code.

Beijing Hansheng Puyuan Technology Co., Ltd.

October 2018

https://translate.googleusercontent.com/translate_f 5/5

You might also like