03-17-2010 10:40 AM
Currently, I have developed a program using while loop and shift register to concaternate continuous input into a long string. I want to detect specific pattern from the long string. Previously, I used the "Match Pattern" to detect the code "$GPGGA", which appear continuously every second. However, the Match Pattern only search the first appeared "$GPGGA" along a string, but not the following ones, are there any ways to do that?
A sample is shown below:
$GPGGA,153651.228,0000.0000,N,00000.0000,E,0,00,,0.0,M,0.0,M,,0000*4E <= This $GPGGA is detected
$GPRMC,153651.228,V,0000.0000,N,00000.0000,E,,,170310,,,N*7F
$GPVTG,,T,,M,,N,,K,N*2C
$GPGGA,153652.228,0000.0000,N,00000.0000,E,0,00,,0.0,M,0.0,M,,0000*4D <= This $GPGGA is not detected
Can anyone help me? Thank you.
yukfai88
03-17-2010 10:45 AM - edited 03-17-2010 10:48 AM
1) Mathc pattern accepts an offset where to start the search. If you put it in a loop and use a shift register you can search again past where you last matched.
2) Faster searching of large string can be accomplished by first seraching for the first character and then checking what follows. See this Nugget for more on fast searching.
Ben
03-17-2010 12:15 PM
Hi, Ben.
I have tried already connecting the offset and offset past match to shift register (numeric), but the offset makes the displayed GPS time (generated by program) run at a fraction of time, i.e. the displayed time, takes ahead of the GPS data (generated by my GPS receiver) quickly and the displayed time is initialized again and again. Although I have placed a "wait until next ms multiple", but both data input and data displayed are delayed at the same rate, so the situation doesn't improve. Are there any ways to adjust only the displayed time to update only once a second, rather a fraction of a second, so that the displayed time updates as fast as data from receiver?
On the other hand, I think the way of cutting the string starting with "$GPGGA" after every read action is okay for my objective, can you show me the way?
Thank you very much for your help.
03-17-2010 12:18 PM
03-17-2010 03:57 PM - edited 03-17-2010 03:58 PM
Hi yukfai88,
why did you start another thread?
You can handle your problem if you don't add all the strings to your shiftregister buffer. If your process which searches the string for your substring is not fast enough, then you can use a prallel process which works on it. You can use a queue to send the data between the different loops.
Mike
03-25-2010 03:49 AM
Drop the $ sign from the search syntax as Lavbiew treats it as a wild card - this very same problem had me scratching my head for many an hour, with the $ symbol I couldn't get it to work, without it was fine!
Have a look at http://forums.ni.com/ni/board/message?board.id=170&thread.id=226877 one of my posts contains a word document detailing the vi I created for extracting NMEA data - Mike
03-25-2010 05:30 AM
See attached picture for some ideas, this is using a BT GPS receiver but all you need to do is strip out the Bluetooth front end and replace it with the Visa vi's for it to work - Mike