Monarco HAT MCU (microcontroller) is connected as UART device on the Raspberry Pi UART-0 (/dev/ttyAMA0). Data on this interface is normally forwarded between Monarco HAT RS-485 and Raspberry Pi UART-0 in both directions with correct buffering for half-duplex operation.

The configuration of the RS-485 bus on the Monarco HAT consists of two parts:

  • Configuration of internal UART (/dev/ttyAMA0) communication between the Raspberry Pi and the MCU of the Monarco HAT.
  • Configuration of the external RS-485 communication interface.

It is recommended to use an example from the REXYGEN library as a starting point of your project. For Modbus RTU on Monarco HAT are provided following examples:

  • 0121-10_Monarco_HAT_Modbus_RTU_ADAM-4024
  • 0121-11_Monarco_HAT_Modbus_RTU_Loopback_USB

Internal UART communication (host side communication)

By default, the Monarco HAT MCU expects UART communication with 115200 Baud, 8 data bits, no parity, 1 stop bit. Therefore it is necessary to use these settings in Modbus Configuration dialog (if you used an example from REXYGEN library, you will find this dialog in the MBM and MBS blocks):

Note: It is typically not necessary to change the internal communication baudrate. If needed, it's possible using the 0x012 service register of the Monarco HAT (see the Monarco HAT SPI Protocol Reference Manual for details).

For more details about Modbus driver in REXYGEN see MbDrv - Driver for Modbus Communication.

External RS-485 interface

The external RS-485 bus can be fully configured by Monarco Driver Configuration dialog in REXYGEN Studio.

1. Doubleclick MNR function block in your EXEC file:

2. Click "Configure" and set RS-485 bus parameters:
Default parameters are: 9600 Baud, no parity, 1 stop bit.

For more details about MonarcoDrv see MonarcoDrv - Driver for Monarco HAT.
For more details about Monarco HAT see Monarco HAT Knowledge Base.