Partially missing values while reading serial input from a microcontroller (Simulink Instrument Control Toolbox)

I am trying to read serial data from an Atmel SAM E70 Xplained -board using Instrument Control Toolbox and display the data in Simulink. However there are values missing when printed in Simulink scope.
Below is the code snippet from the microcontroller (programmed using Atmel studio).
code.PNG
The numerical values of these ASCII letters are 49 57 13 10, which are expected to be received from the Serial Receive -block.
Below is the Simulink model configured to display all of the received characters:
simulink_model.PNG
Output of the model:
simulink_receives.png
As you can see, some of the values are overlapping / appear to be missing. How can I fix this?
There is no problem while using Ardino terminal (below) or PuTTy, so I doubt there is anything wrong with the sender.
arduino_works.png
I have tried changing the block sample time and data size of the input with no success.

댓글 수: 1

I am not marking this as solved yet, as there are still unclear aspects (see my comment on Jonas' answer).

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

답변 (1개)

Your Simulink model is reading at 10kHz, while your Atmel controller is only sending each one second. This means that you are reading multiple times when the data has not changed (overlap).

댓글 수: 1

Thank you for the response. I increased the sampling time and the values look better, although I still don't understand how the values can be read several times in serial communication. From the Serial Receive documentation: "In a nonblocking mode, the Status port indicates if the block has received new data." It seems that the status port triggers every time a value is read? (Pictured blue in the scope image).

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

카테고리

도움말 센터File Exchange에서 Instrument Control Toolbox에 대해 자세히 알아보기

제품

릴리스

R2018a

질문:

2019년 6월 18일

댓글:

2019년 6월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by