Recent Changes - Search:

edit SideBar

PreliminaryCodeGeneration-EmbeddedCodeActor

This page documents the process of figuring out code generation with the Embedded Code Actor for the Mbed Code Generation project.

How to use the Embedded Code Actor

  1. Drag the EmbeddedCodeActor into the Ptolemy model.
  2. Configure the EmbeddedCodeActor to use the "generatorPackage" generic.program.procedural.c
  3. Add input and output ports to the actor, as desired. Their names will be used in the embedded code.
  4. Open the actor (right-click > open actor) and fill the preinitBlock such that the code is between the two commented lines. Fill the initBlock in the same manner.
  5. The fireBlock is where the main code will reside. Write your code in this section, and use the inputs and outputs from the actor as follows:
    • To read an input value, use $get(input), where input is the name of the input port, without quotes.
    • To set an output value, use $put(output, value), where output is the name of the output port, without quotes, and value is the desired output value.

Issues

  • There is an issue with the file structure and the way files are included. All of the #include directives in the generated files assume that all files are in the same directory level.
  • Other compilation issues that I'm currently looking into.
Edit - History - Print - Recent Changes - Search
Page last modified on February 24, 2015, at 05:17 pm