serial communication device without driver
5 次查看(过去 30 天)
显示 更早的评论
I want to send a signal or generate a signal for a serial control device connecting via RS232.
point to point link, Baud rate 38400, data bits 8, parity none, stop bits 1, CRC 16.
I want to generate or use matlab function or simulink to get a signal of fixed length of 6 bytes. The massage are transfered in 15ms cycle.
Example signal : AA ID AA 02 IC IE.
I want to generate or send a signal (AA ID AA 02 IC IE) keeping in mind all the parameters.
0 个评论
回答(1 个)
Walter Roberson
2022-3-2
That uses the Instrument Control Toolbox.
You could also use MATLAB Function Block, and code in calls to serialport() and related functions; https://www.mathworks.com/help/matlab/ref/serialport.html
6 个评论
Walter Roberson
2022-3-3
There is no particular block in Simulink to send fixed length signals. The serial send block will send whatever shows up on its input port. Most signals in Simulink are fixed-length signals.
In theory you could be feeding the output of a triggered system or an if/then block into the serial send block. It will not care: it will send whatever is in the input port when it gets triggered (it only makes sense to use such a block with a discrete section rather than a continuous section.)
Generally speaking if you were wanting to send a block of calculated results not all created at the same time, and it was important that they be transferred at regular times or with a regular header for the block, then you could use a buffer block.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Block Libraries 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!