Hardware Access in Real-Time for scilab/scicos
For SCILAB 5.4.1!!!
scilab
xcos
- Open the sources palette
- Select the activation clock and add it to the xcos-diagramm
- Open the HART RTAI palette
- Select the sin generator and add it to the xcos-diagramm
- Select the scope and add it to the xcos-diagramm
- Connect the sine output with the scope input
- Connect the output of the clock with the sine and the scope activation input
- Draw a rectangle over the sine generator and the scope block
- Select region to superblock
- Rename the superblock to demo by selecting the block and go to Format and edit
- Enter "demo" into Text settings
- Change the Period of the activation clock to 1 msec
- Save the diagram as demo1.cos
- Select Simulation and then Compile
- Go to the scilab console
- Start Code geneartion by entering RTCodeGen()
- Select Ok in the dialog window.
- If everthing works properly, the output in the scilab main window should be like this one:
- Scilab / xcos can be closed
- Open a terminal and go to the directory with the generated code
- Be shure, that all rtai modules are loaded properly
- start the program: ./demo -o
- the -o options enforces the oneshot mode, which works better for same systems and slow sampling rates (<10kHz).
- Start QRtailab
- Click on Target/Connect
- Clock on View/Scope
- Enable the scope by clicking on Show/Hide
- Stop the program by clicking on Target/Stop
- Close Qrtailab
Gratulation! You have generated your first real time program.