QUESTION about an Error with writeMultipleRegisters
I have these two functions. the read works perfectly. But the write always returns an error. I want to know if I am writing it wrong.
The documentation for the controller said : Read Holding Register (0x03) and Write Multiple Holding Register (0x10)
Float voltage 9008 Boost reconnect voltage 9009
void readFloating() { result = node.readHoldingRegisters(0x9008, 3);
if (result == node.ku8MBSuccess) { floating = node.getResponseBuffer(0x00) / 100.0f; if (debug == 1) { Serial.print("Floating Voltage: "); Serial.println(floating); } BoostRecon = node.getResponseBuffer(0x01) / 100.0f; if (debug == 1) { Serial.print("Boost Reconect Voltage: "); Serial.println(BoostRecon); } } else { Serial.println("Error on Floating !!! "); rs485DataReceived = false; }
}
void ChangeDayNight() { if ((time3 > 17) && (bvoltage < 26.00) && (ChageDay == true)) {
ChageDay = false;
node.setTransmitBuffer(0, 2520);
node.setTransmitBuffer(1, 2510);
result = node.writeMultipleRegisters(0x9008, 2);
Serial.println("Changing to Night !!! ");
if (result == node.ku8MBSuccess)
{
Serial.println("Changing to Night Done!!! ");
} else {
Serial.println("Changing to Night Fail!!! ");
}
}
Thank you for all.