Thread Subject: XPC Target and GPS

Subject: XPC Target and GPS

From: betoordie

Date: 23 Aug, 2008 17:44:01

Message: 1 of 4

Hi, i'm trying to aquire data from a Garmin GPS 5Hz
which sends continuous data like this:

$GPGGA,232839,3607.7315,N,09704.7600,W,0,00,,,M,,M,,*47
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$GPGGA,232839,3607.7315,N,09704.7600,W,0,00,,,M,,M,,*47
$GPGSA,A,1,,,,,,,,,,,,,,,*1E

i already tried to use the blocks baseboard serial and the
baseboard serial f with all the 3 fifo read blocks whithout
success. when i use the baseboard serial whith an ASCII
decode in its output, i get nothing in the scope target,

when i use the baseboard serial f, i get only the 10 first
bytes: $GPGGA,232.

the fifo read HDRS is set up like this:
HEADER: {'$'}
TERMINATING STRING: [13 10]
MAXIMUN READ SIZE: 1024
OUTPUT VECTOR: 8 bit int null
SAMPLE TIME: 1

The baseboard serial f block is at default parameters with
proper baud rate and with sizes in 1024 and output vector in
8 bit int too.

i've tried some changes in its parameters but i'm still
stuck in that limit of 10 bytes,

can someone help me!!


Subject: XPC Target and GPS

From: Gordon Weast

Date: 27 Aug, 2008 19:02:31

Message: 2 of 4

First, you want 2 different headers, '$GPGGA' and '$GPGSA' so
each of the strings goes to a different output. Then each of
the strings can be handled easier.

Next, a simple scanf, such as the ascii decode block isn't
going to handle the repeated commas well at all.

I have been meaning to write a general decoder for NMEA strings
like these, but it keeps getting pushed down on the priority list.

You can probably write an embedded M block to decode each of these
strings. You need to know the exact format ahead of time and
scan through for the commas and either convert to numeric there,
or pass the strings out where you can use an ascii decode on each
one. You know which fields should be numbers and which should be
N vs S or E vs W for instance.

If C is more to your liking, then you can write an S-function in
C to decode these quite easily. You could also put the string
type logic in such a C S-function and have both decode types.

The ascii header fifo read block can also ignore the $GPGSA
strings if you only list the $GPGGA header. Other strings,
if present, will be silently ignored and thrown away.

In short, the NMEA formats really require that you write your
own decode routines.

When you say you're only getting the first 10 bytes, how are
you determining that? If you feed that vector to a target
scope, it will only display the first 10 entries. That doesn't
mean that there isn't more in the vector.

Gordon Weast
xPC Target Development

betoordie wrote:
> Hi, i'm trying to aquire data from a Garmin GPS 5Hz
> which sends continuous data like this:
>
> $GPGGA,232839,3607.7315,N,09704.7600,W,0,00,,,M,,M,,*47
> $GPGSA,A,1,,,,,,,,,,,,,,,*1E
> $GPGGA,232839,3607.7315,N,09704.7600,W,0,00,,,M,,M,,*47
> $GPGSA,A,1,,,,,,,,,,,,,,,*1E
>
> i already tried to use the blocks baseboard serial and the
> baseboard serial f with all the 3 fifo read blocks whithout
> success. when i use the baseboard serial whith an ASCII
> decode in its output, i get nothing in the scope target,
>
> when i use the baseboard serial f, i get only the 10 first
> bytes: $GPGGA,232.
>
> the fifo read HDRS is set up like this:
> HEADER: {'$'}
> TERMINATING STRING: [13 10]
> MAXIMUN READ SIZE: 1024
> OUTPUT VECTOR: 8 bit int null
> SAMPLE TIME: 1
>
> The baseboard serial f block is at default parameters with
> proper baud rate and with sizes in 1024 and output vector in
> 8 bit int too.
>
> i've tried some changes in its parameters but i'm still
> stuck in that limit of 10 bytes,
>
> can someone help me!!
>
>

Subject: XPC Target and GPS

From: betoordie

Date: 29 Aug, 2008 02:03:02

Message: 3 of 4

Hi Gordon,

thank you very much for this tip, it will be very helpfull

well maybe i missed the part in the help that the scope
target has this limit of 10 entries, this is why i'm
thinking that i'm losing the others entries. However, i'm
logging data with a target scope file too, and the resulting
file gives only the 10 entries. this target file has this
limit too i think!

thank you again!

Beto

