-
Notifications
You must be signed in to change notification settings - Fork 192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reading Holding Register with length of 2 and unit id 3 #364
Comments
I suspect right code snippet should be like that. Note that real register address offset is 775 (try 774, back to 30775 or 30774 if no success). uint16_t res[2] = {0,0};
uint8_t show = LOOP_COUNT;
void loop() {
if (mb.isConnected(remote)) { // Check if connection to Modbus Slave is established
// Serial.print("Conencted to Modbus server ");
mb.readHreg(remote, 775, &res, 2, null, 3); // Initiate Read Hregs from Modbus Server
} else {
mb.connect(remote); // Try to connect if no connection
Serial.println("Not connected");
}
mb.task(); // Common local Modbus task
delay(100); // Pulling interval
if (!show--) { // Display Slave register value one time per second (with default settings)
Serial.println(res);
show = LOOP_COUNT;
}
} |
I have the same issue, trying to read Hreg 30775 from SMA Inverter. Unfortunately I always get "0" as a result from "res", although transaction id increments as expected. I can read the correct value of Hreg with another library but want to switch over to this one. |
Attempt to utilize code based on the provided example: this example. This example will display the error code associated with the operation, which may provide additional insights into the underlying issue. |
As those before me, I need to read 2 registers on an inverter with slave address 247. I have success with ModbusPoll, but not yet with this library. My code snippet is:` if (mb.isConnected(remote)) { // Check if connection to Modbus Slave is established |
Im trying to connect to an Inverter and read register 30775 with the length of 2. But it gives me back 0. If i connect with qmodmaster it shows a value.
Device got Unit Id 3. I dont exactly get how you define it in mb.readHred. Ive i look at the describtion i need to fill more informations. Like register length, a NULL and so on?
The text was updated successfully, but these errors were encountered: