I am trying to send a constant number (say 200) through serial port using Simulink, but rather than sending a sequence of 200s it transmits 105, 64,0 on repeat. why?

조회 수: 2 (최근 30일)
I am using simulink to transmit an image over the serial port. I noticed errors and decided to check by transmitting a repeating sequence of an 8 bit constant. when i am transmitting 200 the display at the recieving end shows the recieved pattern 105,64,0, repeating. I have checked configurations. they match on both ends. also tried to see the serial port waveform on oscilloscope. it also sends 105,64,0. i have no idea why this is happening as the model is quite simple. a constant block generating the number 200, a serial send block and a serial config block.

답변 (1개)

Suman
Suman 2024년 7월 26일
Hi faisal,
You may try these troubleshooting steps to figure out the problem:
1) Ensure that the data type and encoding are correctly set in both the Simulink model and the receiving end.
2) Check the serial port settings such as baud rate, parity, stop bits, and flow control on both the sending and receiving ends. They should match exactly.
3) You can also try using a MATLAB script to test the serial communication independently of Simulink. Here is an example code:
serialObj = serial('COM3', 'BaudRate', 9600);
fopen(serialObj);
fwrite(serialObj, uint8(200));
fclose(serialObj);
delete(serialObj);
clear serialObj;

카테고리

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

제품


릴리스

R2015a

Community Treasure Hunt

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

Start Hunting!

Translated by