Skip to content
This repository has been archived by the owner on Jul 30, 2021. It is now read-only.

Writing data in to a holding register. #11

Open
MaxAbarca1993 opened this issue Jan 15, 2020 · 10 comments
Open

Writing data in to a holding register. #11

MaxAbarca1993 opened this issue Jan 15, 2020 · 10 comments

Comments

@MaxAbarca1993
Copy link

MaxAbarca1993 commented Jan 15, 2020

Hi Bertmelis, I'm so iterested on this library, it worked very well for me, but i don't now if it has implemented the write holding regiters yet. I really hope if you can help me with this. I'm working on a water well system that needs to send data via modbus tcp and store it on a database, so, the data acquirer is a ESP32 board. Thank you very much for your work, it was a great advace for my proyect.

@berguinsson
Copy link

Hi MaxAbarca1993,
Did you get something? I have to do something similar as you.
I'm looking forward to hearing from you!

@sigitnurmajid
Copy link

Hi MaxAbarca1993,
Did you get something? I have to do something similar as you.
I'm looking forward to hearing from you!

@bertmelis
Copy link
Owner

I'm writing a completely new version. The current TCP management has a few flaws. I'll upload the new version this evening (in a new branch). API stays the same. It'll include FC03, write holding registers. (I already have FC06, write single register)

@bertmelis
Copy link
Owner

Please have a look at branch v1.

I was a bit confused earlier. Do you need FC06 (write holding register) or FC16 (set multiple registers).

@MaxAbarca1993
Copy link
Author

Hi bertmelis, first of all, thanks for your work and your answer. About your doubt, I needed FC06 write holding registers for my project.

@bertmelis
Copy link
Owner

Ok, FC06 is included in the v1-branch. Could you try this? I'm not able to test in various situations because I don't have any modbus devices anymore.

@sigitnurmajid
Copy link

Hi bertmelis, I have already use your code to read and write data to holding register and it's works but I can't set my cycle time for read and write less than 1 second and status modbus always connecting.

@bertmelis
Copy link
Owner

You mean you read and write every second? I'll try some stress testing myself, but that's pretty fast for modbus.

So it works but not if yo read/write too fast?

@sigitnurmajid
Copy link

sigitnurmajid commented Apr 24, 2020

I have project to controll and monitoring some modbus device, and I need to read and write registers about 50ms/looping to chasing realtime. Is it possible to use modbus protocol?

lastMilis = 0; if ((millis() - lastMillis > 50)) { lastMillis = millis(); MB.readHoldingRegisters(address, length) }

Here code for example what i want. Thank you very much

@bertmelis
Copy link
Owner

Maybe it is possible but I wouldn't use modbus to poll a device every 50ms. May I ask what kind of project you're building?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants