Call External Device Drivers
Device drivers for protocols and target hardware are essential to many real-time development projects. For example, you can have a working device driver that you want to integrate with algorithmic code that has to read data from and write data to the I/O device that the driver supports. The code generator can produce a single set of application source files from an algorithm model and integrated driver code written in C or C++.
To call external device driver code from the Simulink® environment, iterate through the tasks in this table.
|Review your assessment of external code characteristics and integration requirements.
|Define the representation of model data for code generation.
|Generate S-function and TLC files by using the Legacy Code Tool. If necessary, refine the generated code manually to meet application requirements.
|Verify algorithm behavior and performance by simulating the model.
|Configure the model for code generation.
Generate Code That Matches Appearance of External Code (Embedded Coder)
|Generate code and a code generation report.
|Review the generated code interface.
|Build an executable program from the model.
|Verify that executable program behaves and performs as expected.