5.2 Working with I/O signals
5.2.1 Modifications in the project main file
Now we tell the compiler to use the Monarco HAT I/O driver. This is what needs to be done:
- Rename the MODULE block to MonarcoDrv – CASE SENSITIVE!
Further link the IODRV block with the MonarcoDrv module by setting
- – CASE SENSITIVE!
For Monarco HAT set the following:
- – CASE SENSITIVE!
- Leave the other parameters intact.
Remember to click the Configure button. This will create a default I/O driver configuration file (.rio). Leave the default values and close the dialog.
As the final step, rename the IODRV block to MNR, which will serve as a prefix for all I/O signals of this driver.
The executive of the REX Control System is configured, your project should look like this:
5.2.2 Modifications in the task
In the task double-click the input flag and set .Note the MNR prefix and two underscore characters. The first physical switch will be connected to DI1.
The second physical switch will be connected to DI2 (MNR__DI2) and DO1 will serve as the output signal (MNR__DO1).
Similarly for other pins we could use the following flags:
- Goto, MNR__DO4 – digital output 4
- From, MNR__DI3 – digital input 3
- From, MNR__AI1 – analog input 1
A detailed description of the I/O driver for Monarco HAT is available in a separate manual [5].
Your project should now look like this:
After compiling the project and downloading it to the Raspberry Pi the control algorithm interacts with the physical world. Again it is possible to switch to online mode and watch the signals in real-time or analyze the trends of signals. Flip the physical switches and watch the signals.
[Previous] [Back to top] [Up] [Next]