Serial Data signal Generation
8 次查看(过去 30 天)
显示 更早的评论
How to generate a signal of fixed length of 6 bytes. The massage are transfered in 15ms cycle. Baud rate 38400, data bits 8, parity none, stop bits 1, CRC 16.
Example signal : AA 20 AA 02 IC IE.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/919644/image.jpeg)
Serial Data Format
0 个评论
采纳的回答
Benjamin Thompson
2022-3-9
See if one of the examples on the File Exchange will work for you:
Then if you run into problems ask a specific question and post your work.
8 个评论
Benjamin Thompson
2022-3-15
I don't know what the "create and connect generator" does. Connect a constant source block to your Serial Send Block input. Give the constant block a value of 170 decimal, and configure its output data type to uint8.
As for the other parameters, it is your device. The header and terminator could be your STX and ETX characters. Blocking mode, you may have to try it with and without that checked to see what works best for timing.
Then when you are sure the serial port is sending out three bytes (STX + 170 + ETX), then make the middle part the full six bytes long using the mux block like I showed in my example.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Direct Interface Communication in Simulink 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!