Modbus over Arduino

If you can read correctly, then the auto switching RS485 board is working.

I will see if I can figure out why the corrupted modbus messages are being generated.

Ok sir!
I will wait for your reply

node.writeSingleRegister( 2, 1000 );

For this function 1st parameter is hexadecimal address so why you put decimal number.
Can you explain the parameter in more details

Ok. The corrupted modbus messages were being generated when the MAX485 chip switched. I modified the preTransmission function so that it now looks like this:

// Put the MAX485 into transmit mode
void preTransmission()
{
 digitalWrite(MAX485_RE_NEG, 1);
 digitalWrite(MAX485_DE, 1);
 delayMicroseconds(100);
}

That stopped the start of the message being corrupted. I think we can say that the ModbusMaster library is working correctly.

The concept of decimal vs hexadecimal is for us humans. The number 2 (decimal) is exactly the same number as 0x02 (hexadecimal). I could have also used 0b00000010 (binary).

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.