Anda di halaman 1dari 14

MODBUS Communication Protocol of Coslight 48V BMS & Upper Computer 1/14

MODBUS Communication Protocol of Coslight


48V BMS & Upper Computer
(Simplified Version)

Version: V1.1
Drafter:Zhang Shibing
Date: 2017/07/13
MODBUS Communication Protocol of Coslight 48V BMS & Upper Computer 2/14

MODBUS Communication Protocol of Harbin Coslight 48V BMS & Upper Computer
1. Communication Interface
1.1 Communication Mode:RS485.
1.2 Baud Rate:19200B/S.
1.3 Character Format:8 Data, 1 Stop, no parity checking.
1.4 Internal:100mS~1S, Default:500mS.
1.5 Commands sending and transmission modes are as follows:

2.Frame
2.1 Frame Structure
Frame structure is shown in the following picture. Each frame consists of Address: 1 Byte, Function code:1
Byte, Data: N Bytes, CRC:2 Bytes, adopts RTU mode of MODBUS protocol, and communication frames are
transmitted in the form of HEX codes.
Address Function Code Data Cyclical
(ADDR) (FC) (DATA) Redundancy
Check
(CRC)
2.2 Address(ADDR)
Address is the first byte of the communication information frame. It refers to the address of the BMS unit,
and its range is 1-15, and the address value is settable. In addition, only the slave BMS whose address
accords can respond and return the corresponding information.
2.3 Function code
Function code is the second byte of the communication information frame, the command code sent to BMS unit is
monitored.
MODBUS Communication Protocol of Coslight 48V BMS & Upper Computer 3/14
2.4 Data
The downlink command frame is the additional information of the command, and the uplink response frame is the
specific data.
2.5 Checking
CRC, CRC generated function. Please see the Appendix.
3. Data format details are as follows:
: 3.1:Sending command:
Slave Start Addr Start Addr Data No. Data No. CRC CRC
Addr FC (High) (Low) (High) (Low) (Low) (High)
8bit 8bit 8bit 8bit 8bit 8bit 8bit 8bit
3.1.1: Slave Address :The address range of BMS is 1~15, and it is settable.
3.1.2:FC:Function command code.
3.1.3:Start Address:The start address is the address of slave register, and it contains two bytes: start
addr(high) & start addr(low). Please see the Appendix to see its specific range.
3.1.4:Data No.:The data no. is the number of register nodes, and it includes two bytes: data no. high & data
no. low. The reading of register can be continuous according to data no.
3.1.5:CRC:CRC includes two bytes: CRC(low) & CRC(high), and it is used to verify the correctness of the read
data.
3.2 Response command:
Data_1: Data_1: Data_n: Data_n:
Slave Byte Register Register Register Register CRC CRC
Addr FC No. (High) (Low) (High) (Low) (Low ) (High)

8bit 8bit 8bit 8bit 8bit 8bit 8bit 8bit 8bit


3.3 Abnormal Response Command:
Slave Addr FC Error Code CRC(Low) CRC(High)
8bit 80h 8bit 8bit 8bit
Error Code:
3.3.1:0x01H: FC does not exist.
3.3.2:0x02H: Address code does not exist.
3.3.3:0x03: Operation is not permitted.

4. Command Description
MODBUS Communication Protocol of Coslight 48V BMS & Upper Computer 4/14
Each command must be sent strictly according to the following format, and the monitoring unit responds in response
format, otherwise the monitoring unit returns the error code. –- filling according to actual numerical value.
4.1 Read‘Register’of ‘Slave’,read telemetering(AI) command 0x04H(reading analogue)
Designate the start address and number of the register which is to be read.
Master Field Field description
Sending Value
Slave Addr 1~15 Address: 1~15
FC 04H FC: 04
Start Addr 0X Start Addr (high)
(high) Start Addr (low)
Start Addr 0X
(low)
Data 0X Data no. high byte, data byte low
No.(high) byte
Data No.(low) 0X E.g. the number of read register is one.
CRC(low) CRCLo CRC low byte, CRC high byte
CRC(high) CRCHi CRC is calculated by Master
Response Command:
Slave Response Field Value Field Description
Slave Addr 1~15 Address:1~15
FC 04H FC: 04
Byte No. 02H Response Data Bytes
Data DHi Data Byte(high), Data Byte(low)
Byte(high) The data in register address 00
Data DLo
Byte(low)
CRC(low) CRCLo CRC(low), CRC(high)
CRC(high) CRCHi CRC is calculated by Slave
For the detailed content, please see the Appendix A
4.2 Read Telecommunicating(DI)command 0x02H(INPUT STATUS)(Reading alarm)
This function code is used to read the 0 to 159 discrete inputs of continuous state.
Request command:Request instance:0~21
MODBUS Communication Protocol of Coslight 48V BMS & Upper Computer 5/14
Master Sending Field Field Description
Value
Slave Addr 1~15 Address: 1~15
FC 02H FC:02
Start Addr 00 Start address high byte
(high) Start address low byte
Start Addr 00H
(low)
Output 00 Output quantity high byte
Qty.(high) Output quantity low byte
Output 16
Qty.(low)
CRC(high) CRCLo CRC low byte
CRCHi CRC high byte, CRC is calculated by
CRC(low) Master.

