2
votes

I am using Simulink to communicate with a serial device. I am trying to use the Serial Send block to send a value to the device. If I try to use a 'traditional' source (such as the Constant block) to send data, I get the following error.

The block 'Serial Send' cannot be assigned a continuous sample time.

How can I send a non-continuous signal?

2

2 Answers

1
votes

You have to convert signal to discreate. First put your data to Quantizer than output from Quantizer connect "Zero-Order hold " now you send data to serial send

0
votes

Per a discussion on the MATLAB mailing list (source):

You can set a sample time on the Constant block. If you double click on it you will see the sample time is set to -1. You can also drag in a sample and hold block. You may want to turn on sample time colours to make debugging easier.


Update: Also, you may want to try using the To Instrument block instead of the Serial Send block. I've never used either, but the main difference I see is that the To Instrument block is designed for sending "simulation data", which might be more compatible with the Constant block. Maybe there's a reason that you can't use the To Instrument block, though.