| Real-Time Workshop® | ![]() |
The following example uses a System Start Function block to introduce code into the MdlStart function. The next figure shows a simple model with the System Start Function block inserted.

Double-clicking the System Start Function block opens the System Start Function Custom Code dialog box.

You can insert custom code into any or all of the available text fields.
The code below is the MdlStart function for this example (mymodel).
void MdlStart(void)
{
{
{
/* user code (Start function Header) */
/* System '<Root>' */
unsigned int *ptr = 0xFFEE;
/* user code (Start function Body) */
/* System '<Root>' */
/* Initialize hardware */
*ptr = 0;
}
}
MdlInitialize();
}
The custom code entered in the System Start Function Custom Code dialog box is embedded directly in the generated code. Each block of custom code is tagged with a comment such as
/* user code (Start function Header) */
![]() | Custom Code Library | Custom Code in Subsystems | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |