190-00266-01 GPS 15H & 15L Technical Specifications Rev. DPage 29APPENDIX D: EPHEMERIS DATA DOWNLOAD (PROGRAMMING EXAMPLE)SynopsisThis section describes, using an example, how to download ephemeris information from a Garmin 15, 16,17 or 18 family GPS unit with the exception of the GPS 15-W and the GPS 15-F.Garmin Binary Format ReviewIn order to download the ephemeris data, you must first command the unit to output information in GarminBinary Format (Garmin mode) instead of the default NMEA output format. To put the unit in Garminmode, connect to the unit using a terminal program and send the following NMEA sentence:$PGRMO,,G*hhThe checksum *hh is used for parity checking data and is not required, but is recommended for use inenvironments containing high electromagnetic noise. It is generally not required in normal PCenvironments. When used, the parity bytes (hh) are the ASCII representation of the exclusive-or (XOR)sum of all the characters between the "$” and “*” characters, non-inclusive. Sentences may be truncated by after any data field and valid fields up to that point are acted on by the GPS sensor. The unitstays in Garmin mode until the next power cycle.Now that unit is in Garmin binary format, transmitted and received packets are structured as follows:Byte Description Name NotesPacket Delimiter DLE 0x10Packet ID (type) ID Packet typeData Size SIZE Number of bytes in data portion(notincluding escaped DLEs. See below)Data bytes DATA Not to exceed 256 bytes. . .. . .. . .Checksum CHKSUM 2’s complement of the arithmeticsum of all the bytes from thePacket ID byte to the last DATAbyte(inclusive) not countingescaped DLEs. See belowPacket Delimiter DLE 0x10End of Packet ETX 0x03The DLE (0x10) is a delimiter byte used in conjunction with the ETX byte to determine beginning andending of a packet. However, a 0x10 could appear in the data itself, so if this occurs the byte is escapedwith another DLE byte (sometimes referred to as DLE stuffing). In other words, if a DLE occurs in thedata, another DLE is transmitted immediately after to indicate that it is a data byte and it is not being usedas a delimiter. Note that the size byte of the packet does not count the second DLE byte in an escaped DLEpair in the data field. Since a DLE that is a part of the data will have a second DLE to escape it, a singleDLE followed by an ETX byte means that the end of a packet has been reached.In order to interpret these packets properly, one must remove the escaped DLE bytes. This can be achievedusing an algorithm similar to the Sample C Code fragment on the previous page.