Creating the SCICOS example files
This Chapter will guide you to the creation, compilation and execution of a first simple Scicos example on a FLEX board. The example created in this tutorial can be found in the directory scicos_examples/led_sin.
If you are looking for a prebuilt example, go directly to Section 4.2.
1. Please start Scicos 4.1.1 from the Start menu. The Scilab window appears.
2. Type “scicos();” and press Enter.
3. The Scicos windows appears.
4. Select Palettes from the Edit menu.
5. A little list appear in place of the menu. Select DSPIC-Lib, which is the last entry.
6. A windows appears, with all the blocks which are specific for the dsPIC and the FLEX board
7. Single click on the LED block. The window selection moves to the Scicos window. The mouse now becomes a white rectangle of the dimension of the LED block. Single click somewhere in the white part of the window. A LED block is dropped in the diagram.
8. Repeat the same with the Sine block, placing it on the left of the LED block.
9. Link the black triangle of the Sine block to the black triangle of the LED block. To do that, press l, then single click on the triangle of the Sine block (the source), then click again on the triangle of the LED block (the sink).
10. Now open the Events Palette, which can be found il the palette list
11. Now connect the clock signal to the two blocks. To do that, single click on the red triangle of the clock block, then single click below it, then single click over the Sine block, then click on the red triangle of the Sine block. After that, single click on the line below the clock block, then over the LED block, then on the red triangle of the LED block.
12. Single click on the Clock block. Its properties window appears. Leave them untouched, and press OK. You can do the same on the Sine block.
13. The code generator can produce code which only comes from a special block named Super Block. For this reason, we need to create a Super Block enclosing the Sine and the LED blocks. To do that, select the Region to Super Block menu item from the Diagram menu. Then, draw a selection which includes the Sine, the LED, and the red lines in a way that only one red line exits the selection.
14. As a result, a Super Block is created, which contains the Sine and LED blocks. To see these blocks, just single click on the Super Block, and another window will appear. Please note that this window is very similar to the previous one except that the clock object is substituted by a placeholder signed with the number 1.
15. It is now time to save the two diagrams. From the Diagram menu, choose Save as. First save the Super Block diagram as myblock.cos, then close the window, and then save the diagram containing the Super Block as led_sin.cos. Please save them in the same directory!
br>
br>
|