
wglockner (Customer) asked a question.
I am trying to change the analog high and low registers. After writing code with Arduino IDE that creates the client and then attempts to write to the registers, I receive a timeout error. I thought it could be a register offset issue by I have no luck with that. I am able to compile the code and send it to the PLC but when the write command is given, I receive the error. I have included my code below. The exact error reads: Failed to write heater-1 for Analog High Adjustment Connection timed out". Any help would be appreciated.
#include <P1AM.h>
#include <ArduinoRS485.h>
#include <ArduinoModbus.h>
#define HEATER_1_ADDRESS 1
#define HEATER_2_ADDRESS 2
#define HEATER_3_ADDRESS 3
#define HEATER_4_ADDRESS 4
#define ON_LINE_CONFIGURATION_ADDR 2065
#define ANALOG_HIGH_ADJUSTMENT_ADDR 0xAC55//44117
#define ANALOG_LOW_ADJUSTMENT_ADDR 44118
#define OUTOUT_1_LEVEL_ADDR 44115
#define HEATING_PERIOD_ADDR 1
unsigned long long data;
void setup() {
Serial.begin(9600);
while (!Serial);
Serial.println("Modbus RTU Client Toggle");
// start the Modbus RTU client
if (!ModbusRTUClient.begin(9600)) {
Serial.println("Failed to start Modbus RTU Client!");
while (1);
}
// for (heater) id 1: write the value of 0x14ED which is 5357 * 2.8uA or ~15mA,
// to the holding register at address 0xAC55 for Analog High Adjustment
if (!ModbusRTUClient.holdingRegisterWrite(HEATER_1_ADDRESS, ANALOG_HIGH_ADJUSTMENT_ADDR, 0x0000)) {
Serial.print("Failed to write Failed to write heater-1 for Analog High Adjustment");
Serial.println(ModbusRTUClient.lastError());
}
}
I would check first that your serial configuration settings match between the P1AM side and the SL4848-CR.
Your P1AM settings are currently 9600 baud, 8 data bits, no parity, and 1 stop bit
The defaults listed in chapter 7 of the SL4848-CR manual are 9600 baud, 7 data bits, Even parity, and 1 stop bit.