View Single Post
  #1   Spotlight this post!  
Unread 15-12-2008, 17:02
C222's Avatar
C222 C222 is offline
Computer Science Major
FRC #0852 (Athenian Robotics Collective)
Team Role: Alumni
 
Join Date: Mar 2007
Rookie Year: 2007
Location: California
Posts: 22
C222 is on a distinguished road
Decoding GPS with C#

I have a fairly old GPS receiver that communicates with my desktop through COM1.

I found some code on the internet to decode the strings i get from the receiver which look something like:
Code:
$GPGSA,A,1,,,,,,,,,,,,,1.27,0.75,1.03*04
$GPRMC,215606,V,3511.1990,N,12904.2725,W,0.000,0.0,151208,15.0,E*45
$PRWIZCH,29,6,12,0,12,0,31,0,24,6,31,0,16,0,31,0,31,0,31,0,31,0,12,0*44
$GPGGA,,,,,,0,00,,,,,,,*66
$GPGSA,A,1,,,,,,,,,,,,,1.27,0.75,1.03*04
$GPGSV,3,1,12,29,70,024,34,24,70,006,39,30,50,190,,21,48,264,*79
$GPGSV,3,2,12,10,34,052,,05,28,173,,18,21,194,,12,20,163,*73
$GPGSV,3,3,12,16,11,321,,31,11,268,,15,09,124,,26,07,108,*73
$GPRMC,215607,V,3511.1990,N,12904.2725,W,0.000,0.0,151208,15.0,E*44
$PRWIZCH,29,6,12,0,12,0,31,0,24,6,31,0,16,0,31,0,31,0,31,0,31,0,12,0*44
$GPGGA,,,,,,0,00,,,,,,,*66
The code if found here.
Using a resource I found on the internet i can tell that the GPS is working and giving me a fairly accurate location (once i get a fix).
However, this is over a terminal application called Tera Term and my GPS requires me to broadcast the command "ASTRAL" before any useful data is sent. The problem is, the code from the link above has no command to submit the command "ASTRAL". I tried:
Code:
private void button3_Click(object sender, EventArgs e)
        {
            if (comport.IsOpen)
            {
                //byte astral;
                //astral = Convert.ToByte("ASTRAL");
                comport.Write("ASTRAL");
                comport.WriteLine("ASTRAL");
            }
            else
            {
            }
        }
But that didn't work. Any suggestions?
__________________
--=====|-----====|-------====|-------====|----
--=|--------------==|----------==|---------==|---
--=|---------------==|----------==|---------==|--
--=|------------==|----------==|---------==|-----
--=====|-----======|-----======|----======|-