pass Function block parameter as C define string
1 回表示 (過去 30 日間)
古いコメントを表示
Hello, Is there any way to add a function block parameter as C define string.
For example I have Digital IO write function block which calls a c function inside. It have one Inpput: this value will be written to the pin. And two parameter:the port name , the pin number The port name should be a C define macro like
#define gioPORTA ((gioPORT_t *)0xFFF7BC34U)
and I want to set the function block parameters to gioPORTA , 1 to set the digital io port (PORTA ,1) to 1.
Thank you in advance Best Regards, Mate
0 件のコメント
回答 (1 件)
BhaTTa
2025 年 4 月 17 日
編集済み: BhaTTa
2025 年 4 月 17 日
Hey @mate, you can create a header file which has C macros defined and that can be included in your Simulink model. Then to model your system and call appropriate C function you can use any of the below technoloigy:
C function block: https://www.mathworks.com/help/simulink/slref/cfunction.html
MATLAB System object: https://www.mathworks.com/help/matlab/create-system-objects.html
additional references:
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!