Thank you. Reading through both the thread and the code, that seems to be a method to validate the checksum. I have the checksum (it is non-standard or, at least, non-common using Modulo 256). What I need to do is send the hex to the controller and receive the response.
Its also quite possible that I'm missing the key information in the links you posted.
What I think I am looking for is more like this thread but with the ability to send the hex string rather than poll a register.
It seems that as I am using an Uno, I also need to implement SoftwareSerial for the Uno>RS485.
Currently, I have this code that I'm looking to improve although I haven't yet figured out the SoftwareSerial changes that I need to make.
#include <ModbusMaster.h>
#include <SoftwareSerial.h>
#define MAX485_DE 3
#define MAX485_RE_NEG 2
ModbusMaster node;
void preTransmission()
{
digitalWrite(MAX485_RE_NEG, 1);
digitalWrite(MAX485_DE, 1);
}
void postTransmission()
{
digitalWrite(MAX485_RE_NEG, 0);
digitalWrite(MAX485_DE, 0);
}
void setup()
{
// put your setup code here, to run once:
pinMode(MAX485_RE_NEG, OUTPUT);
pinMode(MAX485_DE, OUTPUT);
// Init in receive mode
digitalWrite(MAX485_RE_NEG, 0);
digitalWrite(MAX485_DE, 0);
// Modbus communication runs at 115200 baud
Serial.begin(9600);
//Modbus slave ID 1
node.begin(1, Serial);
// Callbacks allow us to configure the RS485 transceiver correctly
node.preTransmission(preTransmission);
node.postTransmission(postTransmission);
}
void loop()
{
byte buf[] = {0x01, 0xA3, 0x01, 0x00, 0x00, 0x00, 0x00, 0xA5};
Serial.write(buf, 8);
Serial.write('\n');
int hexIn = Serial.read();
delay(30000);
}