Skip to content

C Code Integration in MATLAB and Simulink to Control an External Interface.

License

Notifications You must be signed in to change notification settings

mathworks/C_Code_Integration

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

C Code Integration in MATLAB and Simulink to Control an External Interface

This example is focusing on the integration of C code in MATLAB and Simulink.

Overview

Goal: Show C code integration and C code generation out of MATLAB and Simulink algorithms for a parking meter application

Technique 1: MATLAB implementation with or without Stateflow and also with or without the App Designer

Technique 2: Simulink implementation with or without System Composer

End result: In all cases, the goal is first to be able to simulate the entire system by integrating the low-level C interface drivers and then to generate C code out of the algorithm and create a standalone executable automatically

Data used: PNG images have been created to graphically design the parking meter application

MATLAB Project: ParkingMeter.prj

MATLAB App: ParkingMeterGUI.mlapp

Steps

Step 1: To setup the project in MATLAB, double click on "ParkingMeter.prj"

Step 2: In the "project shortcut" tab on top, click on the option of your choice to either simulate/generate or run the code. The contents of the "project shortcut" tab depends on the selected implementation

Step 3: Each local "Readme.txt" file provides the needed steps to do to properly run the application

Summary

A C# interface is used for the front-end of the parking meter and it can be controlled with MATLAB and Simulink through a Windows shared memory interface. For the vanilla MATLAB implementation a MATLAB App Designer interface can also be used

For more information

Requires

Copyright 2023 - 2024 The MathWorks, Inc.