Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : Modbus
Page 1 of 2 | |||||
Author | Message | ||||
PhenixRising Guru Joined: 07/11/2023 Location: United KingdomPosts: 859 |
Does anyone have a copy of the code that was on FoTS? I have downloaded Daniel's HTTRACK (thanks Daniel ) and I see the CRC stuff but not the actual protocol. |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 4234 |
Hi Phenix, The CRC calculation is currently build into PicoMite (MATH CRC16). It is a generic CRC calculation, you just need to provide the seed and poly. Modbus uses CRC16-IBM (a variant of CRC16) CRC overview and Python CRC overview Volhout Edited 2024-01-16 20:29 by Volhout PicomiteVGA PETSCII ROBOTS |
||||
PhenixRising Guru Joined: 07/11/2023 Location: United KingdomPosts: 859 |
Ah, misunderstanding CRC is not the problem; the actual Modbus comm's protocol was posted on FoTS but I can no-longer find it. |
||||
disco4now Guru Joined: 18/12/2014 Location: AustraliaPosts: 896 |
Temporary static copy of FotS Look here under M for MODBUS Latest F4 Latest H7 |
||||
PhenixRising Guru Joined: 07/11/2023 Location: United KingdomPosts: 859 |
Thanks Gerry but already have this....it's just the CRC stuff. I remember that the Cap'n published actual Modbus comm's protocol (coils, registers, etc.) Did i dream it? |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6792 |
Modicon Modbus protocol Not 'Mite specific, this is general. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
PhenixRising Guru Joined: 07/11/2023 Location: United KingdomPosts: 859 |
Thanks Mick, This was my first plan but I was certain that an MMBasic sample was already on FoTS. I'll create it when I actually need it. |
||||
Turbo46 Guru Joined: 24/12/2017 Location: AustraliaPosts: 1611 |
I put the Modbus CRC stuff on FoTS but their is no other reference to Modbus in there. The reference guide is slanted towards Modicon PLCs and the reference to coils, holding registers and register addresses don't make understanding the protocol easier. Most of it is irrelevant to most modern implementation. The Modbus protocol is fairly simple really, you only need to implement the commands you need. Bill Keep safe. Live long and prosper. |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6792 |
I think most of the PLCs that use Modbus tend to use a similar concept of coils, contacts and registers - at least as an option. The main thing is to keep with the same header and packaging system if possible. The data is up to you. The detail in the Modicon document is specific, but the basic info near the beginning is relevant to all Modbus systems, I think. You have to remember that it's designed as a high reliability industrial system so keeping close to the spec is an advantage. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
PhenixRising Guru Joined: 07/11/2023 Location: United KingdomPosts: 859 |
If I understand this correctly, this waveshare module will convert to/from Modbus TCP. |
||||
Turbo46 Guru Joined: 24/12/2017 Location: AustraliaPosts: 1611 |
It Looks like it but I have no experience with Modbus TCP. All our applications used Modbus RTU and were not PLCs. Bill Keep safe. Live long and prosper. |
||||
disco4now Guru Joined: 18/12/2014 Location: AustraliaPosts: 896 |
Is this post helpfull Latest F4 Latest H7 |
||||
PhenixRising Guru Joined: 07/11/2023 Location: United KingdomPosts: 859 |
Many thanks, guys. Yeah this stuff is no big deal...KISS principle. |
||||
SimpleSafeName Guru Joined: 28/07/2019 Location: United StatesPosts: 319 |
It's my understanding that Modbus TCP is actually Modbus RTU encapsulated in a TCP packet. And because of the encapsulation, there are a couple of quirks that come with it. 1) The CRC16 checksum is no longer necessary, since the TCP packet will take care of that. 2) It opens up the possibility of multiple masters. But it's been a hot minute since I messed with Modbus. When I worked for Schneider we saw plenty of interesting adaptations of the Modbus specs. :) |
||||
PhenixRising Guru Joined: 07/11/2023 Location: United KingdomPosts: 859 |
Ah-ha, I was wondering about this very thing. Edited 2024-01-18 16:07 by PhenixRising |
||||
SimpleSafeName Guru Joined: 28/07/2019 Location: United StatesPosts: 319 |
Yeah, but... To a certain extent, Modbus is an example of an open protocol that has descended into chaos. So while it might not be necessary to include the checksum, the "wrapper" that encapsulates the packet takes what has been given to it, which surely came with a CRC already calculated. And while it is one thing for you to ignore the CRC on your end when receiving a packet, I'm going to guess that the target for your packets on the other end won't be as forgiving. And were you aware that the CRC16 result needs to have the bytes swapped? Usually. I created a CRC16 routine in VB and PowerBasic many moons ago, and VB gave me nothing but trouble when I swapped the bytes. Finally I converted the result to Hex$, and swapped those character pairs around and then converted it back to decimal. |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6792 |
Yeah - Modbus is a "standard" of which everyone uses their own version. To appreciate its true beauty you have to go back to the days of hardware UARTs and logic chips. That's how it was designed to be used. Forget what people have done to it when they've emulated it in firmware / software because they are usually in the wrong! Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
SimpleSafeName Guru Joined: 28/07/2019 Location: United StatesPosts: 319 |
To appreciate its true beauty you have to go back to the days of hardware UARTs and logic chips. That's how it was designed to be used. Forget what people have done to it when they've emulated it in firmware / software because they are usually in the wrong! It's still very effective, and at the heat death of the universe it will be cockroaches and Modbus as the last two standing. I'm helping out on a project destined for Antarctica, and since it's an upgrade from a Rockwell PLC to a Turck TBEN PLC we may have to use Modbus to communicate to the HMI. But while working for Schneider I can recall three instances of outside vendors telling us that we had it wrong. :) |
||||
Turbo46 Guru Joined: 24/12/2017 Location: AustraliaPosts: 1611 |
Surely if you implement the commands as defined in the Modicon Modbus Protocol Reference Guide systems must be compatible with each other. Bill Keep safe. Live long and prosper. |
||||
PhenixRising Guru Joined: 07/11/2023 Location: United KingdomPosts: 859 |
That's some nice looking hardware Switching away from Rockwell is always an "upgrade" If I never use that stuff ever again, it will still be too soon |
||||
Page 1 of 2 |
Print this page |