Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old August 25th, 2005, 04:38 PM
Jaykappy Jaykappy is offline
Contributing User
ASP Free Novice (500 - 999 posts)
 
Join Date: Feb 2005
Posts: 739 Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 5 Days 9 h 12 m 28 sec
Reputation Power: 22
Filter / Parse String.

I have been working on returning the NMEA String from a Trimble UNit. With help from many of you (especially NoFriends) I have reached a point where I can read the NMEA string, Bring it into Access, and display it in a text box or MsgBox. My next two steps and the last two are to filter this NMEA Message down to the String I am looking for. I am attempting to do this below and have been unsuccessful to date. I am trying to grab the $GPGGA string but am still returning all strings with different begining codes such as $GPGLL etc.....Second I then need to parse this string. I dont see this as being much of an issue. If I can get the return NMEA message broken down to one sprcific string and written to a variable I can handle parcing it out. Any help would be apprecaited.

Anyone have ideas how I can modify the below code to filter out all the other strings...and just grab the string starting with $GPGGA?

For some reason it does NOT go into the first "Case $GPGGA" Statement looking for the $GPGGA string. Obviosly because it does not recognize the $GPGGA string.....But I know its in the NMEA Message because I can see it in the TextBox. Although there are many strings...I think I need to filter it upon reading the CommPort. Does that make sense?

It the goes into the "Case Else" statements and it is here that I can push it to a text box or the MsbBox.....


Code:


Option Compare Database

Private Sub Form_Load()

If (Not MSComm6.PortOpen) Then

' Buffer to hold input string
Dim Instring As String
' Use COM1.
MSComm6.CommPort = 1
' 9600 baud, no parity, 8 data, and 1 stop bit.
MSComm6.Settings = "9600,N,8,1"
' Tell the control to read entire buffer when Input is used.
MSComm6.InputLen = 0
' Open the port.
MSComm6.PortOpen = True
' Send the attention command to the modem.
MSComm6.Output = "AT" & vbCr ' Ensure that the modem responds with "OK".
' Wait for data to come back to the serial port.
Buffer$ = Buffer$ & MSComm6.Input


MsgBox "SMS Port Open", vbOKOnly, "Port State"
Else
MsgBox "SMS Port Already Open", vbOKOnly, "Port State"
End If

Call MSComm6_OnComm

End Sub


'_______________________________________________

Public Sub MSComm6_OnComm()

'Attempting to Return a value from the port

Select Case MSComm6.CommEvent
Case "$GPGGA"
MsgBox "ENTERING CASE STATEMENT"

Dim NMEAString As String
NMEAString = MSComm6.Input
If InStr(NMEAString, "$GPGGA") > 0 Then
MsgBox NMEAString
End If

Case Else

Dim NMEAString1 As String
Forms!GPS_RETRIEVE!TEXTBOX.SetFocus

'MSComm6.InBufferCount = 0

NMEAString1 = MSComm6.Input
If InStr(NMEAString1, "$GPGGA") > 0 Then
' Converting the return so I can read it
TEXTBOX.Text = NMEAString1
Else
MsgBox "NO DEAL"
End If
End Select

End Sub

Reply With Quote
  #2  
Old August 26th, 2005, 12:24 AM
Doug G Doug G is offline
Grumpier Old Moderator
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Sep 2003
Posts: 10,143 Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 3 Weeks 4 Days 23 h 19 m 36 sec
Reputation Power: 181
Can't you step through your code with the VB Debugger and determine what's wrong?
__________________
======
Doug G
======
I didn't attend the funeral, but I sent a nice letter saying I approved of it. --Mark Twain

Reply With Quote
  #3  
Old August 26th, 2005, 09:08 AM
Jaykappy Jaykappy is offline
Contributing User
ASP Free Novice (500 - 999 posts)
 
Join Date: Feb 2005
Posts: 739 Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 5 Days 9 h 12 m 28 sec
Reputation Power: 22
The code below or above is working.....it goes into the second case statement and returns all the NMEA strings. I am unsure how the string actually comes in and how to grab just a portion of it. I push the output from the GPS Unit, which is sitting at the Comm Port into a text box. THere are a bunch of Strings sitting there. Thats why I have the first Case statement set up to look for strings $GPGGA. For some reason that is not working, and as such it goes into the second case stamtment and returns all of them.

I am using Access and the debugger within....I dont know how the debugger will help me filter the string. I am asking for a little help how to start to filter the string.

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > Filter / Parse String.


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT