What is the proper way to use Stream Input and Stream Output blocks simultaneously?
조회 수: 4 (최근 30일)
이전 댓글 표시
I'm attempting to run a hardware-in-the-loop simulation using Simulink Real-Time Desktop in Kernel mode. I am using a Stream Input block to read data over a serial comm port from a microcontroller, executing a control law, then sending a command over serial using the Stream Output block.
The problem I'm running into is that the Stream Input block seems to always occupy the comm port, meaning that I'm unable to send data back to the microcontroller. I've tried using atomic subsystems, and modifying the task priority / execution order but it hasn't helped.
Is there a good way to ensure that the Stream Input and Stream Output blocks behave well together?
Thanks.
댓글 수: 0
답변 (1개)
Jan Houska
2023년 5월 2일
Hi Zach,
to use both Stream Input and Stream Output blocks with one serial port, you configure the serial port in one of the blocks - you set the desired baud rate, parity, etc. This will cause the port to be added to the "Installed boards" list. Then, in the other block, you just select the port from this list and the block will share the port, using the same settings.
I'm not sure what you mean by "always occupy the comm port". If you mean that you are unable to configure the block again, perhaps with different settings, that's expected. You cannot have two blocks using the same hardware, each with different settings. To ensure the settings match, you need to share the hardware as described above. If you mean something else, please explain.
Good Luck, Jan
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Target Computer Setup에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!