stephane / libmodbus

A Modbus library for Linux, Mac OS, FreeBSD and Windows
http://libmodbus.org
GNU Lesser General Public License v2.1
3.44k stars 1.75k forks source link

Using Shared memory Mapping for other process #160

Closed nikorun closed 10 years ago

nikorun commented 10 years ago

Hi,

I was asking me how could it be possible to share the registers handled by libmodbus (the modbus_t structure) with another program that could read and write in it. I had used this once in Perl (IPC) and it was working very well, but altering the source of libmodbus to radicaly change the way it handle the main register structure si definitively out of my range ... My goal is too implement a PLC based on BBB that could

I've tried to put a little code in the middle of the "bandwidth-server-many-up.c" source but it's seems difficult to let enough time in the main loop for scanning the GPIO INPUTS, I guess libmodbus routines are waiting for events on it's network side so that my INPUT changes are not seen in "real time" like they 're in my little gpio program.

Not sure this is clear nor if it's the good place to talk about changes, But it seems to me that the principle of sharing registers could be interesting to improve this fabulous library usages.

Anyway, thanks for read ...

Nicolas

stephane commented 10 years ago

modbus_t structure doesn't store values that's the role of modbus_mapping_t and yes, you can share these values. Could you ask your questions on mailing list, please?