I'm trying to implement a RS485 communication with ARDUINO and am using MAX485 to connect from PC to ARDUINO. The problem is that whenever I set the DE-RE pins to low I get 0 byte outputted to my debug serial monitor (Serial2).
Basically, I'm trying to control Oriental Motor stepper motor with ARDUINO. This uses modbus protocol, RS485 communication.
My setup is connected as: ARDUINO Mega -> MAX485 -> cable to Oriental Motor controller. When I tried running it, the controller would spit out rs485 communication error. The timing of these errors agreed with my code setting the MAX485 DE & RE pins to LOW (to change to recieving mode).
To troubleshoot, I connected ARDUINO with my PC as ARDUINO->MAX485->MOXA RS485-USB converter->PC. Serial monitor on my pc shows, that the message I sent from ARDUINO comes trough successfully, but whenever I set the RE & DE pins from HIGH to LOW, another zero byte comes through. This zero byte seems to upset my Oriental Motor controller. Any idea what is the cause of that?
I'm trying to implement a RS485 communication with ARDUINO and am using MAX485 to connect from PC to ARDUINO. The problem is that whenever I set the DE-RE pins to low I get 0 byte outputted to my debug serial monitor (Serial2).
Even simply doing
digitalWrite(pinIO, HIGH);
delay(1000);
digitalWrite(pinIO, LOW);
will output a 00 byte
More info is needed.
Please post a schematic of the RS485 connections.
If pinIO controls the T/!R of the MAX485, and you have the 'A' and 'B' wires reversed and you have DI connected to TX1, and you are not sending any Data out when you enable the Transmit function of the MAX485.
With the 'A', 'B' wires reversed, the Serial1() idle level(high) becomes (low) followed byte the continuous LOW with is interpreted as a 0x0.
That is my explanation, BUT it is an ASSUMPTION with no BASIS in KNOWN FACTS. Since you did not post any FACTS.