Matlab-Simulink device driver Blockset for Microchip dsPIC / PIC24 / PIC32 Microcontrollers.

DsPIC Block/C Function Call

From - Simulink device driver Blockset for dsPIC / PIC24 / PIC32 Microcontrollers --[[User:LubinKerhuel|LubinKerhuel]] 12:40, 3 September 2009 (UTC)
< DsPIC Block
Revision as of 19:30, 3 May 2015 by LubinKerhuel (Talk | contribs) (LubinKerhuel moved page Block/C Function Call to DsPIC Block/C Function Call: Block is a special page, creates many issues)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Block C Function Call

Call user defined C function

The C Function Call block allows to include your custom C written functions (that could contain assembly language) into the schematic. It Interfaces your functions with the MathWorks Simulink diagram. The .c file containing the code of the function should be placed in the same directory as the .mdl file. If the c file is in another directory, it must be manually added in the "Configuration Parameters > Code Generation > Custom Code > include list of additional: Source files ; Include directories ; Libraries..."

Dialog Box Parameters

C Function Call Dialog

Function Name

Enter your C function name between single quotes 'zzz'. Do not provide the prototype.

Global input size

Specify if the variables of the inputs are scalar (1) or vector ( >1 : array with one dimension). All different input data have the same size. they must all be either scalars nor vectors of equal dimension.

Input 1 2 3

Set the input type for the first three input. Set unused input as -- (all to -- if no input)

Output Size

Size of the output variable. It can be either a scalar (1) ; neither a vector ( >1 : array with one dimension)

Output type

data type of the output data.

Sample time

-1 means inherited

Function declaration

This is the declaration of your function in the generated Matlab/Simulink C files. Your C function declaration must be compatible with this prorotype.

Function call

This is the call of your function in the Matlab/Simulink C files. Your function must comply with this call.

  • %y represent blocks output
  • %u represent blocks input

<comments \>