How can I use serial receive with quanser/quarc?

4 次查看(过去 30 天)
Hello,
I am using a Q2 USB card and the quarc_win64.tlc target to generate a control signal via the DAC. In parallel, I would like to receive a sensor via the "Serial Receive" block form the "Instrument Control Toolbox". When I try to run the model, the following error appears:
Level-2 MATLAB S-function 'sserialrb' in 'Pruefstand_v2/Serial Receive' specifies 'SetSimViewingDevice(true)' , which prevents an output port from being created for the S-function.
Component:Simulink | Category:Block error
Can anyone tell me if I can use the Serial Receive block in conjunction with quanser/quarc and if so what I need to change?

回答(1 个)

Githin George
Githin George 2024-2-8
Hello Lukas,
Unfortunately, the serial send/receive blocks from the Instrument control toolbox are not supported for code generation in MATLAB R2020b. With respect to the error message that you are facing, the "SetSimViewingDevice" parameter is set to true for S-function blocks, which are not intended for code generation. A workaround for this limitation would be to write a custom block for this functionality using your own S-function.
The following MATLAB answers post discusses the same.
Also, the following documentation links may help in better understanding the issue.
Note that in documentation of “Serial Receive” block there is no mentioned support for code generation. But in MATLAB R2023b, it is mentioned that the “Serial Receive” block does support code generation. Therefore, you might consider upgrading your version to a newer release where code generation is supported.
I hope this helps.

产品


版本

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by