Generate Code for Serial Receive/Send blocks?

4 vues (au cours des 30 derniers jours)
Nina Buchanan
Nina Buchanan le 25 Juin 2017
Commenté : i yung le 19 Nov 2018
I have a small model that uses the Serial Configuration and Serial Receive blocks from the Instrument Control toolbox to receive uint8 data from another program, convert it to double, and save it to an array file. Another model reads this file and uses Serial Receive to send it to the other program. The Serial Receive block uses the S-function sserialrb.
When I try to compile this model into a windows executable, I get the error that sserialrb specifies "SetSimViewingDevice(true), which prevents an output port from being opened." How can I set this to false? set_param on the block does not work, and the parameters of the S-function cannot be edited. I do not need to see the simulation while the executable is running, just that the data is written to the file and sent back to the other program. Thanks for any help.
Additionally, the model that reads the file and sends it through the serial port will compile, but when I !send_SM.exe, it creates a send_SM.mat file which loads as an empty timeseries, and it does not send data to the other program.

Réponses (1)

Ankit Bhatnagar
Ankit Bhatnagar le 28 Juin 2017
Hi,
Certain serial receive/send blocks do not support executable and code generation. For more information please see this post:
You can also check the following file submission for your workflow:
  2 commentaires
Nina Buchanan
Nina Buchanan le 28 Juin 2017
Thanks, but these links refer to ethernet. I am trying to compile functions and blocks that use a serial port (COM7). I am still hoping to find something in Matlab or Simulink that will send data through a serial port, and that will compile.
i yung
i yung le 19 Nov 2018
Hi,
Have you got this working? I also get the same error in generating code of a serial block.
I Yung

Connectez-vous pour commenter.

Catégories

En savoir plus sur Messages dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by