Yudian AIBUS and MODBUS communication protocol description (V8.0)
Yudian AIBUS and MODBUS communication protocol description (V8.0)
AIBUS is a communication protocol developed by Xiamen Yudian Automation Technology Co., Ltd. for AI series display control instruments. It can realize complete functions with simple instructions. It is characterized by writing parameters and reading functions at the same time, so the parameters are not destroyed when reading. The cycle time, plus the instruction length is small, so it has a faster rate than MODBUS (especially when there is a write command, the MODBUS write command can not complete the function of reading the lower computer data at the same time, it will destroy the cycle of the read command. , extending the cycle of reading), AIBUS protocol has the ability to form a large-scale process control system. AIBUS adopts 16-bit summation correction code. The lower computer is fast and reliable, and supports different baud rates such as 9600 and 19200. At 19200 baud rate, the host computer accesses an AI-7/8 series high-performance instrument. The average time is only 20mS, and the average time to access the AI-5 series meters is 40mS. The instrument allows up to 80 instruments to be connected to one RS485 communication interface (to ensure reliable communication, an RS485 repeater is required when the number of instruments is greater than 60). AI series instruments can use PC, touch screen and PLC as the host computer. The software resources are abundant and the development speed is extremely fast. The PC software of the base and PC widely adopts WINDOWS as the operating environment, which is not only intuitive and convenient to operate, but also powerful. The application of the latest industrial flat panel touch screen PC brings a new interface to industrial automation. This makes the price of the measurement and control system using the instrument + upper computer structure much lower than the traditional DCS system, and the performance and reliability also have superior potential than the traditional DCS system. Yudian AI-5 series instruments can write up to 1 million times of life, while AI-7/8 series instruments allow continuous writing of parameters, such as writing setpoints or output values, with a write life of up to 1 billion times. The machine will form a complex adjustment system.
First, the interface specifications
The AI ​​series instruments use an asynchronous serial communication interface, and the interface level complies with the provisions of the RS232C or RS485 standards. The data format is 1 start bit, 8 bits of data, no parity, 1 or 2 stop bits. The baud rate of the communication transmission data can be adjusted to 4800~19200 bit/S, usually 9600 bit/S. When the number of instruments connected to a single communication port is more than 40 or a faster refresh rate is required, it is recommended to use 19200bit/S. When the distance is long or the communication is unreliable and often interrupted, 4800bit/S is optional. The AI ​​instrument adopts multi-machine communication protocol, and adopts RS485 communication interface, which can connect 1~80 instruments at the same time to one communication interface.
RS485 communication interface communication distance is more than 1KM (some practical applications have reached 3-4KM), only two lines can make multiple AI instruments communicate with the computer, better than RS232 communication interface. In order to use the ordinary personal computer PC as the host computer, RS232/RS485 or USB/RS485 type communication interface converter can be used to convert the RS232 communication port or USB port on the computer into the RS485 communication port. For this purpose, Yudian has developed a new RS232/RS485 and USB/RS485 converter, which has the advantages of small size, no need to initialize and can adapt to any software, no external power supply, and certain anti-lightning capability.
According to the RS485 interface, the RS485 communication interface can connect up to 32 instruments or computers on one communication line. When you need to connect more instruments, you need a repeater, or you can choose a communication interface with a chip such as 1/2 or 1/4 load to increase the number of connectable instruments. The currently produced AI instrument communication interface uses a low-load chip and a certain lightning protection and anti-static function, and can connect about 60 instruments without a repeater.
The RS232 and RS485 communication interfaces of the AI ​​instrument use optical isolation technology to isolate the communication interface from other parts of the instrument. When one of the instruments on the communication line is damaged or faulty, it will not affect other instruments. Similarly, when the communication part of the instrument is damaged or the host fails, the instrument can still measure and control normally, and the instrument can be operated through the instrument keyboard, and the work reliability is high. The correctness of the 16-bit check code is 30,000 times that of simple parity, which basically guarantees data reliability. And when other companies on the same network also use the master-slave communication products, such as PLC, inverter, etc., in most cases, the AI ​​series instruments will not be interfered by other company's product communication, and there will be no confusion or communication failure. problem. However, the AI ​​instrument protocol does not guarantee the normal operation of other company products, so unless it is absolutely necessary, the AI ​​instrument should not be mixed with other products on an RS485 communication bus, but different buses should be used separately.
Second, the communication instructions
The AI ​​meter uses a hexadecimal data format to represent various instruction codes and data. The AI ​​instrument software communication instruction is optimized. There are only two standard communication commands. One is the read command and the other is the write command. The two commands make the PC software easy to write, but can operate the instrument 100% completely. Standard reading And write instructions are as follows:
Read: Address code +52H (82) + parameter code to be read +0+0 + check code
Write: Address code +43H (67) + parameter code to be written + write number low byte + write number high byte + check code
Address code: In order to connect multiple AI instruments on one communication interface, each AI instrument needs to be programmed with a different communication address. The valid address is 0~80 (some models are 0~100), so up to 81 AI instruments can be connected to one communication line. The communication address of the instrument is determined by the parameter Addr. The internal number of the instrument uses two repeated values ​​of 128~208 (hexadecimal 80H~D0H) to indicate the address code. Since the number greater than 128 is less used (such as the ASC mode protocol usually only uses 0-127). The number), thus reducing the possibility of conflicts due to data and address duplication. The AI ​​instrument communication protocol stipulates that the address code is two identical bytes and the value is (meter address +80H). For example, if the meter parameter Addr=10 (hexadecimal number is 0AH, 0A+80H=8AH), the address code of the meter is:
8AH 8AH
Parameter code: The parameter of the meter is represented by the parameter code of an 8-bit binary number (one byte, written as a hexadecimal number). It indicates the name of the parameter to be read/written in the instruction.
Check code: The check code adopts 16-bit sum check mode. The check code calculation method of read command is:
The code to read the parameter ×256+82+ADDR
The check code calculation method of the write command is the remainder calculated by the 16-bit binary addition of the following formula (the overflow part is not processed):
The parameter code to be written ×256+67+ parameter value to be written +ADDR
In the formula, ADDR is the value of the instrument address parameter, and the range is 0~80 (be careful not to add 80H). The check code is the remainder obtained by adding the binary 16-bit integer to the above formula, and the remainder is 2 bytes, with the low byte first and the high byte after. The parameter values ​​to be written are represented by 16-bit binary integers.
Return data: Whether reading or writing, the meter returns the following 10 bytes of data:
Measured value PV+ given value SV+ output value MV and alarm status + read/write parameter value + check code
The PV, SV and read parameter values ​​each occupy 2 bytes, representing a 16-bit binary signed complement integer. The lower byte is first, the high byte is after, and the integer cannot represent the decimal point. The user is required to be in the upper computer. Processing; MV occupies one byte, in 8-bit signed binary number format, the value range is -110~+110, the status bit occupies one byte, and the check code occupies 2 bytes, a total of 10 bytes. The meanings of the data returned by different models are as follows:
Instrument model | Regulator thermostat | AI-708M inspection instrument | AI-708H/808H Flow channel | AI-808H Temperature/pressure channel | AI-301M frequency regulator / IO module |
PV | Measured value PV | Measurements | Instantaneous flow measurement | Temperature measurement in 0.1 ° C | Measured value PV |
SV | Current given value SV | Channel number (1-6) | Cumulative flow low Or batch control of measured values | Pressure measurement in 0.001 MPa | Current given value SV |
MV | Output value MV | Status byte B | Cumulative flow high Or batch control of a given value | Pre-compensation flow or frequency value in 0.1 Hz | Adjust the output value MV |
Status byte | Status byte A | Status byte A | Status byte A | ||
Parameter value | Indicates the value of the parameter to read or write |
Return check code: the remainder obtained by adding the PV+SV+ (alarm status *256+MV)+parameter value+ADDR by integer addition. When calculating the check code, every two 8-bit bytes form a 16-bit binary integer for addition, the overflow number is ignored, and the remainder is used as the check code.
The status byte A indicates the status of the instrument part, and its meaning is as follows (bit 7 is fixed to 0):
Regulator and single display (V7.0) | AI-702M/704M/706M | Regulator, thermostat and single display (V7.5) | |
Bit 0 | Upper limit alarm (HIAL) | Upper limit alarm (HIAL) | HIAL |
Bit 1 | Lower limit alarm (LoAL) | Lower limit alarm (LoAL) | LoAL |
Bit 2 | Positive deviation alarm (dHAL) | 0 | HdAL |
Bit 3 | Negative deviation alarm (dLAL) | 0 | LdAL |
Bit 4 | Enter overrange alarm (orAL) | Overrange alarm (orAL) | Oral |
Bit 5 | AL1 state, 0 is action | 0 | Alternate (0) |
Bit 6 | AL2 state, 0 is action | 0 | 0 means MV is the output value, 1 is the status word B. |
The inspection instrument has a status byte B. Bits 0~6 of status byte B indicate the input states of OP1, OP2, AL1, AL2, AU1, AU2, and MIO, respectively. 0 indicates no turn-on or no output, 1 indicates that the external switch is on or has output, OUTP Or the corresponding bit is fixed to 0 when AUX is making adjustment output. The function can be used as the output or output of the switch of the host computer. The alarm port that is not used by the ALP parameter setting can be used as the I/O port. The switch can be realized by modifying the NONC (normally open/normally closed) parameter. The output of the quantity, when used as a digital input, should set the nonc corresponding bit to normally open. If the read signal is 1, it means that the external switch is closed or has a signal input.
Parameter code table for AI instrument read/write (V8.0 518/518P/708/708P/719/719P)
Parameter code | Modbus-RTU register address | AI-518/518P | Description |
00H | 40001 | Desired point | Unit with measured value |
01H | 40002 | HIAL upper limit alarm | Unit with measured value |
02H | 40003 | LoAL lower limit alarm | Unit with measured value |
03H | 40004 | dHAL positive deviation alarm | Unit with measured value |
04H | 40005 | dLAL negative deviation alarm | Unit with measured value |
05H | 40006 | AHYS alarm backlash | Unit with measured value |
06H | 40007 | CtrL control mode | 0, ONOFF; 1, APID; 2, nPID; 3, PoP; 4, SoP |
07H | 40008 | P proportional band | Unit with measured value |
08H | 40009 | I integration time | second |
09H | 40010 | d differential time | 0.1 second |
0AH | 40011 | CtI control cycle | 0.1 second |
0BH | 40012 | InP input specifications | See instructions for use |
0CH | 40013 | dPt decimal point position | 0,0;1,0.0;2,0.00,3,0.000; if the above data is read +128, it means that all measured values ​​and parameters using the same unit as the measured value (whether temperature or linear signal) are required. The display processing is performed after the 10th and 4th rounds. For example, the value of dPt is 128+1=129, and the measured value of the read or related parameter value is 16 bits, the actual value should be 10.0. If the dPt value is 1, the actual displayed data is 100.0; It can also be written, but it can't be added 128 when writing, and the range of writing data is 0~3. |
0DH | 40014 | ScL scale lower limit | Unit with measured value |
0EH | 40015 | ScH scale upper limit | Unit with measured value |
0FH | 40016 | ALP alarm output selection | See the instructions for the meaning |
10H | 40017 | Sc measurement translation correction | Unit with measured value |
11H | 40018 | oP1 main output mode | 0, SSR; 1, rELy; 2, 0-20; 3, 4-20 |
12H | 40019 | OPL output lower limit | % |
13H | 40020 | OPH output limit | % |
14H | 40021 | CF function selection | See the instructions for the meaning |
15H | 40022 | Instrument model feature word | 5180 (AI-518) or 5187 (AI-518P) |
16H | 40023 | Addr mailing address | |
17H | 40024 | FILt digital filtering | |
18H** | 40025 | AMAn manual / automatic selection | 0,MAN;1,Auto;2,FMAn;3,FAut |
19H | 40026 | Loc parameter blocking | |
1AH** | 40027 | MV manual output value | |
1BH | 40028 | Srun run/stop selection | 0, run; 1, StoP; 2, HoLd |
1CH | 40029 | CHYS control hysteresis | Unit with measured value |
1DH | 40030 | At self-tuning | 0,OFF;1,on;2;FoFF |
1EH | 40031 | SPL reference lower limit | Unit with measured value |
1FH | 40032 | SPH reference limit | Unit with measured value |
20H | 40033 | Fru unit and power frequency | 0,50C; 1,50F; 2,60C; 3,60F |
21H | 40034 | OHEF OPH effective range | Unit with measured value |
22H | 40035 | Act positive / negative | 0,rE;1,dr;2,rEbA;3,drbA |
23H | 40036 | AdIS alarm selection | 0,OFF;1,on |
24H | 40037 | Aut cold output specification | 0, SSR; 1, rELy; 2, 0-20; 3, 4-20 |
25H | 40038 | P2 cold output proportional band | Unit with measured value |
26H | 40039 | I2 cold output integration time | second |
27H | 40040 | D2 cold output differential time | 0.1 second |
28H | 40041 | CtI2 cold output cycle | 0.1 second |
29H | 40042 | Et event input type | 0, nonE; 1, ruSt; 2, SP1.2; 3, PId2 |
2AH*** | 40043 | SPr heating rate limit | Unit of measurement / (minutes) (requires equivalent measurement for unit processing) |
2BH* | 40044 | Number of Pno blocks | Integer |
2CH* | 40045 | PonP power-on selection | 0, Cont; 1, StoP; 2, run1; 3, dASt; 4, HoLd |
2DH* | 40046 | PAF program parameters | See the instructions for the function |
2EH* | 40047 | STEP block number | Integer |
2FH* | 40048 | Run time | 0.1 or 0.1 hour, determined by PAF parameters |
30H* | 40049 | Event output status | 0, no event output; 1, event 1 (AL1) action; 2, AL2 action; 3, AL1 and AL2 action |
31H** | 40050 | OPrt soft start time | |
32H** | 40051 | Strt valve rotation time | Define the time required for the valve to rotate |
33H** | 40052 | Lower limit for SPSL | When the external input port is used to measure the valve feedback signal, set the valve positioning value 1 |
34H** | 40053 | SPSH external limit | When the external input port is used to measure the valve feedback signal, set the valve positioning value 2 |
35H** | 40054 | Ero fault output value | Adjust the output value of the meter when the sensor input fault or overrange is defined |
36H** | 40055 | AF2 | Function parameter 2 |
37H~3FH | 40056~40064 | spare | |
40H~47H | 40065~40072 | EP1~EP8 | |
48H** | 40073 | Valve position (read only) | The value 0~25600 corresponds to 0~100%, and the number of readings is divided by 256 squares as a percentage. |
49H~4FH | 40074~40080 | spare | |
50H~51H | 40081~40082 | SP 1, t 1 | SP1 is the given value 1, and t1 is the first program value. |
52H~ | 40083~ | SP2 ~ block data, the number is defined by the Pno parameter |
Description:
1. The parameter with an * asterisk is only available for AI-518P/708P/719P. If AI-518/708/719 is read or written, it is regarded as invalid parameter code. The parameter with ** is AI-719 and other instruments. Can be used, the parameters with *** are AI-518P/708P/719/719P and other models can be used.
2. If the parameter other than the parameter code (invalid parameter code or alternate parameter code) is read to the meter, the parameter value returned by the meter, the high value is 127 (if it is read as an integer is 32512~32767, due to the AI ​​series meter The maximum setting range of the parameter is 32000, so the parameter above 32512 can be used as the flag of the error reading parameter code), and it is processed in the upper computer program; if the reading parameter code is larger than the last value of the valid block (0B4H), the lower machine view The same transmission error, no response.
3. When the meter with manual adjustment function is in manual state, the manual output value can be adjusted by writing 1AH parameter.
4, 15H is the model characteristic word of the instrument. The numbers of different models are different. The upper computer can be used to distinguish the instrument model:
Model feature word | |
AI-518 (V8.0) intelligent thermostat | 5180 |
AI-518P (V8.0) program type intelligent thermostat | 5187 |
AI-708 (V8.0) high precision intelligent temperature controller | 7080 |
AI-708P (V8.0) high precision program type intelligent thermostat | 7087 |
AI-719 (V8.0) high precision intelligent thermostat / regulator | 7190 |
AI-719P (V8.0) high precision program type intelligent thermostat / regulator | 7197 |
AI-702M/704M/706M | 768 |
AI-708H/808H (flow channel) | 256 (normal accumulation mode); 257 (batch control mode) |
AI-808H (temperature and pressure channel) | 258 |
AI-301M | 512 |
AI-7048 four-way PID controller | 7048 |
For different types of instruments, the host computer should handle different modes of transmission data.
5. Cumulative flow clearing: The flow accumulation parameters FLJH and FLJL of AI-708H/808H can only be cleared and cannot be rewritten. The clearing method is to write 30808 to FLJH (when 2 addresses are occupied, the first address must be used. ), the accumulated flow rate FLJH, FLJL and pre-compensation flow accumulation EJH and EJL can be cleared, and the CLn value is increased by 1, CLn is read-only and cannot be rewritten. Writing 31808 to parameter code 2AH clears the batch control cumulative value and resets the batch control output relay.
Third, the programming method
The system adopts a master-slave multi-machine communication structure, and each time an instruction is sent to the meter, the meter returns a data. When writing the PC software, note that each valid command meter should respond within 0~150mS, and the host computer must wait for the meter to return data before sending a new command, otherwise it will cause an error. If the meter does not respond after exceeding the maximum response time (150mS), the cause may be invalid command, communication line failure, the meter is not turned on, the communication address is not matched, etc. At this time, the host computer should resend the command or skip the address change meter. For example, write the given value (parameter code 0) of the meter with the address (parameter ADDR) to 1 as 100.0 ° C (integer is 1000). The programming method using VB is as follows:
1. Initialize the communication port, including the same baud rate as the meter, data bit 8, stop bit 2, no parity. Note that some manufacturers' RS232/RS485 communication converters have certain requirements for control lines such as RTS and DTR. The host computer software must program these control lines. The RS232/RS485 converters produced by our company eliminate the need to program these lines.
2. The VB programming instruction (write SP1 to 1000) is: COMM1.OUTPUT=
CHR$$$$$$$$(129)+CHR$$$$$$$$(129)+CHR$$$$$$$$(67)+CHR$$$$$$$$(0 )+CHR$$$$$$$$(232)+CHR$$$$$$$$(3)+CHR$$$$$$$$(44)+CHR$$$$$$$$ (4)
3. Decimal point processing (only V8.0 version or above): In order to improve efficiency, all values ​​transmitted by the meter are 16-bit twos complement integers, so the upper digits and the integers must be converted into actual data with a decimal point according to certain rules. After the host computer program is started, the parameter dPt(0CH) should be read first to obtain the decimal point position of the measurement signal. Note: If the value of dPt is greater than or equal to 128, it means that the measured value transmitted, and the parameter of the same unit as the measured value should be divided by 10 for display. When writing such parameter value to the lower computer, it should be displayed. The number is canceled to become an integer, multiplied by 10, and the data is transmitted in 16-bit twos complement.
The technical indicators of the communication are as follows:
Instrument model | AI-301, AI-7/8 series instruments (V7.X) | AI-5XX series instrument |
Latest return time (4800bit/s condition) | 100mS | 150mS |
Fastest return time (19200 bit/s condition) | 5mS | 5mS |
Average read and write cycle (under 19200bit/s) | 20mS | 50mS |
The number of times the parameter allows rewriting | 1 billion times | 1 million times |
Note: For AI-5XX series instruments, the writing parameter cycle is not easy to be less than 2 minutes, otherwise the instrument may damage the storage unit during the 5-year warranty period.
Fourth, MODBUS compatible communication protocol
Starting from V8.2, AI series instruments can choose to use MODBUS communication protocol. AI instrument can support 2 sub-instructions under MODBUS protocol to communicate with other MODBUS devices more widely. To ensure the speed, AI instruments adopt RTU (binary Mode, the baud rate must be set to 9600bit/s, no parity, support 03H (read parameters and data) and 06H (write single parameter) these two instructions.
For the 03 command of the 518/708/708P/719/719P and other types of instruments, it is required to read 4 data at a time. The instructions are as follows:
ADDR+03H+0+ parameter code to be read +0+4+CRC check code
The return data is: ADDR+03H+08H+Measured value PV high + measured value PV low + set value SV high + SV low + alarm state + output value MV + read parameter value high + read parameter value low + CRC check code Low + CRC check code high
Write a single parameter instruction as:
ADDR+06H+0+ parameter code to be written + data high to be written + data low to be written + CRC check code
Due to the limitation of the MODBUS protocol, the use of a write command cannot return information such as measured values, which may result in the measurement value not being refreshed during writing. Therefore, the use of the write command should be minimized to avoid affecting system performance.
Xiamen Yudian Automation Technology Co., Ltd.
October 2010
Additional instructions:
For the 03 command of the 518/708/708P/719/719P and other types of instruments, it is required to read 4 data at a time. The instructions are as follows:
ADDR+03H+0+ parameter code to be read +0+4+CRC check code
The return data is: ADDR+03H+08H+Measured value PV high + measured value PV low + set value SV high + SV low + alarm state + output value MV + read parameter value high + read parameter value low + CRC check code Low + CRC check code high
For example, the SV reference value needs to be read. The address of the MODBUS register of the given value is 40001 (retentive register). The length required for each read by the UAV MODBUS compatible protocol is 4 words, which is equivalent to 40001, 40002. 40003,
40004; The command sent is 01 03 00 00 00 04 CRC: where 01 represents the address number of the meter, 03 is the function code read hold register, 00 00 is the parameter code, that is, the MODBUS register start address 0000 stands for 40001, 00 04 represents The length of the read is 4 words, the U-power meter only supports 4 words in length, and does not support more or less than 4. Finally, the CRC is verified.
Return data:
Regardless of the starting address of the read, the return data is: ADDR+03H+08H+Measured value PV high + measured value PV low + set value SV high + SV low + alarm state + output value MV + read parameter value high + The read parameter value is low + CRC check code low + CRC check code high bit format. For example, if the length of 4 words starting from 40001 is read, then the return value PV is stored at 40001, SV is at 40002, the alarm state and MV are at 40003, and the read parameter value is 40004.
For example, read the upper alarm value:
01 03 00 01 00 04 CRC (starting address 40002)
The storage address of the return value, 40002 is PV, 40003 is SV, 40004 is MV and alarm status, and 40005 is the upper limit alarm value;
Read lower limit alarm
01 03 00 02 00 04 CRC (starting address 40003)
The storage address of the return value, 40003 is PV, 40004 is SV, 40005 is MV and alarm status, and 40006 is the lower limit alarm value;
Yudian's compatible MODBUS protocol only supports writing single parameter instructions and does not support multiple. The instructions are as follows;
ADDR+06H+0+ parameter code to be written + data high to be written + data low to be written + CRC check code
Due to the limitation of the MODBUS protocol, the use of a write command cannot return information such as measured values, which may result in the measurement value not being refreshed during writing. Therefore, the use of the write command should be minimized to avoid affecting system performance.
If you need to write the SV value, that is, the register address is 40001 and the write value is 100.0.
The command sent is: 01 06 00 00 03 E8 CRC
The write instruction does not support returning the measured value and other information, and only returns the parameter value written by itself, that is, the data returned in 40001 is 100.0;
Http://news.chinawj.com.cn Editor: (Hardware Business Network Information Center) http://news.chinawj.com.cn
Weld Mesh,Galvanized Welded Wire Mesh,Stainless Steel Wire Mesh Panels,Heavy Gauge Wire Mesh
ANPING HONGYU WIREMESH CO.,LTD , https://www.hongyufence.com