Difference between revisions of "Creating a block in Simulink"
From OpenMBD
(Created page with "With all files in place, a new block can be created. *Open the Simulink Library Browser *Drag-and-drop a Level-2 MATLAB S-Function into the project File:level_2_matlab_s_fun...") |
|||
(14 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
*Open the Simulink Library Browser | *Open the Simulink Library Browser | ||
*Drag-and-drop a Level-2 MATLAB S-Function into the project | *Drag-and-drop a Level-2 MATLAB S-Function into the project | ||
− | [[File:level_2_matlab_s_function.PNG | + | [[File:level_2_matlab_s_function.PNG]] |
− | * Right-click the block | + | *Right-click the block |
+ | *Select Mask -> Create Mask... | ||
+ | *Carefully copy the settings depicted in the following images: | ||
+ | [[File:icon_and_ports.PNG]] | ||
+ | [[File:parameters_and_dialog_channel.PNG]] | ||
+ | *Type options:<br> | ||
+ | SPI1: D11<br> | ||
+ | SPI2: D34<br> | ||
+ | *Callback:<br> | ||
+ | sfcn_signal_tower_chk();<br> | ||
+ | <br> | ||
+ | [[File:parameters_and_dialog_tsamp.PNG]] | ||
+ | [[File:initialization.PNG]] | ||
+ | [[File:documentation.PNG]] | ||
+ | *Click OK | ||
+ | *Right-click the block | ||
*Select Block Parameters (M-S-Function) | *Select Block Parameters (M-S-Function) | ||
*Fill in the parameters as follows: | *Fill in the parameters as follows: | ||
− | [[File:level_2_matlab_s_function_parameters.png | + | [[File:level_2_matlab_s_function_parameters.png]] |
− | * | + | *Click OK |
+ | *Change the block to a convenient size | ||
+ | <br> | ||
+ | At this point, the block has been created successfully showing twelve input ports.<br> | ||
+ | [[File:new_block.PNG]]<br> | ||
+ | By double-clicking the block, the user settable parameters are shown:<br> | ||
+ | [[File:new_block_parameters.PNG]] | ||
+ | |||
+ | ---- | ||
+ | Part 2: [[Matlab/Simulink files]] - '''Previous''' | '''Next''' - Part 4: [[Updating the build environment]] |
Latest revision as of 19:44, 28 February 2019
With all files in place, a new block can be created.
- Open the Simulink Library Browser
- Drag-and-drop a Level-2 MATLAB S-Function into the project
- Right-click the block
- Select Mask -> Create Mask...
- Carefully copy the settings depicted in the following images:
- Type options:
SPI1: D11
SPI2: D34
- Callback:
- Click OK
- Right-click the block
- Select Block Parameters (M-S-Function)
- Fill in the parameters as follows:
- Click OK
- Change the block to a convenient size
At this point, the block has been created successfully showing twelve input ports.
By double-clicking the block, the user settable parameters are shown:
Part 2: Matlab/Simulink files - Previous | Next - Part 4: Updating the build environment