Simulink/Arduino: serial receive byte stream

조회 수: 7 (최근 30일)
Daniel Gelman
Daniel Gelman 2020년 8월 21일
답변: Amrtanshu Raj 2020년 8월 31일
Hello,
I am using Simulink to receive serial data via Arduino, which is receiving three bytes (unit8) of data from a 2nd microcontroller. The 3-byte packet includes a startChar and 2 bytes of data, illustrated below.
Occasionally, if I reset the transmitting microcontroller, I notice the receiving bytes get jumbled and the starChar (36) is positioned either in the 2nd or 3rd index of the byte array. As a result this will completely ruin the rest of my model. To fix this I need to keep resetting the tranmistting controller.
What can I do to prevent this from happening?
  댓글 수: 5
Amrtanshu Raj
Amrtanshu Raj 2020년 8월 26일
Is your transmitting microcontroller also a arduino? What is the method of resetting the transmitting microcontroller?
Daniel Gelman
Daniel Gelman 2020년 8월 26일
Amrtanshu, yes the transmitting microcontroller is an Arduino.

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

답변 (1개)

Amrtanshu Raj
Amrtanshu Raj 2020년 8월 31일
Hi,
As far as I understand your problem, you are randomly resetting the transmitting microcontroller which is causing the input data stream to be jumbled up.
A possible work around to this problem can be achieved by adding the subsystem in the attached file between the serial port and the display.
Hope this helps!

카테고리

Help CenterFile Exchange에서 Modeling에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by