Gordon Weast <gweast@mathworks.com> wrote in message
<g948c7$oau$1@fred.mathworks.com>...
> First, you want 2 different headers, '$GPGGA' and '$GPGSA' so
> each of the strings goes to a different output. Then each of
> the strings can be handled easier.
>
> Next, a simple scanf, such as the ascii decode block isn't
> going to handle the repeated commas well at all.
>
> I have been meaning to write a general decoder for NMEA
strings
> like these, but it keeps getting pushed down on the
priority list.
>
> You can probably write an embedded M block to decode each
of these
> strings. You need to know the exact format ahead of time and
> scan through for the commas and either convert to numeric
there,
> or pass the strings out where you can use an ascii decode
on each
> one. You know which fields should be numbers and which
should be
> N vs S or E vs W for instance.
>
> If C is more to your liking, then you can write an
S-function in
> C to decode these quite easily. You could also put the string
> type logic in such a C S-function and have both decode types.
>
> The ascii header fifo read block can also ignore the $GPGSA
> strings if you only list the $GPGGA header. Other strings,
> if present, will be silently ignored and thrown away.
>
> In short, the NMEA formats really require that you write your
> own decode routines.
>
> When you say you're only getting the first 10 bytes, how are
> you determining that? If you feed that vector to a target
> scope, it will only display the first 10 entries. That
doesn't
> mean that there isn't more in the vector.
>
> Gordon Weast
> xPC Target Development

Subject: XPC Target and GPS

From: Gordon Weast

Date: 29 Aug, 2008 14:06:50

Message: 4 of 4

Yes, both the display and file scopes have that 10 signal
limit. In R2008b the file scope limit is changed to be
unlimited (limited only by memory size available). The
display scope is still limited to 10 since the display
just gets too messy with more signals. Even 10 can be
hard to read.

You can stick a demux block in the signal with it set
to [10,10,-1] and there will be 3 outputs. The first will
be a vector of 10, the second is a vector of 10 and the
third is whatever is left over. Feed each to a separate
display scope. The third one could be dumped to a terminator
if desired. If you have a vector with 1024 entries coming
from the fifo read and you only want to look at the first
30, set the demux to [10,10,10,-1] and dump the 4th output
to a terminator and the other 3 to scopes set to numeric.

Gordon Weast
xPC Target Development
The MathWorks

betoordie wrote:
> Hi Gordon,
>
> thank you very much for this tip, it will be very helpfull
>
> well maybe i missed the part in the help that the scope
> target has this limit of 10 entries, this is why i'm
> thinking that i'm losing the others entries. However, i'm
> logging data with a target scope file too, and the resulting
> file gives only the 10 entries. this target file has this
> limit too i think!
>
> thank you again!
>
> Beto
>
> Gordon Weast <gweast@mathworks.com> wrote in message
> <g948c7$oau$1@fred.mathworks.com>...
>> First, you want 2 different headers, '$GPGGA' and '$GPGSA' so
>> each of the strings goes to a different output. Then each of
>> the strings can be handled easier.
>>
>> Next, a simple scanf, such as the ascii decode block isn't
>> going to handle the repeated commas well at all.
>>
>> I have been meaning to write a general decoder for NMEA
> strings
>> like these, but it keeps getting pushed down on the
> priority list.
>> You can probably write an embedded M block to decode each
> of these
>> strings. You need to know the exact format ahead of time and
>> scan through for the commas and either convert to numeric
> there,
>> or pass the strings out where you can use an ascii decode
> on each
>> one. You know which fields should be numbers and which
> should be
>> N vs S or E vs W for instance.
>>
>> If C is more to your liking, then you can write an
> S-function in
>> C to decode these quite easily. You could also put the string
>> type logic in such a C S-function and have both decode types.
>>
>> The ascii header fifo read block can also ignore the $GPGSA
>> strings if you only list the $GPGGA header. Other strings,
>> if present, will be silently ignored and thrown away.
>>
>> In short, the NMEA formats really require that you write your
>> own decode routines.
>>
>> When you say you're only getting the first 10 bytes, how are
>> you determining that? If you feed that vector to a target
>> scope, it will only display the first 10 entries. That
> doesn't
>> mean that there isn't more in the vector.
>>
>> Gordon Weast
>> xPC Target Development
>

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
gps xpc serial rs232 baseboard fifo betoordie 23 Aug, 2008 13:45:04
rssFeed for this Thread

Public Submission Policy

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.

Contact us at files@mathworks.com