How can I plot data from serial virtual interface (COMx) in real time, if the dataformat is in ASCII?

I send data continuously in ASCII-format over a serial interface. I will plot this in realtime. In SIMULINK-Libray there are Instrument control toolbox with a blockset "serial receive". I have configure the serial interface, but the data format is binary. I have scope this. These values are not the values from the Terminal Monitor (Window), that I scope in my Atmel Studio 7.
Another question is: Can I manage two serial ports, who send data in ASCII-Format, in real-time, with two plots? Thank you for your help in advance!

Answers (1)

Simulink does not appear to have an equivalent to fscanf as would be required to handle text data and convert to numeric.
In the serial receive block, there is no option for text because Simulink does not support character signals.
You will need to receive as uint8 and pass the results to a MATLAB Function Block, where you would char() the uint8 into characters and sscanf() that to get the numeric data.

Categories

Find more on MATLAB in Help Center and File Exchange

Asked:

on 16 Dec 2017

Answered:

on 16 Dec 2017

Community Treasure Hunt

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

Start Hunting!