Azzera filtri
Azzera filtri

Serial Receive only zeroes

2 visualizzazioni (ultimi 30 giorni)
Jan De Vries
Jan De Vries il 15 Ott 2011
In simulink, I use the serial receive block to receive data from my NMEA compass, which is sending me heading information through com1 in the following format:
$HCHDG,hhh.h.,,,,<CR><LF>
where hhh.h is the heading of the compass in degrees (eg 180.0 degrees means south).
When I open the port in Matlab and use the fscanf command, I receive strings in the format
$HCHDG,49.0,,,,
So thats working. My problem is I need the 49.0 in simulink as a number.
I tried using the serial receive block, but this only yields me zeroes, and sometimes a 44 (I guess it's the ascii code for the ',').
I use $HCHDG for heading and cr/lf as terminator, can anybody help to get the heading number?
  1 Commento
Walter Roberson
Walter Roberson il 15 Ott 2011
Replied in your duplicate question http://www.mathworks.com/matlabcentral/answers/18364-reading-numeric-value-from-com-port

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Block Libraries in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by