| Real-Time Workshop User's Guide | ![]() |
Overview of Operation
The following pseudocode shows the execution of a Real-Time Workshop Embedded Coder main program.
main()
{
Initialization (including installation of rt_OneStep as an
interrupt service routine for a real-time clock).
Initialize and start timer hardware
Enable interupts
While(not Error) and (time < final time)
Background task.
EndWhile
Disable interrupts (Disable rt_OneStep from executing.)
Complete any background tasks.
Shutdown
}
The pseudocode is a design for a harness program to drive your model. The ert_main.c program, as shipped, only partially implements this design. You must modify it according to your specifications.
Guidelines for Modifying the Main Program
This section describes the minimal modifications you should make in your production version of ert_main.c to implement your harness program.
model_initialize:rt_OneStep as a timer ISR.Note
The real-time object is not in a valid state until model_initialize has been called. Servicing of timer interrupts should not begin until model_initialize has been called.
|
rt_OneStep call in the main loop with a background task call or null statement.You can use the macros ssGetErrorStatus, ssSetErrorStatus, and ssSetStopRequested to detect and signal errors, or to stop execution. These macros are documented in the Writing S-Functions manual.
| Overview | rt_OneStep | ![]() |