Simplified C Block for Embedded Code Generation

Altair Forum User
Altair Forum User
Altair Employee
edited August 2023 in Community Q&A

Hi'
When I define a new function with input and output argument like as "float a_new_function (float x1, float x2){}" in Simplified C Block for Embedded Code Generation for TI DSP, simulation is ok. But generated code is not compiled in code composer studio v6. I think the problem is that the defined function is imported into Simplified C Block fuction labeled as "interrupt void Task() {}", so compiler returned an error.
Is there any way to define a global function in Simplified C Block ?
Thank you.

Tagged:

Answers

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited August 2023

    Hi,

    Please view this tutorial video, https://youtu.be/cN_NSfuUPno, it shows the routines are generated for use by the DSP. In summary every function needs to be setup with an interrupt rate which is defined with the ZOH, which defines how often it will be called. Without knowing exactly what the purpose of your function is I can't give additional advice.

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited August 2023

    Unfortunately the video didn't help me. Because I didn't use any block in my TI DSP based project. I used only DSP related modules and Simplified C block. my project is only C based that is implemented using Simplified C block, So I need separate subroutine ( sub function) in Simplified C block.
    Also I need a global variable declaration in Simplified C Block.

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited August 2023

    You will need to use your subroutines as separate functions and include them as a library. You will be able to set the path where the library is found under 'Options->Set Path'

    Global variables can be declared in the parameter file with the (global) tag. You will need to read the help for the parameter file section 6.7 of the user manual.