A collection of Fortran 2018 interface bindings to libmodbus, for Modbus RTU and Modbus TCP access.
The package libmodbus has to be installed with development headers. On FreeBSD, run:
# pkg install comms/libmodbus
On Linux, instead:
# apt-get install libmodbus5 libmodbus-dev
Build and install the Fortran library using the provided Makefile:
$ make
$ make install PREFIX=/opt
Link your programs against /opt/lib/libfortran-modbus.a -lmodbus
. Optionally,
overwrite the default compiler and the compiler flags:
$ make FC=ifx FFLAGS="-O3"
Or, use the Fortran Package Manager:
$ fpm build --profile release
Build and run the test program:
$ make test
$ ./test_modbus
You can add fortran-modbus as an FPM dependency:
[dependencies]
fortran-modbus = { git = "https://github.com/interkosmos/fortran-modbus.git" }
ISC