Simulink defines uint16 as uint32.
5 次查看(过去 30 天)
显示 更早的评论
Hi everybody!
I'm buidling a model to use with the c2000 f28379D launchpad. To optimise a couple of processis I wanted to use c-code. Things were going well but now i am getting errors that I frankly don't really understand:
I'm using uint16_T in my code but it seems that Simulink has redefined that to uint32_T, and then gets confused when the pin type is uint16 in Simulink. I don't know why it's doing this as the launchpad has 16 bit characters and I've configured that correctly (I think). What is going on here? I have the same issues with both my r2024a and r2023b installation. Thanks in advance!
Included are all the relevant files, a version for r2024a and one I created for r2021b which gives me the same error
0 个评论
回答(1 个)
surya venu
2024-7-10
编辑:surya venu
2024-7-10
Hi,
The error you're encountering suggests that there is a mismatch between the data types defined in your custom C code and the data types expected by Simulink. Specifically, it seems that Simulink is expecting "uint32_T" while your C code is using "uint16_T".
Check Data Type Definitions: Ensure that the data types are consistently defined across your C code and Simulink model. In your C code, you might have something like:
typedef unsigned short uint16_T;
typedef unsigned int uint32_T;
I see that in "rtwtypes.h" file you've shared, "uint16_T" is defined as "int". But ideally it should be "short".
Hope it helps.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!