Response Command:
Field Field Description
Slave Response
Value
Slave Address 1~15 Address:1~15
FC 02H FC:02
No. of bytes 03H The number of response data bytes
Input State7~0 AC
Input State15~8 DB
Input State 21~16 35
CRC(high) CRCLo CRC low byte
CRCHi CRC high byte
CRC(low) CRC is calculated by Slave.
The discrete quantity input state 7-0 are represented as a hexadecimal byte value AC or binary 10101100. The
input 4 is the MSB of this byte, and the input 0 is the LSB of this byte.
The discrete quantity input state 21-16 is represented as a hexadecimal byte value of 35 or binary 00110101.
Input 21 at the 3rd bit of the left side, and input 16 is the LSB.
Note: Fill in the remaining 2 bits with zero (up to the high bit end).
MODBUS Communication Protocol of Coslight 48V BMS & Upper Computer 6/14
For each DI, please see Appendix B.
Read the 'register' function code from 'slave': 0x03H (HOLDING, REGISTER) (read system parameters)
Inquiry information specifies the start address and number of the registers to read. The
register address starts at zero.
Master Field Field Description
Sending Valve
Slave Addr 1~15 Address: 1~15
FC 03H FC: 03
Start Addr 00 Start address high byte
(high) Start address low byte
Start Addr 00 Start Address:00
(low)
Data No. 00 Data no. high byte, data no.low
(high) byte
Data No. 0X E.g. the number of read register is one.
(low)
CRC(high) CRCLo CRC low byte
CRCH i CRC high byte
CRC(low) CRC is calculated by Master.
Response Command
Slave Response Field Value Field Description
Slave Addr 1~15 Address: 1~15
FC 03H FC: 03
Byte No. 02H The number of response data bytes
Data DHi Data high byte, Data low byte,
Byte(high) The data in address 00 of register.
Data DLo
Byte(low)
CRC(low) CRCLo CRC low byte, CRC high byte
CRC(high) CRCHi CRC is calculated by Slave.
The register data are arranged in the response frame according to register /2 byte. High byte is in the front,
and low byte is in the back. Please see Appendix C for the detailed content.
MODBUS Communication Protocol of Coslight 48V BMS & Upper Computer 7/14
Remarks: Every time, the max. quantity of the registers being read is 128(256 bytes).
Appendix A:Read-only register
1:模拟寄存器 Analog Register
寄存器地址 信号名称 数据类型 单位 设置范围 上传值 &显示值
Register Signal Name Data Type Unit Setting Range Uploaded value &
Addr Displayed Valve
27. 电池组中最大单体电压值 Uint16
Cell_V_max
mV 0~5000 3350#3350
28. 电池组中最小单体电压值 Uint16
Cell_V_min
29. 电芯平均电压 Uint16 mV 0~5000 3350#3350
Cell_Average_V
30. 电池组中最高温度值 int16
T_max
℃ -30~120 5#5
31. 电池组中最低温度值 int16
T_min
32. 电池组电压值 Uint16 V 0~7000 5028#50.28
Total_Voltage
33. 母线电压值 Uint16 V 0~7000 5028#50.28
Pack_Voltage
34. 电池组充电电流值 CH(A) Uint16
A 0~60000 1234#12.34
35. 电池组放电电流值 DCH(A) Uint16
36. SOC值 Uint16 - 0~100 60#60
SOC%
37. 健康状态 Uint16 % 0~100 50#50
SOH
38. 额定容量值 Uint16 AH 10~65000 12345#123.45
Rated capacity
39. 剩余容量值高字节 Uint16 AH 0~65000 12345#123.45
Remaining capacity
40. 剩余容量值低字节 Uint16
Remaining capacity
41. 累计充电容量高字节 Uint16 AH - 12345#123.45
ACC_CH_AH high byte
42. 累计充电容量低字节 Uint16
MODBUS Communication Protocol of Coslight 48V BMS & Upper Computer 8/14
ACC_CH_AH low byte
43. 累计放电容量高字节 Uint16 AH - - 12345#123.45
ACC_DCH_AH high byte
44. 累计放电容量低字节 Uint16
ACC_DCH_AH low byte
45. 累计充电KWH 高字节 Uint16 KWH 1000#1.0KWH
ACC_CH_KWH high byte
46. 累计充电KWH 低字节 Uint16 KWH
ACC_CH_KWH low byte
47. 累计放电KWH高字节 Uint16 KWH
ACC_DCH_KWH high byte
48. 累计放电KWH低字节 Uint16 KWH
ACC_DCH_KWH low byte
49. 运行时间高字节 Uint16 H 1#1 Hour
Running Time High Byte
50. 运行时间低字节 Uint16 H 1#1 Hour
Running Time Low Byte
51. 备电时间 Backup Time Uint16 H 1#1 Hour
52. 充电循环次数 Uint16 1#1
100%DOD CH_CYCLE
53. 放电循环次数 Uint16
100%DOD DCH_CYCLE
54. 电池模块充电限流值 Uint16 A 375#37.5
BB CH limit Current Value
55. 电池组号 Uint16 1#1
Battery.NO
MODBUS Communication Protocol of Coslight 48V BMS & Upper Computer 9/14

