| With the traditional industry to digital,intelligent transformation pace is accelerating,the industrial site of communication network requirements are also increasing,traditional industrial communication network has been unable to meet all the needs of today’s manufacturing industry.Modbus communication protocol has been widely used in the field of industrial control since its birth.However,the traditional communication network based on Modbus protocol and RS-485 half-duplex bus has a single network topology and can not effectively network the slave nodes with different communication rates,resulting in the problem of "island node".This situation is especially common in complex communication networks.Based on the Modbus protocol rules,a new Modbus network topology is proposed and a Modbus multi-master protocol stack is developed.The protocol stack can create multiple Modbus master station interfaces at the same time,and poll multiple fieldbuses with different communication rates by time-sharing and crosspolling.It can not only solve the difficult networking problem of different frequency transmission nodes,but also meet the performance requirements of communication protocols in industrial sites.Firstly,this paper investigates the research status of Modbus multi-master system,analyzes the Modbus communication principle,RS-485 bus and embedded real-time operating system and other technologies,and analyzes the requirements of Modbus multimaster system from the functional and non-functional perspective.Secondly,according to the functional requirements analysis of Modbus multi-master station system,a hardware system is designed to meet the physical layer requirements of both master station and slave station with the 32-bit microprocessor of STMICROELECTRONICS as the core.The hardware system consists of real-time clock,RS-485 communication and power conversion modules.Thirdly,through the design of Modbus multi-master protocol stack state machine module,data frame detection module,data frame analysis module,function code definition module,multi-master polling module and the underlying data transceiver module,the framework of the protocol stack is constructed,and the software development,parameter configuration and function realization of the protocol stack are completed.Finally,in order to meet the testing requirements,this paper developed a Modbus slave protocol stack and transplanted it to the self-developed slave device to build Modbus communication network in the laboratory. |