필터 지우기
필터 지우기

Error while connecting to realtime target

조회 수: 2 (최근 30일)
Miroslav
Miroslav 2013년 6월 4일
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
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.
Miroslav
Miroslav 2013년 6월 5일
Yes I can use external mode. I supose thet problem is with using windows.h in my s-function. Simulink can't use windows API function in external mode.

댓글을 달려면 로그인하십시오.

채택된 답변

Jan Houska
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
Miroslav
Miroslav 2013년 6월 5일
I know Stream and packet input block, but i need read data from input buffer asynchronous. I need execute some functions after every single byte is received. I supposed that s-function could help me. I could to use Stream input block placed in function call subsystem, which is call with hardware interrupt (byte receive). I have not any idea how hardware interrupt work in simulink external mode. Is it possible?

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Jan Houska
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.

카테고리

Help CenterFile Exchange에서 Target Computer Setup에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by