Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
3 replies Latest Post - ‏2012-07-20T10:07:13Z by GertW
M.Raouf
M.Raouf
2 Posts
ACCEPTED ANSWER

Pinned topic Using Statemate panel to send input to generated code on the Controller.

‏2012-07-11T15:08:21Z |
Hi All,

I need to use the Statemate panel to induce different inputs to generated code on the Controller. Any clue?

Thanks a lot.
Updated on 2012-07-20T10:07:13Z at 2012-07-20T10:07:13Z by GertW
  • GertW
    GertW
    29 Posts
    ACCEPTED ANSWER

    Re: Using Statemate panel to send input to generated code on the Controller.

    ‏2012-07-18T14:14:21Z  in response to M.Raouf
    all inputs from a STM panel are bound to variables in the STM model (data-item, condition, event).
    To read inputs from external files or other sources you can use C code subroutines and call there input functions like fscanf, fgets and so on.
    The input to variables in the code directly from the panel is no possible. It must be mapped through an internal variable in the STM model.
    • M.Raouf
      M.Raouf
      2 Posts
      ACCEPTED ANSWER

      Re: Using Statemate panel to send input to generated code on the Controller.

      ‏2012-07-18T19:01:21Z  in response to GertW
      First, Thanks a lot GetW for answering.

      Second, I understand that to induce inputs to the generated code from the model, then I can bind the external inputs in the model to subroutines to get the inputs from external files. But if I need to log the outputs from the generated code to an external file, how can this be achieved?

      Thanks a lot.
  • GertW
    GertW
    29 Posts
    ACCEPTED ANSWER

    Re: Using Statemate panel to send input to generated code on the Controller.

    ‏2012-07-20T10:07:13Z  in response to M.Raouf
    here again a short summary:
    • input/output from keyboard/mouse/screen to panel elements
    • panel elements are bound to internal STM variables
    • internal STM variables can passed as parameters to STM C code subroutines
    • C code subroutines can interact with external environment (input and output - printf/scanf, get/put, ...)

    exception is MicroC where you can directly call inline operations
    in a statechart at a transition for example: /inline('printf("I was here\r\n")')

    If you want to talk about a concrete sample then please contact IBM support.