Questions tagged [libmodbus]

libmodbus is a library written in C to communicate with devices which implement the modbus interface. libmodbus supports RS485(serial) and TCP/IP(network) mode of communication.

21 questions
1
vote
0 answers

Timeout error when trying to read a register with limodbus

I'm trying to read different registers of a sensor using limodbus and I'm new to this and I can't find the answer on an other post. Thanks a lot for taking the time to help me find what I'm missing. I've been able to get the temperature value with…
Meb
  • 11
  • 4
1
vote
0 answers

Linux libmodbus multi thread free(): double free detected in tcache 2 Aborted (core dumped)

Hi all im working in linux libmodbus tcpip server client process I am reading the data from 3 different server, when all the server are connected then there is no issues but when i disconnect one server form the network then the following error is…
Nagaraj JP
  • 11
  • 2
1
vote
1 answer

Modbus calls returning same frame over and over again

I'm having a dickens of an issue with this one. I have a remote installation with a raspberry pi installed in it (specifically a Kunbus RevPi connect) that is hooked up to an RS485 Modbus network with a total of 6 sensors on it. 4 Of these sensors…
1
vote
1 answer

Change Unit ID in modbus_read_registers of libmodbus

I have used the libmodbus to build a project to connect to my device by modbus-tcp. The project run. But Unit ID is wrong. My ID slave is 0xFE. However it is fixed as 0xFF whenever I send a modbus-tcp package. I had tried to change it by function…
Bell Blue
  • 11
  • 2
1
vote
0 answers

libmodbus: modbus_mapping_new() not working on WSL

I'm using libmodbus to setup a modbus slave. The app is setting a slave using the command modbus_mapping_new(500, 500, 500, 500) When I run it on my windows PC I get this output: Slave(0) - Slave Mapping Content: Slave(0) - nb_bits 500 Slave(0) -…
tyleax
  • 1,556
  • 2
  • 17
  • 45
1
vote
1 answer

Modbus Simulation between two PCs using a USB connection with libmodbus or pymodbus

I am trying to connect to PCs (one master one slave) that will communicate with each other using the modbus protocol, I wanna use pymodbus (Python) or libmodbus (C++) to make this but I am relatively new to Modbus therefore I am not sure where to…
slavinium
  • 41
  • 3
1
vote
0 answers

modbus_read_registers() of libmodbus library not able to read RS485 data on Raspbian GNU/Linux 10 (buster) but able to read on Yocto Dizzy Release

I am using below c\c++ sample code to read Modbus RTU data using libmodbus. I have two different linux based gateways one has Raspbian GNU/Linux 10 (buster) while other has Yocto Dizzy Release. Using libmodbus lib, I am able to read modbus tcp data…
1
vote
0 answers

how to use libmodbus, using a makefile?

Im working in a new project, and i need use modbus tcp/ip... the current project has already a makefile, the main problem is that i don't know how to edit the makefile to link the library. Anyone can help me? please! Hi! Im working in a new project,…
1
vote
1 answer

Closing a socket created in a dll

I'm creating a modbus slave using the libmodbus.dll in python on Windows OS. I've used ctypes to load the dll and make use of its features. There is a sample code I'm mimicking here. One of the call's in the dll ends up opening a socket s =…
tyleax
  • 1,556
  • 2
  • 17
  • 45
1
vote
0 answers

Implementation of modbus gateway functionality by using libmodbus in C

I am involved in project where I am implementing a gateway functionality in C by using libmodbus library. On the server side I am trying to read a device using modbus_read_input_registers() function. Now I want to send the received message from the…
dr.jones
  • 11
  • 3
1
vote
1 answer

having trouble using std::mutex

I'm having trouble using std::mutex ( cpp ) to serialize access to a shared resource (I need to use libmodbus which is not thread-safe. I'm currently trying to serialize access to the modbus_write_registers function by placing a mutex.lock()…
1
vote
2 answers

libmodbus: how to compile application including libmodbus library?

I have a problem with compilation of my application, which is based on libmodbus library: https://github.com/stephane/libmodbus I have tried to compile it using this command: cc pkg-config --cflags --libs libmodbus modbus.c -o modbus But I get the…
1
vote
1 answer

C++ decrease modbus_connect timeout

I'd like to try 10 immediate modbus connections. However, everytime I fail to connect, and I have to wait for 2 minutes for the next connection because the previous modbus_connect call is still actively listening. So, if I fail to connect 10 times,…
Anthony
  • 146
  • 1
  • 9
1
vote
0 answers

libmodbus - monitor and restart connection

I am developing a Modbus TCP client on Linux to communicate with different Modbus devices using libmodbus. To initialize the TCP connection, the function int modbus_connect(modbus_t *ctx); is called and returns 0 if the connection was successful. I…
Engineer999
  • 3,683
  • 6
  • 33
  • 71
0
votes
0 answers

Reading a transmitted value from the register on the Modbus server

Hello to all programmers out there, I think I have a basic understanding problem about the libmodbus library and I've been looking for a reasonable answer for a while but couldn't find one. Hence my question here in the forum: Using the libmodbus…
1
2