TComPort and Modbus-RTU?

让人想犯罪 __ 提交于 2019-12-11 05:49:51

问题


It is possible to read and send data with TComPort for modbus RTU protocol?

I have read wiki http://en.wikipedia.org/wiki/Modbus for modbus, but what mean start and end with 3.5c idle?

I use C++Builder2009


回答1:


Of course it's possible.

In MODBUS ASCII it is easy to determine end of message since 2 bytes are used for single byte transmitted over communication line (byte is transmitted as it's ASCII hexadecimal representation), but in MODBUS RTU you have 1 byte used for single byte transmitted which means that they had to know somehow that messages has ended. So, bytes are added to a new message as long as pause between them is less then 3.5 characters. When pause is greater then 3.5, you have an end of a message and you can parse the message, process it, and get ready for new one. This idle time is measured in characters since that is the only constant. Time period of 1 character transmitted over 9600 and over 115200 is not the same, and it is also not the same for 9600-8N1 and for 9600-8E2, so you have to adjust that time based on COM port settings.




回答2:


yes its possible to send data with comport using modbus protocol. There are various packages for that like RXTXcomm.jar,comm.jar which provide functions to communicate with slave device using com port



来源:https://stackoverflow.com/questions/6276860/tcomport-and-modbus-rtu

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!