how to get mutliple data from serial port into simulink?

Hi everybody!
I'm trying to get serveral serial data from a µC into simulink, do some (real-time(?)) calculation there, and send back controll signals.
I played around with both serial_receive and query_instrument blocks (The later seems to work a bit smother regarding updating plots at regular intervals).
The problems start as soon as I try to get more than only on signal into Simulink, e.g. something like this (%4d %4d\r\n"):
I tried to add an ASCII-Decoder in both setups, but cannot find the right settings to get it work.
(1) gives produces error messages like
Input must be either 8 or 16 bit integers
An error occurred while propagating data type 'double' from 'running_Plot_edit/Query Instrument', output_port 1.
(2) Here values don't change in the plot, and if I terminate simulation or it reaches its end, Matlab crashes.
I tried several settings, likewise as it is suggested here https://de.mathworks.com/matlabcentral/answers/81343-ascii-decode-block-simulink
Do you think I didn't find the righte settings yet and that's it? Or would you create a serial port objekt in a Matlab file, do the conversion there, and import signals to Simulink afterwards?
Thanks for your help!

Respuestas (0)

Categorías

Más información sobre Instrument Control Toolbox en Centro de ayuda y File Exchange.

Productos

Preguntada:

el 1 de Mayo de 2017

Community Treasure Hunt

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

Start Hunting!

Translated by