Does any one know how to implement MODBUS protocol on pyboard?
Here is the basic description of what I want to do.
1. Read a variable (for example accelerator x axis) and store it in a register X
2. Use my user interface software to read the register from pyboard using Modbus RTU
3. I also want to write to variable Y using my user interface through Modbus RTU.
Once I can figure out how to implement this, I will expand this to reading and writing to multiple registers.
Can someone point me out in right direction?
MODBUS implementation
-
- Posts: 30
- Joined: Mon Mar 07, 2016 11:44 pm
Re: MODBUS implementation
All I know about modbus i read on wikipedia. But it appears to be a command and control protocol that can be used
over serial links, with some computer being the master and your pyboard being a slave. You would have to implement
a monitor program to run on the pyboard that would continuously wait for commands to arrive on the serial link, process
them and return data and/or status to the master, similar to the way the gdb debug stub does.
Hope this helps.
over serial links, with some computer being the master and your pyboard being a slave. You would have to implement
a monitor program to run on the pyboard that would continuously wait for commands to arrive on the serial link, process
them and return data and/or status to the master, similar to the way the gdb debug stub does.
Hope this helps.
Re: MODBUS implementation
I am stuck at how to implement the code on pyboard. I have my MODBUS code on my PC that works with another device that already has MODBUS protocal implemented on it. I was able to talk to the salve and write to it.
The step where I am stuck is, with MODBUS protocol I have to define registers and have to implement communication on Pyboard. I was able to send ASCII commands like "X=1", "X" to the pyboard and got responses back through UART. But have no idea how to implement MODBUS. Little complex for the knowledge I have.
The step where I am stuck is, with MODBUS protocol I have to define registers and have to implement communication on Pyboard. I was able to send ASCII commands like "X=1", "X" to the pyboard and got responses back through UART. But have no idea how to implement MODBUS. Little complex for the knowledge I have.
Re: MODBUS implementation
I had a look on MODBUS on Wikipedia, and found that link : https://github.com/bashwork/pymodbus/tr ... r/pymodbus
It seems to be a python implementation of the different MODBUS protocols.
Perhaps you can start from that and adapt it to micropython,
It seems to be a python implementation of the different MODBUS protocols.
Perhaps you can start from that and adapt it to micropython,
Re: MODBUS implementation
I think this is a MOBUS protocol you can implement on your PC to talk to devices that can talk MODBUS as well. I already have basic MODBUS protocol implemented on my PC.
I am also look for information about how to implement MODBUS on the Pyboard itself. Since the pyboard has to respond to MODBUS commands that I send from my PC. Right now I dont think pyboard is setup to respond as registers have to be defined.
I am also look for information about how to implement MODBUS on the Pyboard itself. Since the pyboard has to respond to MODBUS commands that I send from my PC. Right now I dont think pyboard is setup to respond as registers have to be defined.
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: MODBUS implementation
I think @vfl68 was suggesting that you use some of the code from that site to create an implementation to run on the Pyboard. Strip it down to a usable subset capable of running on a resource-constrained device. That would be my approach; easier than designing it from scratch.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: MODBUS implementation
Thank you for the clarification.
I was looking at some of the examples that pymodbus has, these might be helpful. @vfl68, thank you for the information.
If I have any questions I will let you guys know.
I was looking at some of the examples that pymodbus has, these might be helpful. @vfl68, thank you for the information.
If I have any questions I will let you guys know.
Re: MODBUS implementation
Hi
I’m looking for a modbus rtu library or code example. How did you get on with this? Do you have anything you would be happy to share with me? I’m a bit stuck and need modbus operating on micropython for a project
Thx
I’m looking for a modbus rtu library or code example. How did you get on with this? Do you have anything you would be happy to share with me? I’m a bit stuck and need modbus operating on micropython for a project
Thx