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