Page 1 of 1

Send Write Single Register by c code in Modbus

Posted: 04 Jun 2020, 18:34
by plima
Hi there,

I need to send a Write_Single_Register in a modbus master only once.
I have a custom console application written with c language and I am not being able to find out how can I achieve this.

Is it possible? How can I do this?

Re: Send Write Single Register by c code in Modbus

Posted: 15 Jun 2020, 11:27
by dirk
Hi, this is an interesting requirement. This feature is not implemented. We have put it in our backlog as a feature request.

Re: Send Write Single Register by c code in Modbus

Posted: 17 Jun 2020, 13:55
by plima
That's great news.

How can I follow the development? do you have a roadmap for it?

Re: Send Write Single Register by c code in Modbus

Posted: 16 Jul 2020, 11:05
by plima
Any news about this development?

Re: Send Write Single Register by c code in Modbus

Posted: 20 Jul 2020, 10:47
by Amar
Hi Plima,
Here is a possible solution since we have not yet finalized on this feature request.piModbusMaster uses statically linked libmodbus library.

https://libmodbus.org/documentation/

In this case you can do as following:

1) piMaster service should not be running directly on startup
/lib/systemd/system/pimodbus-master.service

2) Start your required C application first to execute Write_Single_Register using the libmodbus API
https://libmodbus.org/documentation/

3) Then start piModbusMaster
sudo systemctl start pimodbus-master.service

Best Regards,
Amar