Appendix B:DI
寄存器地址 位号 Bit No. 遥信量名称(字节9低)Telecommunicating Data Name.(Byte 9- low) 0 1
128. B0 系统电池组过压告警 Total voltage OV Alarm 正常Normal 告警Alarm
129. B1 系统电池组欠压告警 Total voltage UV Alarm 正常Normal 告警Alarm
130. B2 系统电池组过压保护 Total voltage OV Protection 正常Normal 保护 Protection
131. B3 系统电池组欠压保护 Total voltage UV Protection 正常Normal 保护 Protection
132. B4 系统充电过流告警 BB_CH_OC Alarm 正常Normal 告警Alarm
133. B5 系统放电过流告警 BB_DCH_OC Alarm 正常Normal 告警Alarm
134. B6 系统充电过流保护 BB_CH_OC Protection 正常Normal 保护 Protection
135. B7 系统放电过流保护 BB_DCH_OC Protection 正常Normal 保护 Protection
位号 Bit No. 遥信量名称(字节9高)Telecommunicating Data Name.(Byte 9-high) 0 1
136. B8 SOC 低告警 SOC_Low Alarm 正常Normal 告警Alarm
137. B9 硬件短路保护告警 Short Circuit Protection 正常Normal 告警Alarm
138. B10 (保留)保险丝/接触器断开告警 FUSE cut off Alarm 正常Normal 告警Alarm
139. B11 MOSFET 过温告警 MOSFET_OT_ Alarm 正常Normal 告警Alarm
140. B12 MOSFET 过温保护 MOSFET_OT_Protection 正常Normal 保护 Protection
141. B13 WIFI模块状态 WI-FI work OK/Fail 正常Normal 异常 Error
142. B14 WIFI模块是否存在 WI-FI Available/No Available 无 No 有 Yes
143. B15 保留 NC
位号 Bit No. 遥信量名称(字节 10 低)Telecommunicating Data Name(Byte 10-low). 0 1
144. B0 单体过压告警 Cell_OV_ Alarm 正常Normal 告警Alarm
145. B1 单体欠压告警 Cell_UV_ Alarm 正常Normal 告警Alarm
146. B2 单体过压保护 Cell_OV_Protection 正常Normal 保护 Protection
147. B3 单体欠压保护 Cell_UV_Protection 正常Normal 保护 Protection
148. B4 单体充电过温告警 Cell_CH_OT_ Alarm 正常Normal 告警Alarm
149. B5 单体充电低温告警 Cell_CH_UT_ Alarm 正常Normal 告警Alarm
150. B6 单体充电高温保护 Cell_CH_OT_Protection 正常Normal 保护 Protection
151. B7 单体充电低温保护 Cell_CH_UT_Protection 正常Normal 保护 Protection
位号 Bit No. 遥信量名称(字节10高)Telecommunicating Data Name(Byte 10-high). 0 1
152. B8 单体放电高温告警 Cell_DCH_OT_ Alarm 正常Normal 告警Alarm
153. B9 单体放电低温告警 Cell_DCH_UT_ Alarm 正常Normal 告警Alarm
154. B10 单体放电高温保护 Cell_DCH_OT_Protection 正常Normal 保护 Protection
155. B11 单体放电低温保护 Cell_DCH_UT_Protection 正常Normal 保护 Protection
MODBUS Communication Protocol of Coslight 48V BMS & Upper Computer 10/14
156. B12 保留 NC 无 No 有 Yes
157. B13 保留 NC 正常Normal 异常 Error
158. B14 保留 NC 停止Stop 启动Start
159. B15 保留 NC - -
MODBUS Communication Protocol of Coslight 48V BMS & Upper Computer 11/14

