0121-11 Monarco HAT Modbus RTU Loopback USB
Example Projects > 0121 Monarco HAT > 0121-11 Monarco HAT Modbus RTU Loopback USB
Modbus RTU data loopback, Monarco HAT and USB RS-485 adapter
This folder contains the source files for the loopback test of RS-485 communication on Raspberry Pi with Monarco HAT and a USB RS-485 dongle. Data is exchanged over the Modbus RTU protocol.
Both the master and slave stations are implemented on the Raspberry Pi itself, the project is meant only for testing and debugging purposes.
Prerequisites
- REXYGEN Runtime Core, MonarcoDrv and MbDrv modules must be installed and running on the Raspberry Pi to run the example.
Running the examples
- The *exec.mdl file is the project main file.
- Open it with REXYGEN Studio, compile and download it to the target device.
- Switch to Watch mode and observe the algorithm.
Modbus registers##
Data out (from the master's point of view)
Register No. | Meaning | Data range |
---|---|---|
2048 | Unsigned integer | 0 .. 65535 |
2049 | Signed integer | -32768 .. 32767 |
2050 | Unsigned integer | 0 .. 65535 |
2051 | Signed integer | -32768 .. 32767 |
2052-2053 | Floating-point number | -3.4E+38 .. 3.4E+38 |
2054-2057 | Double precision floating-point number | -1.7E+308 .. 1.7E+308 |
Adding signals and changing Modbus register mapping
Go to Modbus driver configuration (MBM block for the master, MBS block for the slave) and press "Configure" for Modbus registers configuration. Make sure to read the Modbus driver documentation (see below).
Documentation
- Press F1 for help on the selected function block in the REXYGEN Studio.
- Getting started with REXYGEN and Monarco HAT
- MbDrv - Modbus driver
- MonarcoDrv - Monarco HAT driver
- REXYGEN HMI User Guide
- Function blocks of REXYGEN
- REXYGEN Studio User Guide
- Complete documentation of REXYGEN
Additional information
- Visit the REXYGEN webpage for more information about the example projects and developing advanced automation and control solutions using REXYGEN.