jump to navigation

NMEA Input Message 100 SetSerialPort March 5, 2012

Posted by jinzaistudio in ASP.NET 3.5, jinzai-studio.net, Michael T. Blake, Parallax Propeller, programming, rocketry, Uncategorized, Visual Basic.
trackback

This post relates to the National Marine Electronics Association (NMEA) Standard 0183 v2.2. Specifically, it addresses Input Message 100, SetSerialPort, which is used to alter the communications rate of Global Positioning System (GPS) devices. The device used to generate this document is a SiRF PMB-688 and it is connected to a Parallax Quickstart P8X32A Development Board. These are available from Radio-Shack for $39 at the time of this writing, or from Parallax directly. The PMB-688 is likewise available from Parallax. The two links will take you to the product pages for the devices.

Changing the speed is a simple process. The PMB-688 is typical of GPS receivers in its class in that it defaults to 4800bps, 8 data bits, 1 stop bit and no parity. The speed can be changed by sending an ASCII text string with the properly formatted message, checksum and a terminating carriage return/line feed pair. The only real task is generating the checksum, which while not at all difficult, is poorly and often incorrectly documented which leads to many applications suffering from a severe underflow of GPS data. Below is a list of complete strings for accomplishing the change, followed by the VisualBasic.NET routine for calculating a checksum and adding it to the message text that was used to generate the list.

NMEA Mode:

  • $PSRF100,1,4800,8,1,0*0E
  • $PSRF100,1,9600,8,1,0*0D
  • $PSRF100,1,19200,8,1,0*38
  • $PSRF100,1,38400,8,1,0*3D
  • $PSRF100,1,57600,8,1,0*36
  • $PSRF100,1,115200,8,1,0*05

SiRF Binary Mode:

  • $PSRF100,0,4800,8,1,0*0F
  • $PSRF100,0,9600,8,1,0*0C
  • $PSRF100,0,19200,8,1,0*15
  • $PSRF100,0,19200,8,1,0*39
  • $PSRF100,0,57600,8,1,0*37
  • $PSRF100,0,115200,8,1,0*04

* The string must be followed by a terminating carriage return/line feed pair.

VisualBasic.NET listing for calculating the checksum and adding to the command string:

PublicFunction CalculateNMEAChecksum(ByVal theCommandString AsString) AsString

    Dim theList AsNew List(OfByte)

    Dim theChecksum AsByte = 0

    For x AsInteger = 0 To theCommandString.Length – 1

        If theCommandString(x) <> “*”AndAlso theCommandString(x) <> “$”Then

theList.Add(Convert.ToByte(Asc(theCommandString.Substring(x, 1))))

        EndIf

    Next

    Dim theBytes() AsByte = theList.ToArray

    For i AsInteger = 0 To theBytes.Length – 1

theChecksum = theChecksum Xor theBytes(i)

    Next

    Return theCommandString & theChecksum.ToString(“X”)

EndFunction

Advertisements

Comments»

No comments yet — be the first.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: