User`s guide
Interrupt Handling
11-15
Asynchronous Interrupt Block Example - RTW Mode
This example shows the Asynchronous Interrupt block in RTW mode:
Note that the simulated plant signals that were included in the previous
example have been omitted. In RTW mode, the Asynchronous Interrupt block
receives interrupts directly from the hardware.
During the Target Language Compiler (TLC) phase of code generation, the
Asynchronous Interrupt block installs the code in the Stateflow Chart and the
Subsystem block as interrupt service routines. Configuring a function-call
subsystem as an ISR requires two function calls,
int_connect and int_enable.
For example, the function
f(u) in the Function block requires this procedure:
• In the
mdlStart function, the Asynchronous Interrupt block inserts a call to
int_connect and sysIntEnable:
/* model start function */
MdlStart()
{
. . .
int_connect(f,192,1);
. . .
sysIntEnable(1);
. . .
}
* Plant is removed
Offset
192
Int Vector table
&f()
Stand-alone functions are
installed as ISR’s: