Blockset described on this wiki is deprecated since 2012.

For Model Based Design (MBD), use the free MPLAB Device Blocks for Simulink, tool from Microchip.
Updated Rapid Control Prototyping (RCP) custom projects are published at: https://lubin.kerhuel.eu.

Difference between revisions of "DsPIC Block/C Function Call"

From http://www.kerhuel.eu/wiki - Simulink device driver Blockset for dsPIC / PIC24 / PIC32 Microcontrollers --[[User:LubinKerhuel|LubinKerhuel]] 12:40, 3 September 2009 (UTC)
Jump to navigation Jump to search
(New page: 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 func...)
 
m (LubinKerhuel moved page Block/C Function Call to DsPIC Block/C Function Call: Block is a special page, creates many issues)
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
[[Image:Block_C_Function_Call.png|thumb|rght|Block C Function Call]]
 
Call user defined C function
 
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 "Simulation Parameters -> Real time workshop -> additional C file"
+
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=
 
=Dialog Box Parameters=
 
+
[[Image:Block_CFunctionCall_DialogBox.png|thumb|right|450px|C Function Call Dialog]]
 
==Function Name==
 
==Function Name==
 
Enter your C function name between single quotes 'zzz'. Do not provide the prototype.
 
Enter your C function name between single quotes 'zzz'. Do not provide the prototype.
Line 30: Line 31:
 
*'''%y''' represent blocks output
 
*'''%y''' represent blocks output
 
*'''%u''' represent blocks input
 
*'''%u''' represent blocks input
 +
 +
----
 +
<comments \>

Latest revision as of 19:30, 3 May 2015

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 \>