亚洲视频福利,亚洲丶国产丶欧美一区二区三区,H漫无羞遮无删减漫画免费,需要影音先锋下载的AV,国产日本一区二区精品,亚洲黄图

首頁(yè)
產(chǎn)品
卓越 ? 易用 ? 可靠
視頻
讓中國(guó)物聯(lián)網(wǎng)領(lǐng)先世界
搜索
歷史搜索
搜索發(fā)現(xiàn)
HOME > NEWS > Industry news

Introduction to Modbus RTU

2022-03-07 15:51:36| Source:網(wǎng)絡(luò)| views:| 0

  1、 Brief description of Modbus Protocol

  Acrxxxe series instruments use Modbus RTU communication protocol, which defines the check code and data sequence in detail, which are necessary for specific data exchange. Modbus protocol uses master-slave response connection (half duplex) on one communication line, which means that signals are transmitted in two opposite directions on a separate communication line. First, the signal of the host computer is addressed to a unique terminal device (slave), and then the response signal sent by the terminal device is transmitted to the host in the opposite direction.

  Modbus protocol only allows communication between the host (PC, PLC, etc.) and the terminal equipment, but does not allow data exchange between independent terminal equipment, so that each terminal equipment will not occupy the communication line when they are initialized, but only respond to the query signal arriving at the local machine.

  1.2 query response cycle

  1.2.1 query the function code in the query message and tell the selected slave what function to perform. The data segment contains any additional information about the functions to be performed by the slave device. For example, function code 03 requires the slave device to read the holding registers and return their contents. The data segment must contain the information to tell the slave device: which register to read from and the number of registers to read. The error detection domain provides a method for the slave device to verify whether the message content is correct.

  1.2.2 response if a normal response is generated from the device, the function code in the response message is the response of the function code in the query message. The data segment includes the data collected from the device: such as register value or status. If an error occurs, the function code will be modified to indicate that the response message is an error, and the data segment contains the code describing the error message. The error detection domain allows the master to confirm whether the message content is available.

  1.3 transmission mode

  Transmission mode refers to a series of independent data structures and limited rules for data transmission in a data frame. The transmission mode compatible with Modbus protocol – RTU mode is defined below.

  Bits per byte:

  ·1 start bit

  ·8 data bits, and the smallest significant bit is sent first

  ·No parity bit

  ·1 stop bit

  Error checking: CRC (cyclic redundancy check)

  1.4 agreement

  When the data frame reaches the terminal device, it enters the addressed device through a simple "port". The device removes the "envelope" (data header) of the data frame, reads the data, and if there is no error, it performs the task requested by the data. Then, it adds the data generated by itself to the obtained "envelope" and returns the data frame to the sender. The returned response data includes the following contents: the address of the terminal slave, the function executed, the requested data generated by the execution command and a check code. If any error occurs, there will be no successful response, or an error indication frame will be returned.

  1.4.1 data frame format

  Address Function Data Check

  8-Bits 8-Bits N x 8-Bits 16-Bits

  1.4.2 address field

  At the beginning of the frame, the address field is composed of one byte (8-bit binary code), with decimal system of 0 ~ 255. In our system, only 1 ~ 247 are used, and other addresses are reserved. These bits indicate the address of the user specified terminal device, which will receive data from the host connected to it. The address of each terminal device must be unique. Only the addressed terminal will respond to the query containing the address. When the terminal sends back a response, the slave address data in the response tells the host which terminal is communicating with it.

  1.4.3 function field

  The function domain code tells the addressed terminal what functions to perform. The following table lists the function codes used in this series of instruments, as well as their meanings and functions.

  Code meaning behavior

  03 read the data register to obtain the current binary value of one or more registers

  16 preset multiple registers to set binary values into a series of multiple registers (not open to acrxxxe)

  1.4.4 data field

  1.4.5 error check field

  This domain allows the host and terminal to check for errors during transmission. Sometimes, due to electrical noise and other interference, a group of data may change on the line when it is transmitted from one device to another. Error checking can ensure that the host or terminal does not respond to the changed data in the transmission process, which improves the safety and efficiency of the system. Error checking uses the 16 bit cyclic redundancy method (CRC16).

  1.5 error detection method

  The error check (CRC) field occupies two bytes and contains a 16 bit binary value. The CRC value is calculated by the transmission device and then attached to the data frame. The receiving device recalculates the CRC value when receiving the data, and then compares it with the value in the received CRC field. If the two values are not equal, an error occurs.

  During CRC operation, first preset a 16 bit register to all 1, and then continuously operate 8 bits in each byte of the data frame with the current value of the register. Only 8 data bits of each byte participate in the generation of CRC. The start bit, end bit and possible odd and even bits do not affect CRC. When generating CRC, the 8 bits of each byte are XOR with the contents of the register, and then the result is shifted to the low bit. The high bit is supplemented with "0", and the lowest bit (LSB) is moved out and detected. If it is 1, the register performs an XOR operation with a preset fixed value (0a001h). If the lowest bit is 0, no processing is performed.

  The above processing is repeated until the shift operation is completed for 8 times. When the last bit (the 8th bit) is moved, the next 8-bit byte performs XOR operation with the current value of the register, and the other 8-shift XOR operation is also performed. When all word sections in the data frame are processed, the final value generated is the CRC value.

  The process of generating a CRC is:

  1 preset a 16 bit register as 0ffffh (all 1), which is called CRC register.

  2. XOR the 8 bits of the first byte in the data frame with the low byte in the CRC register, and save the result back to the CRC register.

  3 move the CRC register to the right by one bit, fill the highest bit with 0, and move the lowest bit out and detect.

  4 if the lowest order is 0: repeat the third step (next shift); If the lowest bit is 1: XOR the CRC register with a preset fixed value (0a001h).

  5 repeat steps 3 and 4 until 8 shifts. This completes a complete eight bit.

  6 repeat steps 2 to 5 to process the next octet until all byte processing is completed.

  7 the value of the final CRC register is the value of CRC.

  In addition, there is also a method of calculating CRC by using preset tables. Its main feature is that the calculation speed is fast, but the tables need large storage space. This method will not be repeated here. Please refer to relevant materials.

  The data field contains the data required by the terminal to perform specific functions or the data collected when the terminal responds to queries. The contents of these data may be numerical values, reference addresses or setting values. For example, the function domain code tells the terminal to read a register, and the data domain needs to indicate which register to start from and how many data to read. The embedded address and data vary according to the type and different contents between slaves.


聯(lián)系銷售
銷售王經(jīng)理微信 銷售王經(jīng)理
微信公眾號(hào) 微信公眾號(hào)
服務(wù)熱線
400-6688-400
百色市| 林口县| 海淀区| 沾化县| 年辖:市辖区| 鄯善县| 上杭县| 崇仁县| 和顺县| 忻州市| 莱阳市| 武功县| 农安县| 陆川县| 瑞金市| 崇明县| 房山区| 成武县|