Error while connecting to realtime target
2 ビュー (過去 30 日間)
古いコメントを表示
Hi, I made level 2 s-function in C language, which sends some data via serial port. I compiled it with Microsoft Visual C++ 2008 SP1 compiler. When I add this s-function to simulink model and start the simulation in normal mode, everything is ok, but, when I want to connect with realtime target (after building with rtwin.tlc), I get this error message:
Error occurred while executing External Mode MEX-file 'rtwinext': Error loading real-time executable: undefined symbol "_InterlockedExchangeAdd"
I have not any idea, what this error means. Could anybody help me? Thanks.
2 件のコメント
Kaustubha Govind
2013 年 6 月 4 日
Do you think the failure is specific to your S-function, or do you see it even without your S-function. For example, you could try the example model 'rtvdp' and see if you can execute that in external mode successfully.
採用された回答
Jan Houska
2013 年 6 月 5 日
For serial port communication, please use Packet Output or Stream Output blocks, depending on your data format. You are correct that you cannot use Windows API in real-time code.
その他の回答 (1 件)
Jan Houska
2013 年 6 月 6 日
If you want to react to individual received bytes, it is probably best to sample (poll) the input fast enough. I'd recommend the Packet Input block with a sample rate of, say, 0.5ms, and using its Data Ready output to trigger any necessary action.
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!