2X STRINGS in Oshonsoft.

Thread Starter

camerart

Joined Feb 25, 2013
3,830
Hi,

I'm testing a program which receives a GPS NMEA sentence from a GPS module. I have added a second input which is switched alternatively into the RX of an 18F4620 PIC.

I'm getting odd results, that appear to be timing, and it's been pointed out to me that I need to use 2x STRINGS instead of both inputs using the single STRING 'STR1'

Am I correct that I need to make a second STRIBG 'STR2'?

If so does anything else need duplicating for it to work?

Camerart.
 

Attachments

ericgibbs

Joined Jan 29, 2010
21,439
hi C,
If Both strings start with $ and end with LF then the GETDATA routine needs a second ID letter for its string.

eg "$" detected set str1(0) and Str1(0) =char

if Hserin char ="A" then ; example second letter ID
'loop and get each character into str1(x)
until LF.
'process str1(data) as required
endif

if Hserin char ="B" then ; example second letter ID
'loop and get each character into str2(x)
until LF.
'process str2(data) as required
endif

This is a rough guide.

Don't forget to clear the str1 or str2 at end of process.

E
 

Thread Starter

camerart

Joined Feb 25, 2013
3,830
hi C,
If Both strings start with $ and end with LF then the GETDATA routine needs a second ID letter for its string.

eg "$" detected set str1(0) and Str1(0) =char

if Hserin char ="A" then ; example second letter ID
'loop and get each character into str1(x)
until LF.
'process str1(data) as required
endif

if Hserin char ="B" then ; example second letter ID
'loop and get each character into str2(x)
until LF.
'process str2(data) as required
endif

This is a rough guide.

Don't forget to clear the str1 or str2 at end of process.

E
Hi E,
To clarify: Is this a typo? [eg "$" detected set str1(0) and Str1(0) =char]? or should it read [eg "$" detected set str1(0) and Str2(0) =char]?

Otherwise I think I've understood it, thanks.
C.

Typo!.E
 
Last edited by a moderator:

Thread Starter

camerart

Joined Feb 25, 2013
3,830
Hi E,
Nearly working!

Here's the section of program and a terminal view from the HSEROUTs.

I'm transmitting test sentences inputs for $REMOTE and $GPRMC from a terminal/radio.
.
In the image you can see RESULTG, I can only see this if I switch OFF/ON the terminal output. Same for RESULTR.

C.
 

Attachments

Top