4.2 Compiling and running a project

The developed algorithm must be compiled to binary form prior to deploying. Pick Compiler/Compile from the menu or use the ./../MULTILANG/MANUALS/RexGettingStarted/images//ikonka_comp.png width="11.29218pt" height="11.29218pt" /.PIC icon from the toolbar. The compiler output is displayed in the Compiler window. If no error is found, the myproject_exec.rex file is created.

PIC

At this moment it is possible to deploy the control algorithm to the target platform. Use the Compile and Download icon ./../MULTILANG/MANUALS/RexGettingStarted/images//ikonka_compdl.png width="11.29218pt" height="11.29218pt" /.PIC for this purpose. A dialog for defining the target device appears upon successful compilation.

PIC

Enter the IP address of the Raspberry Pi in the Target field. The default user is admin and there is no password by default. Leave the other elements intact and click Download.

If there is no licence on your Raspberry Pi, you need to get one first. See chapter 6 for details and come back afterwards.

As soon as the download is complete it is possible to connect to the target device and watch the control algorithm in action – click Watch.

PIC

The RexDraw program now works in the so-called online mode. Right-click the TIMER_ block and select Monitor selection in the menu to watch the inputs and outputs of the timer.

PIC

PIC

You can do the same with the CNB blocks or any other selection.

Now it is possible to double-click the CNB_SWITCH1 block and change the Boolean variable to YCN = on (tick the checkbox and click OK). Once you do the same with the CNB_SWITCH2 block, the AND_ block output Y goes on and the TIMER_ starts to count down (observe the rt output). Once the timer reaches zero, its output Q is set to on and it remains on as long as the U input is on (both the switches are on).

You can double-click the TRND block to see the signals in a real-time graph. Red line is the first switch, magenta line is the second switch, green line is the remaining time of the timer and blue line is the output of the timer.

PIC

Try turning the CNB blocks off, change the pt parameter of the TIMER_ block, engage the switches again and observe the signals in the TRND block again. As you can see, you can modify any parameter in real-time, which allows you to fine tune your algorithm.

It is also possible to open a Diagnostics view of the algorithm. Click the ./../MULTILANG/MANUALS/RexGettingStarted/images//ikonka_diagnostics.png width="12.045pt" height="12.045pt" /.PIC and you will see the algorithm in a tree view which allows you to monitor the control algorithm in full detail. You can also adjust parameters of individual function blocks, which has the same effect as modifying them directly in the Block properties dialog.

PIC

PIC

Note: There is also a separate diagnostics program called RexView. Click the RexView icon ./../MULTILANG/MANUALS/RexGettingStarted/images//ikonka_rexview.png width="12.045pt" height="11.29218pt" /.PIC and confirm the IP address of the target platform.

Now you can disconnect RexDraw from the target device using the Disconnect icon ./../MULTILANG/MANUALS/RexGettingStarted/images//ikonka_disconnect.png width="11.29218pt" height="11.29218pt" /.PIC. The RexDraw program offers synchronization of the changed parameters with the source file of the project, choose No at this moment.

All changes made in online mode are not permanently stored in the target device (unless you decide so, see [3]). Upon restart of RexCore runtime module the algorithm will start with the parameters previously compiled and downloaded to the target device. To store the changes permanently, tick them when disconnecting and transfer the changes to the source files. Now Compile and download the project one more time and the changes become permanent.