How to add a new Scicos block to ERIKA Enterprise

From ErikaWiki

Revision as of 16:31, 2 April 2009 by Paolo.gai (Talk | contribs)
Jump to: navigation, search

These are a few notes useful if you want to create a new block in Scicos and the corresponding implementation function in ERIKA Enterprise.

This information derives from a post in the ERIKA Forum, and applies an old version of the Scilab toolbox (still to be tested on the latest one!)

  1. Preface
    1. Directory names are the directory names of my laptop...
    2. Use the zip file attached. for each step, there are a few files to look at
    3. I had to edit the post to substitute backslash with slashes
  2. Install Scilab 4.1.2
  3. Install the Scicos Pack for the FLEX boards
  4. Install Microsoft Visual Studio Express 2008
  5. [www.evidence.eu.com/download/scicos/MSVC2008_Patch.zip Install these patches] in Scilab 4.1.2. They are needed to let Scilab discover the Visual studio compiler
  6. NMake
    1. install NMake from http://support.microsoft.com/default.aspx?scid=kb;en-us;Q132084
    2. rename the executable file in nmake.exe and copy it into C:/Windows
  7. Update the files
    1. You need to create the block file. You can use Roberto's block editor http://web.dti.supsi.ch/~bucher/ . Or check out the block example at http://www.evidence.eu.com/component/option,com_fireboard/Itemid,262/func,view/id,6/catid,3/
    2. add into the C:/Programmi/scilab-4.1.2/contrib/dspic/macros/name one line with the file name
    3. in C:/Programmi/scilab-4.1.2/contrib/dspic/bulder.sce , we have to comment a few lines, because we are not going to compile the .c files distributed with the package. in particular, comment from the line "cd(ROUTINES)" to the one but last line (leave only the "cd('..')"
  8. Compile
    1. open scilab 4.1.1
    2. from the scilab console, "cd c:/Programmi/scilab-4.1.2/contrib/dspic"
    3. from the scilab console, "exec builder.sce"
  9. you get the following output
    --------------------------------------------------------------------
    ___________________________________________
    scilab-4.1.1
    Copyright (c) 1989-2007
    Consortium Scilab (INRIA, ENPC)
    ___________________________________________
    Startup execution:
    loading initial environment
    shared archive loaded
    _link_ done
    Scicos-FLEX Ready
    -->cd c:/Programmi/scilab-4.1.1/contrib/dspic
    ans =
    c:/Programmi/scilab-4.1.1/contrib/dspic
    -->exec builder.sce
    -->mode(-1);
    -->
    --------------------------------------------------------------------
  10. Add the block to the scicos Palette
    1. "cd macros"
    2. open scicos by typing "scicos();"
    3. Menu "Diagram/Load", load the file "dspic.cosf"
    4. Menu "Edit/Add New block", specify the file name "dspic_getfreq", press ok and place the block inside the palette where you want
    5. menu "Diagram/Save As", and give the name "dspic.cosf" - with the final "f"!!!
    6. close Scicos and Scilab
    7. now if you open again scicos, the dspic palette should have the dspic_getfreq block.
  11. Configuring Erika Enterprise
    1. copy the getfreq.c file inside "C:/Programmi/Evidence/ee/contrib/scicos/src/pic30"
    2. add getfreq.c inside "C:/Programmi/Evidence/ee/contrib/scicos/cfg/cfg.mk" (see file attached for an example)
  12. Create a scicos example
    1. Follow the Scicos tutorial, but use the getfreq instead of the Sine (see files in the zip)
    2. compile and enjoy!
Personal tools