| Real-Time Workshop User's Guide | ![]() |
Device Driver Requirements and Limitations
In order to create a device driver block, the following components are required:
Your S-function code and the hardware-specific driver code are compiled and linked into a component that is bound to an S-Function block in your Simulink model. The MATLAB mex utility builds this component (a DLL under Windows, or a shared library under UNIX).
We recommend that you use the S-function template provided by the Real-Time Workshop as a starting point for developing your driver S-functions. The template file is
matlabroot/simulink/src/sfuntmpl.c
An extensively commented version of the S-function template is also available. See matlabroot/simulink/src/sfuntmpl.doc.
The following components are optional:
Limitations of Device Driver Blocks
The following limitations apply to noninlined driver blocks:
The following applies to inlined driver blocks:
mdlRTW function, parameter restrictions are the same as for noninlined drivers.mdlRTW function, any parameter type is supported.Preemption
Consider preemption issues in the design of your drivers. In a typical real-time program, a timer interrupt invokes rtOneStep, which in turn calls MdlOutputs, which in turn calls your input (ADC) and /or output (DAC) drivers. In this situation, your drivers are interruptible.
| Inlined and Noninlined Drivers | Parameterizing Your Driver | ![]() |