This paper introduces FreeModbus stack transplanted to the STM32 platform which has been embedded in the preemptive real-time operating system μC/OS-III,in order that the transplantation of the Modbus protocol is successful y im-plemented.The FreeModbus stack is analyzed in detail and STM32F103VET6 microprocessor underlying driver is writed,so that the two Modbus industrial communication function RTU and ASCII are successful y realized.%介绍了以FreeModbus协议栈在嵌入式抢占实时操作系统μC/OS-III的STM32平台上,成功实现了Modbus协议的移植。通过详细分析FreeModbus协议栈并编写STM32F103VET6微处理器的底层驱动,成功实现了工业Modbus协议RTU和ASCII两种模式的通信功能。测试结果表明,在实际工业生产控制和仪表开发中,应用Freemodbus协议,完全符合工业数据采集、实时控制和数据处理等厂级重复性和精确度要求,在一定程度上降低了工业仪表开发的周期及成本。
展开▼