1. Baud rate 9600, odd parity check
485 communication protocol of the power module (ver. 1.0)
2. Content of one frame: Start flag 0X7E, Device Type, Address, Data, CRC, termination flag OXOD.
3. Device Type, Address, Data and CRC will be sent in ASCII code. For each byte, high four ASCII code will be sent first, and then low four ASCII code.
4. Start flag 0X7E and termination flag 0X0D will be sent in binary code.
5. CRC code is a 8 bits cyclic redundancy check code based on the ASCII codes of DeviceType, Address and Data. Please refer to the appendix to this document for the check algorithm.
6. Master module actively sends data and waits the slave module to respond. The slave module should respond within 100ms, otherwise, the master module will send command of next frame in 200ms.
7. The address in message from master module to slave module is between 0X01 to 0XEF, while the address in message from the slave module to the master module is fixed at 0XF0.
Start flag
|
DeviceType
|
485 Address
|
|
|
|
|
|
|
|
|
|
Data
|
|
|
|
|
CRC
|
Termination flag
|
0X7E
|
DeviceType ( 0 – 255 )
PowerSupply – 0
|
Broadcasr – 0 Module – (1– EF)
Note: when 485 address
is 0, then it’s broadcast command.
It can only be used in setting commands.
|
Byte1
765
Group Address GroupAddress
(1-15)
|
4
|
32
MessageType
SetData – 0
SetDataRespo
|
1
nse – 1
|
0
|
Byte2
CommandType
(The unit of voltage is mV, and the unit of current is mA.)
Vout, --0(current output voltage of the module, readable)
Iout,--1(current output current, readable)
|
Byte3Byte4 CommandData
0x12345678—12
0x1234—00 00 1
|
Byte5
34 56
2 34
|
Byte6
78
|
|
0X0D
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
That is command whose messageType is
SetData.
In such case, the slave module doesn’t respond. All other commands must
specify the address of power module.
|
|
|
ReadData – 2
ReadDataResponse – 3
|
VoutReference, --2(set output voltage of the module, readable and writable)
IoutLimit, --3(set output current of the module, readable and writable)
ShutDownDCDC, -- 4(ON/OFF setting of the module)
|
|
|
|
Interpretation of 485 communication protocol:
1. The protocol for setting output voltage of the module is as follows: to set the output voltage as 475.55V, CommandType(VoutReference) = 2
Start flag
|
DeviceType
|
485
|
Byte1
|
Byte2
|
Byte3
|
Byte4
|
Byte5
|
Byte6
|
CRC
|
Termination address
|
0x7E
|
0x00
|
0x01
|
0x10
|
0x02
|
0x00
|
0x07
|
0x41
|
0x9E
|
|
0x0D
|
|
|
|
|
|
0x7419E
|
|
|
After received the data, the module will respond 485 console with follow message:
Start flag
|
DeviceType
|
485
|
Byte1
|
Byte2
|
Byte3
|
Byte4
|
Byte5
|
Byte6
|
CRC
|
Termination address
|
0x7E
|
0x00
|
0x01
|
0x11
|
0x02
|
0x00
|
0x07
|
0x41
|
0x9E
|
|
0x0D
|
|
|
|
|
|
0x7419E
|
|
|
Note: when setting the output voltage of the module, the master unit will send a series of data to the module, and then the module will respond with related data. During setting, the only difference between the command data and the response data is the high four bytes in Byte 1. At the same time, the setting output voltage value will be included in the response data.
The voltage value in the command from the master unit is the product of actual value and 1000, i.e., 475.55*1000=475550, which can be represented as 0x7419E in hexadecimal.
2. Command to read current output voltage of the module: CommandType(Vout) = 0
Start flag
|
DeviceType
|
485
|
Byte1
|
Byte2
|
Byte3
|
Byte4
|
Byte5
|
Byte6
|
CRC
|
Termination address
|
0x7E
|
0x00
|
0x01
|
0x12
|
0x00
|
0x00
|
0x00
|
0x00
|
0x00
|
|
0x0D
|
After received the data, the module will respond 485 console with follow message:
Start flag
|
DeviceType
|
485
|
Byte1
|
Byte2
|
Byte3
|
Byte4
|
Byte5
|
Byte6
|
CRC
|
Termination address
|
0x7E
|
0x00
|
0x01
|
0x13
|
0x00
|
|
|
|
|
|
0x0D
|
|
|
|
|
|
Get current voltage
|
|
|
Note: when reading the voltage of the module, the actual voltage is obtained by having the returned voltage value divided by 1,000.
3. Command to read current output current of the module: CommandType(Iout) = 1
Start flag
|
DeviceType
|
485
|
Byte1
|
Byte2
|
Byte3
|
Byte4
|
Byte5
|
Byte6
|
CRC
|
Termination address
|
0x7E
|
0x00
|
0x01
|
0x12
|
0x01
|
0x00
|
0x00
|
0x00
|
0x00
|
|
0x0D
|
After received the data, the module will respond 485 console with follow message:
Start flag
|
DeviceType
|
485
|
Byte1
|
Byte2
|
Byte3
|
Byte4
|
Byte5
|
Byte6
|
CRC
|
Termination address
|
0x7E
|
0x00
|
0x01
|
0x13
|
0x01
|
|
|
|
|
|
0x0D
|
|
|
|
|
|
Get the current at present
|
|
|
Note: when reading the current of the module, the actual current is obtained by having the returned current value divided by 1,000.
4. Command to set current limiting point of the module, for example, to set the current limiting point at 10.5A, CommandType(IoutLimit) = 3
Start flag
|
DeviceType
|
485
|
Byte1
|
Byte2
|
Byte3
|
Byte4
|
Byte5
|
Byte6
|
CRC
|
Termination address
|
0x7E
|
0x00
|
0x01
|
0x10
|
0x03
|
0x00
|
0x00
|
0x29
|
0x04
|
|
0x0D
|
|
|
|
|
|
0x2904
|
|
|
After received the data, the module will respond 485 console with follow message:
Start flag
|
DeviceType
|
485
|
Byte1
|
Byte2
|
Byte3
|
Byte4
|
Byte5
|
Byte6
|
CRC
|
Termination address
|
0x7E
|
0x00
|
0x01
|
0x12
|
0x03
|
0x00
|
0x00
|
0x29
|
0x04
|
|
0x0D
|
|
|
|
|
|
0x2904
|
|
|
Note: The value of current limiting point in the command from the master unit is the product of actual value and 1000, i.e., 10.5*1000=10500, which can be transformed into 0x2904 in hexadecimal.
5. ON/OFF setting of the module: CommandType(ShutDownDCDC) = 4
Start flag
|
DeviceType
|
485
|
Byte1
|
Byte2
|
Byte3
|
Byte4
|
Byte5
|
Byte6
|
CRC
|
Termination address
|
0x7E
|
0x00
|
0x01
|
0x10
|
0x04
|
0x00
|
0x00
|
0x00
|
0x00
|
|
0x0D
|
Setting of module power off: CommandType(ShutDownDCDC) = 4
Start flag
|
DeviceType
|
485
|
Byte1
|
Byte2
|
Byte3
|
Byte4
|
Byte5
|
Byte6
|
CRC
|
Termination address
|
0x7E
|
0x00
|
0x01
|
0x10
|
0x04
|
0x00
|
0x00
|
0x00
|
0x01
|
|
0x0D
|
Note: the default address of 485 is 0x01. You can read the actual address of 485 from Axx on the panel;
Appendix (CRC8 algorithm)
/* Note: input Pmsg is the head address of the byte to be checked. Input MsgSize is the number of bytes to be checked.
The output is CRC of 8 bits binary code.
In 485 protocol, this binary code is transmitted in ASCII form. */
#define CRC8_POLY0x07
Uint8 Crc8(Uint8 *Pmsg, Uint8 MsgSize)
{
Uint16 i, j, carry; Uint16 msg,CRC,Poly;
Poly = CRC8_POLY ;
CRC = *Pmsg++;// first byte loaded in "crc" for(i = 0 ; i < MsgSize-1 ; i ++)
{
msg = *Pmsg++;// next byte loaded in "msg" for(j = 0 ; j < 8 ; j++)
{
carry = CRC & 0x80;// check if MSB=1
CRC = (CRC << 1) | (msg >> 7);// Shift 1 bit of next byte into crc if(carry) CRC ^= Poly;// If MSB = 1, perform XOR
msg <<= 1;// Shift left msg byte by 1
msg &= 0x00FF;
}
}
// The previous loop computes the CRC of the input bit stream. To this,
// 8 trailing zeros are padded and the CRC of the resultant value is
// computed. This gives the final CRC of the input bit stream. for(j = 0 ; j < 8 ; j++)
{
carry = CRC & 0x80; CRC <<= 1;
if(carry) CRC ^= Poly;
}
CRC &= 0x00FF;//We only want one byte (lower) return(CRC);
}