Hi Bob,
 
Thanks for your prompt response.
 
The GPS unit in the PDA I am using uses 9600 baud. I have reasonable 
communication between my program and the GPS device using following code to 
turn on GPS Comm Port
 
' Turn on GPS input of Latitude and Longitude via NMEA0183 sentence
' through Comm Port 1.
' Set To True if using GPS or False to use PC internal clock to match
' separate GPS log of survey.
' If using PC internal clock, time and date must be set to UTC.
GPSOn = "True"
If GPSOn = "True" Then
AddObject "Comm","GPS",0,0,0,0
' Settings for Com port 1, open Com port 1 for input.
GPS.CommPort = 1
GPS.Settings = "9600, N, 8, 1"
GPS.InputLen = 0
GPS.PortOpen = 1
End If
 
and the following code to capture the GPS NMEA sentence that I am interested 
in, the $GPGGA sentence' Sub GPS - subroutine GPSpos to get latitude and 
longitude
' from GPS.
Sub GPSpos
If GPSOn = "True" Then
NMEAheader = ""
NMEAstring = ""
While NMEAheader <> "$GPGGA"
NMEAheader = ""
NMEAstring = ""
NMEAstring = NMEAstring + GPS.Input
NMEAheader = Left(NMEAstring, 6)
If NMEAheader = "$GPGGA" Then
If Len(NMEAstring) < 44 Then
NMEAheader = ""
Else
If Mid(NMEAstring, 44, 1) <> "1" Then
NMEAheader = ""
End If
End If
End If
WEnd
GPSlat = CSng(Mid(NMEAstring, 19, 2)) + CSng(Mid(NMEAstring, 21, 7)) / 60
GPSlong = CSng(Mid(NMEAstring, 31, 3)) + CSng(Mid(NMEAstring, 34, 7)) / 60
HemNS = Mid(NMEAstring, 29, 1)
HemEW = Mid(NMEAstring, 42, 1)
If HemNS = "S" Then
GPSlat = GPSlat * -1
End If
If HemEW = "W" Then
GPSlong = GPSlong * -1
End If
ElseIf GPSOn = "False" Then
' Set latitude and longitude of sighting to 0 when not using GPS.
GPSlat = 0
GPSlong = 0
End If
End Sub
 
My main problem is that occasionally there can be a considerable delay (up to 5 
secs in worst case) between my initiating data entry and the capture of the lat 
long. On the crocodile surveys this can take a sighting from one side of the 
river to the other or in the case of aerial surveys which I also have written 
data logging programs for up to 300 m from the actual position. I have looked 
at a lot of GPS type comms code that is out there in the freeware/GNU licence 
area and most seems similar to what I have written. I just cannot help feeling 
that there has to be a tighter set of code to do this job. At 9600 baud I 
should be getting up to 2 $GPGGA sentences per second.
 
I am keen to tighten this code up but need direction to some good serial comms 
references that aren't to technical (written for graduate programmers).
 
Ta
Keith
 
W Keith Saalfeld
WKS Wildlife Management Consulting
PO Box 8261
Alice Springs NT 08701Australia Mob: 0428 848 912Email1: [EMAIL PROTECTED] 

To: [EMAIL PROTECTED]: [EMAIL PROTECTED]: Thu, 30 Oct 2008 23:19:26 
-0400Subject: RE: [nsbasic-ce] serial comms in NSBasic to capture GPS NMEA data 
stream






Hi:
 
First, I would like to say I really admire you for developing a very 
specialized application without being a career software developer. The initial 
thought I have before even looking at your code is that different GPS devices 
communicate at different baud rates depending on the age and type of GPS that 
is actually utilized. Also the baud rate you use has to be in the fixed 
supported rates.
(1200, 2400, 4800, 9600, 19200, 28800, 38400, 57600, 76800 and 115200 etc…. )
Does one of the rates above match the rate used in your program and also is the 
rate you have coded for the maximum rate that is directly supported by the gps 
in your pda?
 
Example:
COM Port: COM2
Baud Rate: 4800
Data Bits: 8
Parity: No Parity
Stop Bits: 2
 
Bob
 
From: [EMAIL PROTECTED] [EMAIL PROTECTED] On Behalf Of wksaalfeld
Sent: Thursday, October 30, 2008 10:17 PM
To: [EMAIL PROTECTED]
Subject: [nsbasic-ce] serial comms in NSBasic to capture GPS NMEA data stream
 
Hi All,
 
I am a Wildlife Officer with the Parks and Wildlife Service NT 
Australia. I have a program that I have written for data logging 
sightings taken on our annual spotlight surveys of saltwater 
crocodile populations in the Northern Territory.
 
NSBasic does an excellent job, particularly due to the speed at which 
sightings can be entered. The sightings are recorded with spatial 
information which I get from the PDA's inbuilt GPS via the GPS 
NMEA0183 data stream.
 
I have a program that works in terms of reading the NMEA data stream 
but the code is not well written, at least it seems so to me, and it 
can often be 1 or 2 seconds before the program gets the lat/long 
position, rarely more.
 
I would very much like to tighten up the subroutine in my program 
that gets the GPS data and if someone can supply me with a good 
reference, either web site or to a book, on serial comms that has 
been written for a non-programmer it would be appreciated. I have 
done a number of Google searches and looked at GPS code in the files 
link on this forum and the code I have written appears very similar.
 
I have posted a copy of the program (it is very simple) in the files 
link (CrocSurv_05.nsb). One of the main requirements of the spotlight 
surveys is the capacity to enter sightings with as little as 2-3 
seconds between records and with GPS position logged at commencement 
of data entry, not end. We do the surveys at night in small boats 4-5 
m, moving at about 15-20 kph so there is not much time to identify 
and record each animal. For each animal we record species (there are 
only 2 and mostly it is Crocodyus porosus), position in river, and 
size.

 





_________________________________________________________________


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nsb-ce" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/nsb-ce?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to