Fjoao
From what I observed in the code:
 
  1. Checks if there is a received message
  2. If there is, it receives it
  3. Checks if it is in Modbus format
  4. Validates CRC
  5. Checks the ID
  6. Processes the response
  7. Calculates CRC
  8. Sends the response
I also noticed that we can define a Tx pin and the baud rate, my question is:
 
  • What if I have an RS485 module, with Rx and Tx? And does it only work as a slave?
 
I intend to create a block for my Rx and Tx module and use the rest of the code, I was already able to create the block and create the Arduino code for the block as described in the tutorial in part 3.3. But if there is an Rx pin and make it a master too, maybe I won't need to continue the work.
Reply 0 0
Fjoao
I did it this way:


[203128%2F9001388%2Fmceclip0]
 
But I got:

[203128%2F9001390%2Fmceclip0]
Reply 0 0
thiagoralves
The so called "Tx" pin on the editor refers to the RS485 enable that allows the slave to send data on the bus (by default RS485 is half-duplex, so needs a control signal when you want to speak). As for your block implementation, something is wrong in your block code, so the compiler is not being able to compile it.
Reply 0 0
Reply