取消
清空記錄
歷史記錄
清空記錄
歷史記錄
取消
清空記錄
歷史記錄
清空記錄
歷史記錄
ModBUS串口協(xié)議
(ModBUS Serial port protocol)
1、通訊協(xié)議(Communication protocol):
采用異步主從半雙工方式通訊,上位機(jī)作為主站,驅(qū)動(dòng)器作為從站進(jìn)行工作,由主站發(fā)起詢問(wèn)(發(fā)起通訊),從站在接到主站請(qǐng)求后作相應(yīng)的應(yīng)答,只有當(dāng)接收到的字節(jié)滿足協(xié)議要求時(shí),驅(qū)動(dòng)器才返回?cái)?shù)據(jù),否則不應(yīng)答。主要協(xié)議如表1所示。(Using asynchronous master semi-duplex communication, the upper machine as the main station, the drive as the slave station to work, by the master station to initiate inquiry (initiate communication), the slave station after receiving the request from the master station, only when the received bytes meet the protocol requirements, the drive will return data, otherwise do not answer. The main protocol is shown in Table Table 1.)
表1驅(qū)動(dòng)器通訊協(xié)議(Table 1 The drive communication protocol)
名稱(name) | 內(nèi)容(content) | 說(shuō)明(explain) |
接口(joggle) | RS485 | |
驅(qū)動(dòng)器地址 (Drive address) | 0x01-0x1F(1-31) | 數(shù)碼管BS19的設(shè)定值 (Set value of the digital tube BS19) |
波特率 (Baud rate) | 9600,19200,38400,115200 | 數(shù)碼管BS18的設(shè)定值 (Set value of the digital tube BS18) |
數(shù)據(jù)幀格式 (data frame format ) | 1位起始位,8位數(shù)據(jù)位,無(wú)奇偶校驗(yàn)位,1位停止位,無(wú)控制流. (1 bit, 8 bit, no parity bit, 1 bit stop bit, no control flow.) | |
報(bào)文格式 (message format) | 命令字:0x03 (Command word: 0x03) | 讀取單寄存器數(shù)據(jù)命令 (Read the single-register data command) |
命令字:0x06 (Command word: 0x06) | 寫入單寄存器數(shù)據(jù)命令 (Write to a single-register data command) | |
命令字:0x10 (Command word: 0x10) | 寫入多寄存器數(shù)據(jù)命令,控制電機(jī)直接運(yùn)行。 (Write the multi-register data command and control the motor to run directly.) | |
注(pour:): 1. 波特率更改后重新上電有效,否則默認(rèn)為剛上電時(shí)的波特率。當(dāng)串行口通訊不暢時(shí),請(qǐng)降低通訊的波特率;(1. After the port rate is changed, the power on is valid, otherwise the default is the wave rate when just power on. When the serial port communication is not smooth, please reduce the port rate of communication;) 2.同一串口線上的多臺(tái)驅(qū)動(dòng)器地址不可重復(fù),否則會(huì)造成通訊錯(cuò)誤,甚至損壞串口芯片。(2. The addresses of multiple drives on the same serial port line cannot be repeated, otherwise it will cause communication errors and even damage the serial port chip.) |
2、命令字:0x03 ,讀取單個(gè)寄存器命令(2, the command word: 0x03, read a single register command),
該命令為讀取驅(qū)動(dòng)器單個(gè)寄存器的命令,主機(jī)請(qǐng)求與驅(qū)動(dòng)器返回格式如下(This command is a command to read a single register of the drive, and the host request and drive return format are as follows:):
表2主機(jī)請(qǐng)求數(shù)據(jù)(命令字0x03)(Table 2 Host request data (command word 0x03))
驅(qū)動(dòng)器地址 (Drive address) | 命令字 (CW) | 寄存器地址 (Register address) | 數(shù)據(jù)長(zhǎng)度 (DL) | 校驗(yàn)碼 (check code) |
1字節(jié) (1 Bytes) | 1字節(jié) (1 Bytes) | 2字節(jié) (高位在前) (2 Bytes;High in front) | 2字節(jié) (高位在前) (2 Bytes;High in front) | 2字節(jié) (低位在前) (2 Bytes;Low in front) |
0x01-0x1F (數(shù)碼管BS19的設(shè)定值) (Set value of digital tube BS19)
| 0x03 | 0x0000 0x0001 … | 0x0002 (固定數(shù)) (Fixed number) | CRCL,CRCH (實(shí)際的CRC數(shù)據(jù)) (Actual CRC data) |
注(pour:): 1. 寄存器地址定義如表4所示(1. Register address is defined as shown in Table 4);
2. CRC校驗(yàn)初值為0xFFFF,多項(xiàng)式為0xA001,低字節(jié)在前。(2. The initial value of CRC check is 0xFFFF, the polynomial is 0 xA 001, and the low bytes are first.)
|
表3驅(qū)動(dòng)器返回的數(shù)據(jù)(命令字0x03)(Table 3 Data returned by the drive (command word 0x03))
驅(qū)動(dòng)器地址 (Drive address) | 命令字 (CW) | 字節(jié)長(zhǎng) (Byte length) | 參數(shù)值 (parameter values) | 校驗(yàn)碼 (check code) |
1字節(jié) (1 Bytes) | 1字節(jié) (1 Bytes) | 1字節(jié) (1 Bytes) | 2字節(jié) (高位在前) (2 Bytes;High in front) | 2字節(jié) (低位在前) (2 Bytes;Low in front) |
0x01-0x1F (與收到的地址一致) ((Consistent with the address received)) | 0x03 | 02 (數(shù)據(jù)長(zhǎng)度2字節(jié)) (Data length: 2 bytes) | XXXX (實(shí)際的寄存器參數(shù)值) (Actual register parameter value) | CRCL,CRCH (實(shí)際的CRC數(shù)據(jù)) (Actual CRC data) |
表4寄存器地址定義(Table 4 Register address definitions)
寄存器地址 (Register address) | 地址定義 (Address definition) | 數(shù)值范圍(括號(hào)內(nèi)為十進(jìn)制數(shù)) Value range (decimal number in parentheses) |
0x0000 | 驅(qū)動(dòng)器工作電流(單位:mA) (Drive operating current (in mA)) | 0x01F4~0x1F40(500~8000) |
0x0001 | 驅(qū)動(dòng)器鎖機(jī)值(單位:%) (Drive Lock Value (in%)) | 0x0005-0x0064(5~100) |
0x0002 | SM為高時(shí)的細(xì)分值(單位:脈沖/轉(zhuǎn),需能被10整除) (SM is subdivided at high value (unit: pulse / turn, must be divisible by 10) ) | 0x00C8~0xEA60(200~60000) |
0x0003 | SM為低時(shí)的細(xì)分值(單位:脈沖/轉(zhuǎn),需能被10整除) (SM is low breakdown (pulse / turn, must be divisible by 10)) | 0x00C8~0xEA60(200~60000) |
0x0004 | 驅(qū)動(dòng)器脈沖工作方式: 0000:正/反轉(zhuǎn)脈沖控制模式,上升沿有效 0001:脈沖+方向控制模式,上升沿有效 0002:正/反轉(zhuǎn)脈沖控制模式,下降沿有效 0003:脈沖+方向控制模式,下降沿有效(默認(rèn)) 其他數(shù)值詳見(jiàn)特殊工作模式。 (Drive pulse operation mode: 0000: Positive / reverse pulse control mode, rising edge effective. 0001: Pulse + direction control mode, the rising edge is effective. 0002: Positive / reverse pulse control mode, effective edge effective. 0003: Pulse + direction control mode, descent valid (default). Other values are shown in the special working mode.) | 0x0000~0x0028(0~40) |
0x0005 | PI控制時(shí)的Kp比例系數(shù) (Kp proportion coefficient for PI control) | 0x0014~0x0960(20~2400) |
0x0006 | PI控制時(shí)的Ki積分系數(shù) (Ki integration coefficient during PI control) | 0x0000~0x0050(0~80) |
0x0007 | 驅(qū)動(dòng)器自測(cè)模式及運(yùn)行狀態(tài)。 (Drive self-test mode and running status.) 1.寫入時(shí)( When writing) 0000:電機(jī)停止(Motor stops) 0003:電機(jī)正轉(zhuǎn)(Motor is turning) 0009:電機(jī)反轉(zhuǎn)(Motor reversal) 3. 讀取時(shí)返回的參數(shù)定義如下( The parameters returned when reading are defined as follows) 高8位(High 8 bits): 00:表示驅(qū)動(dòng)器無(wú)報(bào)警故障 (00: It means that the drive has no alarm fault) 01:表示未檢測(cè)到電機(jī)故障 (01: Indicates that no motor fault was detected) 02:表示驅(qū)動(dòng)器過(guò)熱報(bào)警 (02: indicates the drive overheating alarm ) 03:表示驅(qū)動(dòng)器過(guò)流報(bào)警 (03: indicates the drive overcurrent alarm) 低8位(Low 8 bits): 00:表示電機(jī)停止 (00: indicates a motor stop) 01:表示電機(jī)正在正轉(zhuǎn) (01: It means that the motor is turning forward) 02:表示電機(jī)正在反轉(zhuǎn) (02: Indicates that the motor is reversing ) | 寫命令:0x0003或0x0009 讀取時(shí)返回電機(jī)狀態(tài) (Write the command: 0x0003 or 0x0009;Return to the motor state when reading) |
0x0008 | 電機(jī)延時(shí)時(shí)間。=X*62.5微秒 (Motor time delay time.=X * 62.5 microseconds) 0000:無(wú)延時(shí); (0000: no delay;) 0010:延時(shí)1ms (0010:1ms time delay) 當(dāng)BS04=0004或者0005時(shí),內(nèi)部IO時(shí)電機(jī)加速度與此設(shè)置無(wú)關(guān)。 (When either BS04=0004 or 0005,motor acceleration during internal IO is not related to this setting.) | 0x0000~0x0BB8(0~3000) |
0x000D | 內(nèi)部脈沖時(shí)參數(shù)定義為電機(jī)啟動(dòng)速度(轉(zhuǎn)/分),當(dāng)啟動(dòng)速度高于運(yùn)行速度時(shí),自動(dòng)默認(rèn)為運(yùn)行速度。 (The internal pulse parameter is defined as the motor starting speed (rpm), and when the starting speed is higher than the running speed.) | 0x0000~0x0258(0~600) |
0x000E | 內(nèi)部脈沖時(shí)第一組細(xì)分時(shí),SM=1時(shí),參數(shù)定義為電機(jī)運(yùn)行速度1. (In the first group of internal pulse subdivision, SM=1, the parameter is defined as the motor running speed 1.) | 0x0001~0x0BB8(1~3000) |
0x000F | 內(nèi)部脈沖時(shí)第二組細(xì)分時(shí),SM=0時(shí),參數(shù)定義為電機(jī)運(yùn)行速度2. (In the second group of internal pulse subdivision, SM=0, the parameter is defined as the motor running speed 2. ) | 0x0001~0x0BB8(1~3000) |
0x0010 | 內(nèi)部脈沖時(shí),參數(shù)定義為實(shí)際轉(zhuǎn)動(dòng)需要的脈沖個(gè)數(shù)低四位設(shè)定。 (For the internal pulse, the parameter is defined as the four-lower number of pulses required for the actual rotation.) | 0x0000~0x270F(0~9999) |
0x0011 | 內(nèi)部脈沖時(shí)參數(shù)定義為實(shí)際轉(zhuǎn)動(dòng)需要的脈沖個(gè)數(shù)高四位設(shè)定(十進(jìn)制,1代表十進(jìn)制的10000); (The internal pulse parameter is defined as the number of pulses required by actual rotation (decimal, 1 represents 10000 decimal); ) 9999:自動(dòng)定義為連續(xù)運(yùn)轉(zhuǎn),直至停止信號(hào)到來(lái)。 (9999: It is automatically defined as a continuous operation until the stop signal arrives.) | 0x0000~0x270F(0~9999) |
0x0014 | 內(nèi)部IO運(yùn)行時(shí),設(shè)定電機(jī)的加速度大小. 數(shù)值越大,加速度越大,數(shù)值越小,加速度越小,單位為:10轉(zhuǎn)/分/秒。最低為1,最高為5000 (When the acceleration of the motor is set during the internal IO operation.The larger the value, the greater the acceleration, the smaller the value, the smaller the acceleration, in 10 rpm. The minimum was 1 and a maximum was 5000) | 0x0000~0x1388(0~5000) |
0x0015 | 內(nèi)部IO運(yùn)行時(shí),設(shè)定電機(jī)的減速度大小. (When the internal IO is running, set the deceleration size of the motor. ) | 0x0000~0x1388(0~5000) |
0x0016 | 設(shè)定驅(qū)動(dòng)器將要堵轉(zhuǎn)時(shí),瞬時(shí)電流的增大倍數(shù),范圍(10~30),=10時(shí)最大為1倍,即電流不增大。=30時(shí)電流最大增加為設(shè)定的3倍。 (When the drive is about to block the rotation, set the increase multiple of the instantaneous current, range (10~30), = 1 times of the maximum of 10, that is, the current does not increase. The maximum increase in current is 3 times that set at =30.) | 0x000A~0x001E(10~30) |
0x0017 | 設(shè)定驅(qū)動(dòng)器電流增大穩(wěn)定后,電流減小為設(shè)定值的速度,范圍(10~2048),數(shù)值越大,減小的速度越慢=2048時(shí),電流增大后不再減小。 (When the current of the drive increases and stabilizes, the current decreases to the speed of the set value, range (10~2048), the larger the value, the slower the speed =2048, the current will not decrease after increasing.) | 0x000A~0x0800(10~2048) |
0x0018 | 設(shè)置RDY和ALM信號(hào)的輸出電平。 (Set the output level of the RDY and ALM signals.) 0000:RDY低電平有效,ALM低電平有效。 (0000: RDY low level is effective, and ALM low level is effective.) 0001:RDY低電平有效,ALM高電平有效。 (0001: RDY low level is effective, and ALM high level is effective.) 0002:RDY高電平有效,ALM低電平有效。 (0002: RDY high level is effective, and ALM low level is effective.) 0003(默認(rèn)):RDY高電平有效,ALM高電平有效。驅(qū)動(dòng)器準(zhǔn)備好時(shí),RDY輸出高電平;驅(qū)動(dòng)器報(bào)警時(shí),ALM輸出高電平。 (0003 (default): RDY high level, ALM high level. RDY output high level when the drive is ready; ALM output high level when the drive alarms.)
| 0x0000~0x0003(0~3) |
例如(for instance:): 收到的數(shù)據(jù):01 03 00 07 00 01 35 CB :查詢驅(qū)動(dòng)器狀態(tài)指令 (Data received: 01 03 00 07 00 01 35 CB: Query the drive status instruction ) 返回的數(shù)據(jù):01 03 02 00 00 B8 44 :當(dāng)前驅(qū)動(dòng)器無(wú)故障,電機(jī)處于停止?fàn)顟B(tài) (Data returned: 01 03 02 00 00 B8 44: current drive no fault, motor is in a stop state) 收到的數(shù)據(jù):01 03 00 07 00 01 35 CB :查詢驅(qū)動(dòng)器狀態(tài)指令 (Data received: 01 03 00 07 00 01 35 CB: Query the drive status instruction ) 返回的數(shù)據(jù):01 03 02 01 01 78 14:有故障,未檢測(cè)到電機(jī)。電機(jī)處于正轉(zhuǎn)狀態(tài)。 (Data returned: 01 03 02 01 01 78 14: with fault, motor not detected. The motor is in positive state.) |
3、命令字:0x06 ,寫入單個(gè)寄存器命令(the command word: 0x06, write to a single register command)
該命令為寫入驅(qū)動(dòng)器單個(gè)寄存器的命令,主機(jī)請(qǐng)求與驅(qū)動(dòng)器返回格式如下(This command is a command written to a single register of the drive. The host request and drive return format are as follows):
表5主機(jī)請(qǐng)求數(shù)據(jù)(命令字0x06)
(Table 5 Host request data (command word 0x06))
驅(qū)動(dòng)器地址 (Drive address) | 命令字 (CW) | 寄存器地址 (Register address) | 參數(shù)值 (parameter values) | 校驗(yàn)碼 (check code) |
1字節(jié) (1 Bytes) | 1字節(jié) (1 Bytes) | 2字節(jié) (高位在前) (2 Bytes;High in front) | 2字節(jié) (高位在前) (2 Bytes;High in front) | 2字節(jié) (低位在前) (2 Bytes;Low in front) |
0x01-0x1F (數(shù)碼管BS19的設(shè)定值) (Set value of digital tube BS19) | 0x06 | 0x0000 0x0001 … | XXXX 預(yù)設(shè)的參數(shù)值 (Preset parameter values) | CRCL,CRCH (實(shí)際的CRC數(shù)據(jù)) (Actual CRC data) |
注:寄存器地址定義如表4所示。 (Note: Register address is defined in Table 4.) |
表6驅(qū)動(dòng)器返回的數(shù)據(jù)(命令字0x06)
(Table 6 Data returned by the drive (command word 0x06))
驅(qū)動(dòng)器地址 (Drive address) | 命令字 (CW) | 寄存器地址 (Register address) | 參數(shù)值 (parameter values) | 校驗(yàn)碼 (check code) |
1字節(jié) (1 Bytes) | 1字節(jié) (1 Bytes) | 2字節(jié) (高位在前) (2 Bytes;High in front) | 2字節(jié) (高位在前) (2 Bytes;High in front) | 2字節(jié) (低位在前) (2 Bytes;Low in front) |
0x01-0x1F (與收到的地址一致) ((Consistent with the address received)) | 0x06 | (與收到的數(shù)據(jù)一致) ((Consistent with the data received)) | XXXX 預(yù)設(shè)的參數(shù)值 (Preset parameter values) | CRCL,CRCH (實(shí)際的CRC數(shù)據(jù)) (Actual CRC data)
|
4、命令字:0x10 ,直接控制電機(jī)運(yùn)行的命令(the command word: 0x10, the direct control of the motor operation command)
該命令為直接控制電機(jī)運(yùn)行的命令,控制電機(jī)直接運(yùn)行設(shè)定的脈沖數(shù),驅(qū)動(dòng)器收到該命令后,直接按照設(shè)定的參數(shù)運(yùn)行。需要將BS04設(shè)置為08的工作模式。當(dāng)按照設(shè)定的參數(shù)運(yùn)行完畢后,驅(qū)動(dòng)器不向上位機(jī)返回電機(jī)狀態(tài),需上位機(jī)發(fā)送查詢狀態(tài)命令后才返回?cái)?shù)據(jù)。主機(jī)請(qǐng)求與驅(qū)動(dòng)器返回格式如下:
(This command is the command that directly controls the operation of the motor and controls the number of pulses set by the motor to directly run. After receiving the command, the driver will directly run according to the set parameters. BS04 to 08. When the operation is completed according to the set parameters, the drive does not return to the motor status of the upper computer, and the upper computer needs to send the query status command before returning the data. Host request and drive return format is as follows:)
表7主機(jī)請(qǐng)求數(shù)據(jù)(命令字0x10)
(Table 7 Host request data (command word 0x10))
驅(qū)動(dòng)器地址 (Drive address) | 命令字 (CW) | 寄存器地址(十六進(jìn)制) (Register Address (Hex)) | 數(shù)據(jù)字長(zhǎng)度 (Data word length) | 字節(jié)長(zhǎng)度 (Byte length) | 參數(shù)值 (parameter values) | 校驗(yàn)碼 (check code) |
1字節(jié) (1 Bytes) | 1字節(jié) (1 Bytes) | 2字節(jié) (2 Bytes) | 2字節(jié) (2 Bytes) | 1字節(jié) (1 Bytes) | 4字節(jié) (4 Bytes) | 2字節(jié)(低位在前) (2 Bytes;Low in front) |
0x01-0x1F (數(shù)碼管BS19的設(shè)定值) (Set value of digital tube BS19) | 0x10 功能碼(寫入2個(gè)寄存器,控制電機(jī)直接運(yùn)行) (Function code (write to 2 registers, control motor direct operation) )
| 地址(address): 0x1000:電機(jī)正轉(zhuǎn)脈沖數(shù) (0x1000: Number of motor forward rotating pulses) 0x2000:電機(jī)反轉(zhuǎn)脈沖數(shù) (0x2000: Number of motor reversal pulses) 0x 3000:電機(jī)緩?fù)?/span> (0x 3000: Motor shutdown ) 0x 4000:電機(jī)急停 (0x 4000: Motor emergency stop ) | 固定數(shù)0002, 表示寫入2個(gè)寄存器值 (Fixed number of 0002,represents the writes of 2 register values) | 固定數(shù)0004,表示寫入的字節(jié)數(shù)是4 (Fixed number 0004, the number of bytes written is 4) | XXXXXXXX 運(yùn)動(dòng)的脈沖數(shù),32位數(shù)據(jù),高位在前。注意:高低不能混。 (The number of pulses, 32 data, high in front. Note: the high and low can not be mixed.) | CRCL,CRCH (實(shí)際的CRC數(shù)據(jù)) (Actual CRC data) |
說(shuō)明:寄存器地址為0x1000或0x2000時(shí),只有電機(jī)停止且連續(xù)收到兩次相同的命令時(shí)電機(jī)才啟動(dòng),否則命令無(wú)效,命令無(wú)效時(shí)不返回?cái)?shù)據(jù)。當(dāng)寄存器地址為0x 3000或0x 4000時(shí),參數(shù)值可以為任意數(shù)據(jù)。 (Note: When the register address is 0x1000 or 0x2000, the motor will only start when the motor stops and receives the same command twice continuously, otherwise the command is invalid and the data is not returned if the command is invalid. When the register address is 0x 3000 or 0x 4000, the parameter value can be arbitrary data.) |
表8驅(qū)動(dòng)器返回的數(shù)據(jù)(命令字0x10)
(Table 8 Data returned by the drive (command word 0x10))
地址(address) | 命令字(CW) | 寄存器地址 (Register address) | 數(shù)據(jù)字長(zhǎng)度 (Data word length) | 校驗(yàn)碼 (check code) |
1字節(jié)(1 Bytes) | 1字節(jié)(1 Bytes) | 2字節(jié)(2 Bytes) | 2字節(jié)(2 Bytes) | 2字節(jié)(2 Bytes) |
與接收到的地址一致 (Consistent with the received address ) | 固定值0x10 功能碼(寫入2個(gè)寄存器,控制電機(jī)直接運(yùn)行) (Fixed value of 0x10,function code (write to 2 registers, control motor direct operation)) | 地址,與寫入的地址一致 (Address, consistent with the written address) | 固定數(shù)0002,表示寫入2個(gè)寄存器值 (Fixed number 0002, indicating writing 2 register values) | CRCL,CRCH (實(shí)際的CRC數(shù)據(jù)) (Actual CRC data) |
例如:(地址為01) (Example: (the address is 01))
收到:01 10 10 00 00 02 04 00 00 10 00 33 AF:電機(jī)正向前進(jìn)0x00001000(4096)個(gè)脈沖。 (Received: 01 10 10 00 00 02 04 00 00 10 00 33 AF:The motor is forward 0x00001000 (4096) pulses.)
返回數(shù)據(jù):01 10 10 00 00 02 45 08 (Return data: 01 10 10 00 00 02 45 08)
收到:01 10 20 00 00 02 04 00 01 00 00 3B AE :電機(jī)反向前進(jìn)0x00010000(65536)個(gè)脈沖 (Received:01 10 20 00 00 02 04 00 01 00 00 3B AE :motor reverse forward 0x00010000 (65536) pulses)
返回數(shù)據(jù):01 10 20 00 00 02 4A 08 (Return data: 01 10 20 00 00 02 4A 08)
收到數(shù)據(jù):01 10 30 00 00 02 04 00 00 00 00 A7 AE 電機(jī)緩?fù)?/span> (Received:01 10 30 00 00 02 04 00 00 00 00 A7 AE;motor slow stop)
返回數(shù)據(jù):01 10 30 00 00 02 4E C8 (Return data:01 10 30 00 00 02 4E C8)
收到數(shù)據(jù):01 10 40 00 00 02 04 00 00 00 00 C2 6C 電機(jī)急停 (Received:01 10 40 00 00 02 04 00 00 00 00 C2 6C;electric emergency stop)
返回數(shù)據(jù):01 10 40 00 00 02 54 08 (Return data:01 10 40 00 00 02 54 08) |
ModBUS串口協(xié)議
(ModBUS Serial port protocol)
1、通訊協(xié)議(Communication protocol):
采用異步主從半雙工方式通訊,上位機(jī)作為主站,驅(qū)動(dòng)器作為從站進(jìn)行工作,由主站發(fā)起詢問(wèn)(發(fā)起通訊),從站在接到主站請(qǐng)求后作相應(yīng)的應(yīng)答,只有當(dāng)接收到的字節(jié)滿足協(xié)議要求時(shí),驅(qū)動(dòng)器才返回?cái)?shù)據(jù),否則不應(yīng)答。主要協(xié)議如表1所示。(Using asynchronous master semi-duplex communication, the upper machine as the main station, the drive as the slave station to work, by the master station to initiate inquiry (initiate communication), the slave station after receiving the request from the master station, only when the received bytes meet the protocol requirements, the drive will return data, otherwise do not answer. The main protocol is shown in Table Table 1.)
表1驅(qū)動(dòng)器通訊協(xié)議(Table 1 The drive communication protocol)
名稱(name) | 內(nèi)容(content) | 說(shuō)明(explain) |
接口(joggle) | RS485 | |
驅(qū)動(dòng)器地址 (Drive address) | 0x01-0x1F(1-31) | 數(shù)碼管BS19的設(shè)定值 (Set value of the digital tube BS19) |
波特率 (Baud rate) | 9600,19200,38400,115200 | 數(shù)碼管BS18的設(shè)定值 (Set value of the digital tube BS18) |
數(shù)據(jù)幀格式 (data frame format ) | 1位起始位,8位數(shù)據(jù)位,無(wú)奇偶校驗(yàn)位,1位停止位,無(wú)控制流. (1 bit, 8 bit, no parity bit, 1 bit stop bit, no control flow.) | |
報(bào)文格式 (message format) | 命令字:0x03 (Command word: 0x03) | 讀取單寄存器數(shù)據(jù)命令 (Read the single-register data command) |
命令字:0x06 (Command word: 0x06) | 寫入單寄存器數(shù)據(jù)命令 (Write to a single-register data command) | |
命令字:0x10 (Command word: 0x10) | 寫入多寄存器數(shù)據(jù)命令,控制電機(jī)直接運(yùn)行。 (Write the multi-register data command and control the motor to run directly.) | |
注(pour:): 1. 波特率更改后重新上電有效,否則默認(rèn)為剛上電時(shí)的波特率。當(dāng)串行口通訊不暢時(shí),請(qǐng)降低通訊的波特率;(1. After the port rate is changed, the power on is valid, otherwise the default is the wave rate when just power on. When the serial port communication is not smooth, please reduce the port rate of communication;) 2.同一串口線上的多臺(tái)驅(qū)動(dòng)器地址不可重復(fù),否則會(huì)造成通訊錯(cuò)誤,甚至損壞串口芯片。(2. The addresses of multiple drives on the same serial port line cannot be repeated, otherwise it will cause communication errors and even damage the serial port chip.) |
2、命令字:0x03 ,讀取單個(gè)寄存器命令(2, the command word: 0x03, read a single register command),
該命令為讀取驅(qū)動(dòng)器單個(gè)寄存器的命令,主機(jī)請(qǐng)求與驅(qū)動(dòng)器返回格式如下(This command is a command to read a single register of the drive, and the host request and drive return format are as follows:):
表2主機(jī)請(qǐng)求數(shù)據(jù)(命令字0x03)(Table 2 Host request data (command word 0x03))
驅(qū)動(dòng)器地址 (Drive address) | 命令字 (CW) | 寄存器地址 (Register address) | 數(shù)據(jù)長(zhǎng)度 (DL) | 校驗(yàn)碼 (check code) |
1字節(jié) (1 Bytes) | 1字節(jié) (1 Bytes) | 2字節(jié) (高位在前) (2 Bytes;High in front) | 2字節(jié) (高位在前) (2 Bytes;High in front) | 2字節(jié) (低位在前) (2 Bytes;Low in front) |
0x01-0x1F (數(shù)碼管BS19的設(shè)定值) (Set value of digital tube BS19)
| 0x03 | 0x0000 0x0001 … | 0x0002 (固定數(shù)) (Fixed number) | CRCL,CRCH (實(shí)際的CRC數(shù)據(jù)) (Actual CRC data) |
注(pour:): 1. 寄存器地址定義如表4所示(1. Register address is defined as shown in Table 4);
2. CRC校驗(yàn)初值為0xFFFF,多項(xiàng)式為0xA001,低字節(jié)在前。(2. The initial value of CRC check is 0xFFFF, the polynomial is 0 xA 001, and the low bytes are first.)
|
表3驅(qū)動(dòng)器返回的數(shù)據(jù)(命令字0x03)(Table 3 Data returned by the drive (command word 0x03))
驅(qū)動(dòng)器地址 (Drive address) | 命令字 (CW) | 字節(jié)長(zhǎng) (Byte length) | 參數(shù)值 (parameter values) | 校驗(yàn)碼 (check code) |
1字節(jié) (1 Bytes) | 1字節(jié) (1 Bytes) | 1字節(jié) (1 Bytes) | 2字節(jié) (高位在前) (2 Bytes;High in front) | 2字節(jié) (低位在前) (2 Bytes;Low in front) |
0x01-0x1F (與收到的地址一致) ((Consistent with the address received)) | 0x03 | 02 (數(shù)據(jù)長(zhǎng)度2字節(jié)) (Data length: 2 bytes) | XXXX (實(shí)際的寄存器參數(shù)值) (Actual register parameter value) | CRCL,CRCH (實(shí)際的CRC數(shù)據(jù)) (Actual CRC data) |
表4寄存器地址定義(Table 4 Register address definitions)
寄存器地址 (Register address) | 地址定義 (Address definition) | 數(shù)值范圍(括號(hào)內(nèi)為十進(jìn)制數(shù)) Value range (decimal number in parentheses) |
0x0000 | 驅(qū)動(dòng)器工作電流(單位:mA) (Drive operating current (in mA)) | 0x01F4~0x1F40(500~8000) |
0x0001 | 驅(qū)動(dòng)器鎖機(jī)值(單位:%) (Drive Lock Value (in%)) | 0x0005-0x0064(5~100) |
0x0002 | SM為高時(shí)的細(xì)分值(單位:脈沖/轉(zhuǎn),需能被10整除) (SM is subdivided at high value (unit: pulse / turn, must be divisible by 10) ) | 0x00C8~0xEA60(200~60000) |
0x0003 | SM為低時(shí)的細(xì)分值(單位:脈沖/轉(zhuǎn),需能被10整除) (SM is low breakdown (pulse / turn, must be divisible by 10)) | 0x00C8~0xEA60(200~60000) |
0x0004 | 驅(qū)動(dòng)器脈沖工作方式: 0000:正/反轉(zhuǎn)脈沖控制模式,上升沿有效 0001:脈沖+方向控制模式,上升沿有效 0002:正/反轉(zhuǎn)脈沖控制模式,下降沿有效 0003:脈沖+方向控制模式,下降沿有效(默認(rèn)) 其他數(shù)值詳見(jiàn)特殊工作模式。 (Drive pulse operation mode: 0000: Positive / reverse pulse control mode, rising edge effective. 0001: Pulse + direction control mode, the rising edge is effective. 0002: Positive / reverse pulse control mode, effective edge effective. 0003: Pulse + direction control mode, descent valid (default). Other values are shown in the special working mode.) | 0x0000~0x0028(0~40) |
0x0005 | PI控制時(shí)的Kp比例系數(shù) (Kp proportion coefficient for PI control) | 0x0014~0x0960(20~2400) |
0x0006 | PI控制時(shí)的Ki積分系數(shù) (Ki integration coefficient during PI control) | 0x0000~0x0050(0~80) |
0x0007 | 驅(qū)動(dòng)器自測(cè)模式及運(yùn)行狀態(tài)。 (Drive self-test mode and running status.) 1.寫入時(shí)( When writing) 0000:電機(jī)停止(Motor stops) 0003:電機(jī)正轉(zhuǎn)(Motor is turning) 0009:電機(jī)反轉(zhuǎn)(Motor reversal) 3. 讀取時(shí)返回的參數(shù)定義如下( The parameters returned when reading are defined as follows) 高8位(High 8 bits): 00:表示驅(qū)動(dòng)器無(wú)報(bào)警故障 (00: It means that the drive has no alarm fault) 01:表示未檢測(cè)到電機(jī)故障 (01: Indicates that no motor fault was detected) 02:表示驅(qū)動(dòng)器過(guò)熱報(bào)警 (02: indicates the drive overheating alarm ) 03:表示驅(qū)動(dòng)器過(guò)流報(bào)警 (03: indicates the drive overcurrent alarm) 低8位(Low 8 bits): 00:表示電機(jī)停止 (00: indicates a motor stop) 01:表示電機(jī)正在正轉(zhuǎn) (01: It means that the motor is turning forward) 02:表示電機(jī)正在反轉(zhuǎn) (02: Indicates that the motor is reversing ) | 寫命令:0x0003或0x0009 讀取時(shí)返回電機(jī)狀態(tài) (Write the command: 0x0003 or 0x0009;Return to the motor state when reading) |
0x0008 | 電機(jī)延時(shí)時(shí)間。=X*62.5微秒 (Motor time delay time.=X * 62.5 microseconds) 0000:無(wú)延時(shí); (0000: no delay;) 0010:延時(shí)1ms (0010:1ms time delay) 當(dāng)BS04=0004或者0005時(shí),內(nèi)部IO時(shí)電機(jī)加速度與此設(shè)置無(wú)關(guān)。 (When either BS04=0004 or 0005,motor acceleration during internal IO is not related to this setting.) | 0x0000~0x0BB8(0~3000) |
0x000D | 內(nèi)部脈沖時(shí)參數(shù)定義為電機(jī)啟動(dòng)速度(轉(zhuǎn)/分),當(dāng)啟動(dòng)速度高于運(yùn)行速度時(shí),自動(dòng)默認(rèn)為運(yùn)行速度。 (The internal pulse parameter is defined as the motor starting speed (rpm), and when the starting speed is higher than the running speed.) | 0x0000~0x0258(0~600) |
0x000E | 內(nèi)部脈沖時(shí)第一組細(xì)分時(shí),SM=1時(shí),參數(shù)定義為電機(jī)運(yùn)行速度1. (In the first group of internal pulse subdivision, SM=1, the parameter is defined as the motor running speed 1.) | 0x0001~0x0BB8(1~3000) |
0x000F | 內(nèi)部脈沖時(shí)第二組細(xì)分時(shí),SM=0時(shí),參數(shù)定義為電機(jī)運(yùn)行速度2. (In the second group of internal pulse subdivision, SM=0, the parameter is defined as the motor running speed 2. ) | 0x0001~0x0BB8(1~3000) |
0x0010 | 內(nèi)部脈沖時(shí),參數(shù)定義為實(shí)際轉(zhuǎn)動(dòng)需要的脈沖個(gè)數(shù)低四位設(shè)定。 (For the internal pulse, the parameter is defined as the four-lower number of pulses required for the actual rotation.) | 0x0000~0x270F(0~9999) |
0x0011 | 內(nèi)部脈沖時(shí)參數(shù)定義為實(shí)際轉(zhuǎn)動(dòng)需要的脈沖個(gè)數(shù)高四位設(shè)定(十進(jìn)制,1代表十進(jìn)制的10000); (The internal pulse parameter is defined as the number of pulses required by actual rotation (decimal, 1 represents 10000 decimal); ) 9999:自動(dòng)定義為連續(xù)運(yùn)轉(zhuǎn),直至停止信號(hào)到來(lái)。 (9999: It is automatically defined as a continuous operation until the stop signal arrives.) | 0x0000~0x270F(0~9999) |
0x0014 | 內(nèi)部IO運(yùn)行時(shí),設(shè)定電機(jī)的加速度大小. 數(shù)值越大,加速度越大,數(shù)值越小,加速度越小,單位為:10轉(zhuǎn)/分/秒。最低為1,最高為5000 (When the acceleration of the motor is set during the internal IO operation.The larger the value, the greater the acceleration, the smaller the value, the smaller the acceleration, in 10 rpm. The minimum was 1 and a maximum was 5000) | 0x0000~0x1388(0~5000) |
0x0015 | 內(nèi)部IO運(yùn)行時(shí),設(shè)定電機(jī)的減速度大小. (When the internal IO is running, set the deceleration size of the motor. ) | 0x0000~0x1388(0~5000) |
0x0016 | 設(shè)定驅(qū)動(dòng)器將要堵轉(zhuǎn)時(shí),瞬時(shí)電流的增大倍數(shù),范圍(10~30),=10時(shí)最大為1倍,即電流不增大。=30時(shí)電流最大增加為設(shè)定的3倍。 (When the drive is about to block the rotation, set the increase multiple of the instantaneous current, range (10~30), = 1 times of the maximum of 10, that is, the current does not increase. The maximum increase in current is 3 times that set at =30.) | 0x000A~0x001E(10~30) |
0x0017 | 設(shè)定驅(qū)動(dòng)器電流增大穩(wěn)定后,電流減小為設(shè)定值的速度,范圍(10~2048),數(shù)值越大,減小的速度越慢=2048時(shí),電流增大后不再減小。 (When the current of the drive increases and stabilizes, the current decreases to the speed of the set value, range (10~2048), the larger the value, the slower the speed =2048, the current will not decrease after increasing.) | 0x000A~0x0800(10~2048) |
0x0018 | 設(shè)置RDY和ALM信號(hào)的輸出電平。 (Set the output level of the RDY and ALM signals.) 0000:RDY低電平有效,ALM低電平有效。 (0000: RDY low level is effective, and ALM low level is effective.) 0001:RDY低電平有效,ALM高電平有效。 (0001: RDY low level is effective, and ALM high level is effective.) 0002:RDY高電平有效,ALM低電平有效。 (0002: RDY high level is effective, and ALM low level is effective.) 0003(默認(rèn)):RDY高電平有效,ALM高電平有效。驅(qū)動(dòng)器準(zhǔn)備好時(shí),RDY輸出高電平;驅(qū)動(dòng)器報(bào)警時(shí),ALM輸出高電平。 (0003 (default): RDY high level, ALM high level. RDY output high level when the drive is ready; ALM output high level when the drive alarms.)
| 0x0000~0x0003(0~3) |
例如(for instance:): 收到的數(shù)據(jù):01 03 00 07 00 01 35 CB :查詢驅(qū)動(dòng)器狀態(tài)指令 (Data received: 01 03 00 07 00 01 35 CB: Query the drive status instruction ) 返回的數(shù)據(jù):01 03 02 00 00 B8 44 :當(dāng)前驅(qū)動(dòng)器無(wú)故障,電機(jī)處于停止?fàn)顟B(tài) (Data returned: 01 03 02 00 00 B8 44: current drive no fault, motor is in a stop state) 收到的數(shù)據(jù):01 03 00 07 00 01 35 CB :查詢驅(qū)動(dòng)器狀態(tài)指令 (Data received: 01 03 00 07 00 01 35 CB: Query the drive status instruction ) 返回的數(shù)據(jù):01 03 02 01 01 78 14:有故障,未檢測(cè)到電機(jī)。電機(jī)處于正轉(zhuǎn)狀態(tài)。 (Data returned: 01 03 02 01 01 78 14: with fault, motor not detected. The motor is in positive state.) |
3、命令字:0x06 ,寫入單個(gè)寄存器命令(the command word: 0x06, write to a single register command)
該命令為寫入驅(qū)動(dòng)器單個(gè)寄存器的命令,主機(jī)請(qǐng)求與驅(qū)動(dòng)器返回格式如下(This command is a command written to a single register of the drive. The host request and drive return format are as follows):
表5主機(jī)請(qǐng)求數(shù)據(jù)(命令字0x06)
(Table 5 Host request data (command word 0x06))
驅(qū)動(dòng)器地址 (Drive address) | 命令字 (CW) | 寄存器地址 (Register address) | 參數(shù)值 (parameter values) | 校驗(yàn)碼 (check code) |
1字節(jié) (1 Bytes) | 1字節(jié) (1 Bytes) | 2字節(jié) (高位在前) (2 Bytes;High in front) | 2字節(jié) (高位在前) (2 Bytes;High in front) | 2字節(jié) (低位在前) (2 Bytes;Low in front) |
0x01-0x1F (數(shù)碼管BS19的設(shè)定值) (Set value of digital tube BS19) | 0x06 | 0x0000 0x0001 … | XXXX 預(yù)設(shè)的參數(shù)值 (Preset parameter values) | CRCL,CRCH (實(shí)際的CRC數(shù)據(jù)) (Actual CRC data) |
注:寄存器地址定義如表4所示。 (Note: Register address is defined in Table 4.) |
表6驅(qū)動(dòng)器返回的數(shù)據(jù)(命令字0x06)
(Table 6 Data returned by the drive (command word 0x06))
驅(qū)動(dòng)器地址 (Drive address) | 命令字 (CW) | 寄存器地址 (Register address) | 參數(shù)值 (parameter values) | 校驗(yàn)碼 (check code) |
1字節(jié) (1 Bytes) | 1字節(jié) (1 Bytes) | 2字節(jié) (高位在前) (2 Bytes;High in front) | 2字節(jié) (高位在前) (2 Bytes;High in front) | 2字節(jié) (低位在前) (2 Bytes;Low in front) |
0x01-0x1F (與收到的地址一致) ((Consistent with the address received)) | 0x06 | (與收到的數(shù)據(jù)一致) ((Consistent with the data received)) | XXXX 預(yù)設(shè)的參數(shù)值 (Preset parameter values) | CRCL,CRCH (實(shí)際的CRC數(shù)據(jù)) (Actual CRC data)
|
4、命令字:0x10 ,直接控制電機(jī)運(yùn)行的命令(the command word: 0x10, the direct control of the motor operation command)
該命令為直接控制電機(jī)運(yùn)行的命令,控制電機(jī)直接運(yùn)行設(shè)定的脈沖數(shù),驅(qū)動(dòng)器收到該命令后,直接按照設(shè)定的參數(shù)運(yùn)行。需要將BS04設(shè)置為08的工作模式。當(dāng)按照設(shè)定的參數(shù)運(yùn)行完畢后,驅(qū)動(dòng)器不向上位機(jī)返回電機(jī)狀態(tài),需上位機(jī)發(fā)送查詢狀態(tài)命令后才返回?cái)?shù)據(jù)。主機(jī)請(qǐng)求與驅(qū)動(dòng)器返回格式如下:
(This command is the command that directly controls the operation of the motor and controls the number of pulses set by the motor to directly run. After receiving the command, the driver will directly run according to the set parameters. BS04 to 08. When the operation is completed according to the set parameters, the drive does not return to the motor status of the upper computer, and the upper computer needs to send the query status command before returning the data. Host request and drive return format is as follows:)
表7主機(jī)請(qǐng)求數(shù)據(jù)(命令字0x10)
(Table 7 Host request data (command word 0x10))
驅(qū)動(dòng)器地址 (Drive address) | 命令字 (CW) | 寄存器地址(十六進(jìn)制) (Register Address (Hex)) | 數(shù)據(jù)字長(zhǎng)度 (Data word length) | 字節(jié)長(zhǎng)度 (Byte length) | 參數(shù)值 (parameter values) | 校驗(yàn)碼 (check code) |
1字節(jié) (1 Bytes) | 1字節(jié) (1 Bytes) | 2字節(jié) (2 Bytes) | 2字節(jié) (2 Bytes) | 1字節(jié) (1 Bytes) | 4字節(jié) (4 Bytes) | 2字節(jié)(低位在前) (2 Bytes;Low in front) |
0x01-0x1F (數(shù)碼管BS19的設(shè)定值) (Set value of digital tube BS19) | 0x10 功能碼(寫入2個(gè)寄存器,控制電機(jī)直接運(yùn)行) (Function code (write to 2 registers, control motor direct operation) )
| 地址(address): 0x1000:電機(jī)正轉(zhuǎn)脈沖數(shù) (0x1000: Number of motor forward rotating pulses) 0x2000:電機(jī)反轉(zhuǎn)脈沖數(shù) (0x2000: Number of motor reversal pulses) 0x 3000:電機(jī)緩?fù)?/span> (0x 3000: Motor shutdown ) 0x 4000:電機(jī)急停 (0x 4000: Motor emergency stop ) | 固定數(shù)0002, 表示寫入2個(gè)寄存器值 (Fixed number of 0002,represents the writes of 2 register values) | 固定數(shù)0004,表示寫入的字節(jié)數(shù)是4 (Fixed number 0004, the number of bytes written is 4) | XXXXXXXX 運(yùn)動(dòng)的脈沖數(shù),32位數(shù)據(jù),高位在前。注意:高低不能混。 (The number of pulses, 32 data, high in front. Note: the high and low can not be mixed.) | CRCL,CRCH (實(shí)際的CRC數(shù)據(jù)) (Actual CRC data) |
說(shuō)明:寄存器地址為0x1000或0x2000時(shí),只有電機(jī)停止且連續(xù)收到兩次相同的命令時(shí)電機(jī)才啟動(dòng),否則命令無(wú)效,命令無(wú)效時(shí)不返回?cái)?shù)據(jù)。當(dāng)寄存器地址為0x 3000或0x 4000時(shí),參數(shù)值可以為任意數(shù)據(jù)。 (Note: When the register address is 0x1000 or 0x2000, the motor will only start when the motor stops and receives the same command twice continuously, otherwise the command is invalid and the data is not returned if the command is invalid. When the register address is 0x 3000 or 0x 4000, the parameter value can be arbitrary data.) |
表8驅(qū)動(dòng)器返回的數(shù)據(jù)(命令字0x10)
(Table 8 Data returned by the drive (command word 0x10))
地址(address) | 命令字(CW) | 寄存器地址 (Register address) | 數(shù)據(jù)字長(zhǎng)度 (Data word length) | 校驗(yàn)碼 (check code) |
1字節(jié)(1 Bytes) | 1字節(jié)(1 Bytes) | 2字節(jié)(2 Bytes) | 2字節(jié)(2 Bytes) | 2字節(jié)(2 Bytes) |
與接收到的地址一致 (Consistent with the received address ) | 固定值0x10 功能碼(寫入2個(gè)寄存器,控制電機(jī)直接運(yùn)行) (Fixed value of 0x10,function code (write to 2 registers, control motor direct operation)) | 地址,與寫入的地址一致 (Address, consistent with the written address) | 固定數(shù)0002,表示寫入2個(gè)寄存器值 (Fixed number 0002, indicating writing 2 register values) | CRCL,CRCH (實(shí)際的CRC數(shù)據(jù)) (Actual CRC data) |
例如:(地址為01) (Example: (the address is 01))
收到:01 10 10 00 00 02 04 00 00 10 00 33 AF:電機(jī)正向前進(jìn)0x00001000(4096)個(gè)脈沖。 (Received: 01 10 10 00 00 02 04 00 00 10 00 33 AF:The motor is forward 0x00001000 (4096) pulses.)
返回數(shù)據(jù):01 10 10 00 00 02 45 08 (Return data: 01 10 10 00 00 02 45 08)
收到:01 10 20 00 00 02 04 00 01 00 00 3B AE :電機(jī)反向前進(jìn)0x00010000(65536)個(gè)脈沖 (Received:01 10 20 00 00 02 04 00 01 00 00 3B AE :motor reverse forward 0x00010000 (65536) pulses)
返回數(shù)據(jù):01 10 20 00 00 02 4A 08 (Return data: 01 10 20 00 00 02 4A 08)
收到數(shù)據(jù):01 10 30 00 00 02 04 00 00 00 00 A7 AE 電機(jī)緩?fù)?/span> (Received:01 10 30 00 00 02 04 00 00 00 00 A7 AE;motor slow stop)
返回數(shù)據(jù):01 10 30 00 00 02 4E C8 (Return data:01 10 30 00 00 02 4E C8)
收到數(shù)據(jù):01 10 40 00 00 02 04 00 00 00 00 C2 6C 電機(jī)急停 (Received:01 10 40 00 00 02 04 00 00 00 00 C2 6C;electric emergency stop)
返回數(shù)據(jù):01 10 40 00 00 02 54 08 (Return data:01 10 40 00 00 02 54 08) |
復(fù)制成功
×