Hello, I need help to communicate an Arduino Mega and a TRS Fieldbus(PID module).
I want to be able to communicate an Arduino to a PID module(TRS Fieldbus - TRS Fieldbus Technical Information ), I have a problem because this PID module works with a Profibus interface using RS-485 standard, which I have never used, so I have many doubts of how can I get a communication between these, due to the technical information of the module is really vague.
I have been researching about this topic but I have not found much yet, I have read about using a RS-485 circuit with a MAX485 but Im not really sure if that would be enough.
RS-485 is a serial line interface, like RS-232 or RS-422. It does not affect the transferred data, only the logic levels on the signal lines. It can be used for half and full duplex connections, where full duplex means transmission in both directions at the same time, while with half duplex the transmission direction of a single line has to be switched in code. You connect the RS-485 line driver module to a serial port (Rx/Tx), e.g. Serial or a SoftwareSerial port.
If the connected module uses half-duplex, and you don't know when to switch the direction, leave it in receive direction, and switch to transmit direction only while you send data in code.
I'm not sure about the Fieldbus protocol, but it looks to me like messages of 6 bytes are transmitted by the master or slave. Make sure to select the right baudrate, then use the serial read() and write() methods to transfer the bytes.
Hi DrDiettrich, thank you for your help and sorry for the late answer, I tried what you said, following another topic on this forum I connected the Arduino to the PID modulo using a MAX485 like in this picture:
As I investigate, it appears that the slave would recognize the master baudrate and work with it, so I made the following code to try to send and receive the 6 bytes message:
The way I see it in the technical information of the manufacturer( TRS Fieldbus - PBX 21 AXIS ) I have to send a 6 byte frame to the PID module indicating that the Master is ready so it can start sending information to the Arduino, at least that is what I understand from it.
So, I tried all of this but the only thing I receive is the number 3210000 only one time, I think that the way I am sending and receiving the 6 byte frame is wrong or something like that, so if anyone could help me through this will be awesome.