Modules may be written to perform user defined activities in soft real time. For example, modules can be used to display data (aka. plotting package), animate machinery (aka. a three dimensional graphic image of a robotic arm), or simply to monitor the embedded tasks (aka. FFT calculations on the incoming data). To do so, the user needs to create his/her own independent application without needing to worry about the xrtic internals. A sample application is shown in Figure 5.1.
|
Line 1 includes the necessary header file. Line 6 initializes the connection to xrtic and line 14 terminates it. Everything else in between lines 6 and 13 is dependent on the user's application, and does not interfere with xrtic.
To compile this program, called mytest.c, one would compile it (assuming that rtic-lab has already been compiled) using the following:
1: gcc -Wall -O2 \ 2: -I\$(RTIC\-\_ROOT)/include \ 3: -L\$(RTIC\-\_ROOT)/non\-\_rt\-\_tasks/modules\ 4: mytest.c \ 5: -lmodules
where the shell variable RTIC_ROOT denotes the path to the rtic-lab source tree, for example /home/jonny/devel/rtic-lab. Here, line 1 calls up the GCC compiler with all warnings turned on and the highest level of optimization available. Line 2 tells the compiler where to look for the header files. Line 3 tells the compiler where to look for the ``modules'' library. Line 4 is our source file, and line 5 is the rtic-library that we need to link into our program.