摘要
为了实现RS-232/485通用串口设备接入Modbus总线,设计了一种通用串口到Modbus RTU的协议转换器,以IAP12C5A60S2单片机为主控制器;介绍了硬件结构和电路实现方法,结合Modbus RTU协议规范提出了软件设计思想,分析协议转换关键问题并给出了解决办法;最后,采用串口调试工具STC-ISP和RCP-972仪表对协议转换器进行测试和分析,结果表明主设备发出命令帧后100 ms内收到协议转换器回传的数据帧,协议转换器能够正确实现协议转换和报文转发功能。
In order to realize equipment with RS--232/485 general serial port accessing to Modbus bus, this paper designed a protocol converter between general serial port and Modbus RTU, which used single chip microcomputer IAP12C5A60S2 as CPU. First, introduced hardware structure and implementation method of circuit. Referenced to Modbus RTU protocol specifications, presented software design ide- as. Then, analyzed the key problems of protocol conversion and presented solutions. At last, tested and analyzed protocol converter by using serial port debug tool STC--ISP and instrument RCP--972. Test results indicate that data frame of protocol converter will return to main e- quipment in 100ms after command frame is sent out, and protocol converter can realize function of protocol conversion and message retrans- mission properly.
出处
《计算机测量与控制》
北大核心
2014年第2期604-606,共3页
Computer Measurement &Control
基金
国家自然科学基金项目(61063010)
云南省教育厅科学研究基金项目(2013Y364
2011Y123)
关键词
通用串口
MODBUS
RTU
协议转换
单片机
双串口
general serial port
Modbus RTU
protocol conversion
single chip microcomputer
double serial port