附录C: 读/写寄存器
Appendix C: Read/Write Register
1:参数配置寄存器 0 + 寄存器地址
Parameter configuration register 0 + register address
Parameter Register
寄存器地址 数据类型 字节数 数据上传值#直实值
名称 单位 设置范围 默认设置
Register Data BYTE Uploaded Value &
Name Unit Value Range Default Setting
Addr Type Actual Value
电池生产日期(年) 2 0~9999
45. Uint16 - 2015#2015
Manufacture year
电池生产日期(月) 2 1~12
46. Uint16 1#01
Manufacture month
电池生产日期(日) 2 1~31
47. Uint16 2#02
Manufacture day
箱体编号高字节 2 0~65535
48. Uint16 -
Group.NO
123#123
箱体编号低字节 2 0~65535
49. Uint16 -
Group.NO
软件版本号 2 0~65535
51. Uint16 - 101#1.01
Software.NO
注释:1,系数计算 下发校准系数 = (实测值/读取值)*读取系数;
Note: 1, Coefficient calculation Calibration coefficient = (Actual value/Read-out value)* Reading coefficient
MODBUS Communication Protocol of Coslight 48V BMS & Upper Computer 12/14

附录F:CRC校验
Appendix F: CRC Checking
WORD ModbusCRC(BYTE * pData, BYTE len)
{
BYTE byCRCHi = 0xff;
BYTE byCRCLo = 0xff;
BYTE byIdx; 0x003C
WORD crc;
while(len--)
{
byIdx = byCRCHi ^* pData++;
byCRCHi = byCRCLo ^ gabyCRCHi[byIdx];
byCRCLo = gabyCRCLo[byIdx];
}
crc = byCRCHi;
crc <<= 8;
crc += byCRCLo;
return crc;
}
CRC码表高字节
CRC code High Byte

BYTE gabyCRCHi[] =
{
0x00,0xc1,0x81,0x40,0x01,0xc0,0x80,0x41,0x01,0xc0,
0x80,0x41,0x00,0xc1,0x81,0x40,0x01,0xc0,0x80,0x41,
0x00,0xc1,0x81,0x40,0x00,0xc1,0x81,0x40,0x01,0xc0,
0x80,0x41,0x01,0xc0,0x80,0x41,0x00,0xc1,0x81,0x40,
0x00,0xc1,0x81,0x40,0x01,0xc0,0x80,0x41,0x00,0xc1,
0x81,0x40,0x01,0xc0,0x80,0x41,0x01,0xc0,0x80,0x41,
0x00,0xc1,0x81,0x40,0x01,0xc0,0x80,0x41,0x00,0xc1,
0x81,0x40,0x00,0xc1,0x81,0x40,0x01,0xc0,0x80,0x41,
MODBUS Communication Protocol of Coslight 48V BMS & Upper Computer 13/14
0x00,0xc1,0x81,0x40,0x01,0xc0,0x80,0x41,0x01,0xc0,
0x80,0x41,0x00,0xc1,0x81,0x40,0x00,0xc1,0x81,0x40,
0x01,0xc0,0x80,0x41,0x01,0xc0,0x80,0x41,0x00,0xc1,
0x81,0x40,0x01,0xc0,0x80,0x41,0x00,0xc1,0x81,0x40,
0x00,0xc1,0x81,0x40,0x01,0xc0,0x80,0x41,0x01,0xc0,
0x80,0x41,0x00,0xc1,0x81,0x40,0x00,0xc1,0x81,0x40,
0x01,0xc0,0x80,0x41,0x00,0xc1,0x81,0x40,0x01,0xc0,
0x80,0x41,0x01,0xc0,0x80,0x41,0x00,0xc1,0x81,0x40,
0x00,0xc1,0x81,0x40,0x01,0xc0,0x80,0x41,0x01,0xc0,
0x80,0x41,0x00,0xc1,0x81,0x40,0x01,0xc0,0x80,0x41,
0x00,0xc1,0x81,0x40,0x00,0xc1,0x81,0x40,0x01,0xc0,
0x80,0x41,0x00,0xc1,0x81,0x40,0x01,0xc0,0x80,0x41,
0x01,0xc0,0x80,0x41,0x00,0xc1,0x81,0x40,0x01,0xc0,
0x80,0x41,0x00,0xc1,0x81,0x40,0x00,0xc1,0x81,0x40,
0x01,0xc0,0x80,0x41,0x01,0xc0,0x80,0x41,0x00,0xc1,
0x81,0x40,0x00,0xc1,0x81,0x40,0x01,0xc0,0x80,0x41,
0x00,0xc1,0x81,0x40,0x01,0xc0,0x80,0x41,0x01,0xc0,
0x80,0x41,0x00,0xc1,0x81,0x40
};
CRC码表高字节
CRC code High Byte

