3/14/2013 11:34 AM | |
Joined: 12/1/2009 Last visit: 2/9/2025 Posts: 672 Rating:
|
Dear Radastan , why do you need to swap the CRC bytes? I do not see any reason for it can you explain? If you would be able to change it it is not following the modbus RTU standard. Unless you need to communicate to a devicefollowing its own protocolandclosetothe modbus. |
Give us your feedback and show us your respect! |
|
3/14/2013 12:10 PM | |
Joined: 1/17/2007 Last visit: 3/10/2025 Posts: 1557 Rating:
|
Modbus is an industry standard protocol and have changed very little since its introduction in 1979. It has always encoded its data in high-byte low-byte order (including the CRC). If the device you are interfacing to claims to be modbus then it should work correctly. If it does not, and the CRC bytes are genuinely reversed, then the device is not conforming to the modbus specification and it is therefore at fault. What is the device you are trying to interface with? Do you have a part number for it? Have you contacted the device manufacturer and told them about the issue? If they are selling it as a modbus device, it should be validated as conforming to the modbus specification. There should be no reason to need to program your own modbus solution. However, in case you really want to persue this avenue, then please see my comments in this thread. It will take some considerable effort to make a robust modbus driver though. Your call. |
Programming today is the race between software engineers building bigger and better idiot proof programs, and the universe producing bigger and better idiots. |
|
2/18/2020 10:02 AM | |
Posts: 2 Rating:
|
Here you are a function for compute Modbus CRC: [snip] Hope that will help you. AttachmentFunction.txt (432 Downloads) |
Last edited by: Jen_Moderator at: 02/18/2020 13:56:46Added function as a txt file. |
|
Follow us on