Info

This question is closed. Reopen it to edit or answer.

Interacting with software drivers with generated code

1 view (last 30 days)
Hello,
I am using the simulink code generator and incorporating this code to a target.
Suppose that I have some functions on my target that allows me to turn on/off some LEDs, reading from an SD, etc. like:
led_on(6) -it turns on the led number 6
led_off(6) -it turns off the led number 6.
value = read_sd(30) -reads the parameter 30 on the sd card.
Now, what I want is to execute this function from the code generated directly. The ideal situation would be to write inside a MATLAB function in Simulink the piece of code I want to execute, but as expected, matlab does not understand the function led_on since it has not been declared previosly and of course, during the simulation I am not interested in running this function, only when running on a target.
Which could be the best possibily to achieve this? Of course I could set an output of the Simulink model and then setting on/off the led depending this output.
Thank you very much.

Answers (0)

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!