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.
|1||Review your assessment of external code characteristics and integration requirements.|
|2||Define the representation of model data for code generation.|
Exchange Data Between External C/C++ Code and Simulink Model or Generated Code
|3||Generate S-function and TLC files by using the Legacy Code Tool. If necessary, refine the generated code manually to meet application requirements.|
|4||Verify algorithm behavior and performance by simulating the model.|
|5||Configure the model for code generation.|
|6||Generate code and a code generation report.|
|7||Review the generated code interface and static code metrics.|
Analyze Generated Data Code Interface and Static Code Metrics
|8||Build an executable program from the model.|
|9||Verify that executable program behaves and performs as expected.|