BYTE gabyCRCLo[] =
{
0x00,0xc0,0xc1,0x01,0xc3,0x03,0x02,0xc2,0xc6,0x06,
0x07,0xc7,0x05,0xc5,0xc4,0x04,0xcc,0x0c,0x0d,0xcd,
0x0f,0xcf,0xce,0x0e,0x0a,0xca,0xcb,0x0b,0xc9,0x09,
0x08,0xc8,0xd8,0x18,0x19,0xd9,0x1b,0xdb,0xda,0x1a,
0x1e,0xde,0xdf,0x1f,0xdd,0x1d,0x1c,0xdc,0x14,0xd4,
0xd5,0x15,0xd7,0x17,0x16,0xd6,0xd2,0x12,0x13,0xd3,
0x11,0xd1,0xd0,0x10,0xf0,0x30,0x31,0xf1,0x33,0xf3,
0xf2,0x32,0x36,0xf6,0xf7,0x37,0xf5,0x35,0x34,0xf4,
0x3c,0xfc,0xfd,0x3d,0xff,0x3f,0x3e,0xfe,0xfa,0x3a,
MODBUS Communication Protocol of Coslight 48V BMS & Upper Computer 14/14
0x3b,0xfb,0x39,0xf9,0xf8,0x38,0x28,0xe8,0xe9,0x29,
0xeb,0x2b,0x2a,0xea,0xee,0x2e,0x2f,0xef,0x2d,0xed,
0xec,0x2c,0xe4,0x24,0x25,0xe5,0x27,0xe7,0xe6,0x26,
0x22,0xe2,0xe3,0x23,0xe1,0x21,0x20,0xe0,0xa0,0x60,
0x61,0xa1,0x63,0xa3,0xa2,0x62,0x66,0xa6,0xa7,0x67,
0xa5,0x65,0x64,0xa4,0x6c,0xac,0xad,0x6d,0xaf,0x6f,
0x6e,0xae,0xaa,0x6a,0x6b,0xab,0x69,0xa9,0xa8,0x68,
0x78,0xb8,0xb9,0x79,0xbb,0x7b,0x7a,0xba,0xbe,0x7e,
0x7f,0xbf,0x7d,0xbd,0xbc,0x7c,0xb4,0x74,0x75,0xb5,
0x77,0xb7,0xb6,0x76,0x72,0xb2,0xb3,0x73,0xb1,0x71,
0x70,0xb0,0x50,0x90,0x91,0x51,0x93,0x53,0x52,0x92,
0x96,0x56,0x57,0x97,0x55,0x95,0x94,0x54,0x9c,0x5c,
0x5d,0x9d,0x5f,0x9f,0x9e,0x5e,0x5a,0x9a,0x9b,0x5b,
0x99,0x59,0x58,0x98,0x88,0x48,0x49,0x89,0x4b,0x8b,
0x8a,0x4a,0x4e,0x8e,0x8f,0x4f,0x8d,0x4d,0x4c,0x8c,
0x44,0x84,0x85,0x45,0x87,0x47,0x46,0x86,0x82,0x42,
0x43,0x83,0x41,0x81,0x80,0x40
};

Anda mungkin juga menyukai