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?
3 views (last 30 days)
Show older comments
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.
0 Comments
Answers (1)
Suman
on 26 Jul 2024
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;
0 Comments
See Also
Categories
Find more on Direct Interface Communication in Simulink in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!