Unable t0 read data from VFD using Arduino through MAX485 (ModbusMaster Library)

Hi,

I'm going to read the output frequency and output current from VFD using Arduino Mega.
Datasheet : http://www.mobinniroo.com/shihlin/SSD/Manuals/Inverter-SFG-Manual-102.pdf
Communication Function (page 62), Communication Command List (page 77).

However, the serial output only show weird symbol, boxes or just showing zero.

I'm able to use the same code, same wiring but just difference holding registers address to read the data from a PID Controller. So i wonder is that anywhere i have make a mistake.

#include <ModbusMaster.h>

#define MAX485_RE_NEG  2
#define MAX485_DE      2

// instantiate ModbusMaster object
ModbusMaster node; //CALL MODBUSMASTER AS NODE

void preTransmission()
{
  digitalWrite(MAX485_RE_NEG, 1); //TRANSMISSION MODE
  digitalWrite(MAX485_DE, 1);}


void postTransmission()
{
  digitalWrite(MAX485_RE_NEG, 0); //RECEPTION MODE
  digitalWrite(MAX485_DE, 0);
}

void setup()
{
  pinMode(MAX485_RE_NEG, OUTPUT);
  pinMode(MAX485_DE, OUTPUT);
  
  // Init in receive mode
  digitalWrite(MAX485_RE_NEG, 0);
  digitalWrite(MAX485_DE, 0);

  Serial.begin(9600, SERIAL_8E1); //databit+parity+stopbit (8E1) 

  // 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()
{
  uint8_t ResultRead; //RESULT READING
  
    ResultRead = node.readHoldingRegisters(0x03,2);

  if (ResultRead == node.ku8MBSuccess)
  {
   Serial.print("\nOutputFreq: ");
   Serial.println(node.getResponseBuffer(0x03));
   Serial.print("\nOutputCurrent: ");
   Serial.println(node.getResponseBuffer(0x04));
  }
  delay(1000);
}

Thanks in advance if there's any help given.

I suggest you re-read section 5.16 on page 62 the manual.

I have a guess I know what is wrong, but you should to find the error yourself.

.

Thanks for your reply.

Do you means the modbus protocol and shihilin protocol selection ? I have changed to Modbus protocol while testing.

mintchocolate:
Thanks for your reply.

Do you means the modbus protocol and shihilin protocol selection ? I have changed to Modbus protocol while testing.

Yes.

If you did that, then I have no clue.
I don't have this item.

Good luck.

Is okay. I will continue to figure it out.

Thanks for your help anyway.