Professional Documents
Culture Documents
Note (This Machine Only Supports Function Code 03, 10, 06)
Note (This Machine Only Supports Function Code 03, 10, 06)
Page 1
HSPY3603 instrument uses RS232 or RS485 transmission standard to communicate with computer. The detailed information is as follows:
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
Value
Value
3 U 0-65535 2 r 0002h
Power supply voltage display
Indication
4 I 0-65535 3 r 0003h
Power current display
Indication
Page 3
Note: Both 1000H and 0000H address power supplies are supported
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
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)
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.
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.
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
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
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
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)
For example: the master wants to read the data of 2 slave registers with address 01 and starting address 1000.
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 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).
Page 5
Save data byte length 1 02 The byte length of the saved data (2 bytes)
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
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.
October 2018
https://translate.googleusercontent.com/translate_f 5/5