What is SetSimViewingDevice and how can I set it to false in the hope of compiling the serial receive block in Simulink?
Best Answer
Unfortunately, the serial send/receive blocks from the Instrument control toolbox are not supported for code generation. Therefore, even if you could set the "SetSimViewingDevice" parameter to "false", it would not allow code generation. Instead, you would get a different error.
To answer your initial question about "what is setsimviewingdevice": This is a parameter that is used to prevent S-functions from having code generated for them. If you were to write your own S-function, but you wanted this block to be "skipped" in code generation, you would set the value of "SetSimViewingDevice" to "true". The most likely reason you encountered this parameter with respect to the Serial Receive block is because this block is coded as an S-function under the hood, and we set this parameter to be "true" so the compiler does not try to generate code for this (because it would fail otherwise).
So to summarize, changing the value of this parameter would unfortunately still not allow the block to be compiled. The main workaround for this limitation would be to write a custom block for this functionality using your own S-function.
Do you mean the TCP/IP blocks from the Instrument Control Toolbox? I'm not even sure that those are supported for code-generation (they might be no-ops). Have you examined the generated code to see if the blocks are represented in the code? From, what I know, you can only use these Host communications blocks for generated code:http://www.mathworks.com/help/toolbox/rtw/ref/bqnb76d-1.html#bsz4qhq-1
Best Answer