                        Mag2nmea.exe

A utility that, assuming a PC is connected via a serial link to
a Magellan GPS, will request the almanac and then convert this
to a NMEA format file.  It will then call "nmea2alm" and then
"alm2tle" to convert the NMEA file to the TLE format that can be
used on your favourite satellite tracking software.

Assumptions:
------------

A Magellan Rcvr is connected to an IBM PC serial port 1 or 2.

Magellan receiver is set to 4800 Baud rate.

The Magellan has been running for at least 15 minutes to have
obtained the latest almanac from the Satellites overhead.

Instructions:
-------------

Run "MAG2NMEA", if you need to use COMPORT 2, call it thus

MAG2NMEA 2

Otherwise the program will use COMPORT 1

Run the program, if all is well and your receiver "can" output
the almanac the program will indicate it is doing so.

If your Magellan cannot output the "almanac" or there is
something wrong, after ten seconds the program will indicate
that it has given up, suggesting possible causes.

At the time of writing (circa Nov 2000) information on the
Magellan internet site indicates that NO receiver outputs the 
almanac. However experimenting by Dave Checkett, shows that his 
Magellan 315 firmware 3.05 works fine. If you are sure that you 
have the correct serial port (1 or 2) and the cable is connected 
correctly, and the Magellan is set to 4800 baud, and still 
nothing happens, it is assumed that your model/firmware does not 
output the almanac. It does not indicate a "fault" in your
Magellan - just it has other things to do with its life it 
seems!

If the program does pull back the almanac, it saves it in a file
called "nmea.txt", it will then attempt to call "nmea2alm.exe"
if it is in the same directory, which in turn will attempt to
call "alm2tle.exe" and so produce "GPS.TLE" ready for your
favourite satellite tracking program.

If the program is successful at pulling out the almanac you can
set up a simple batch file or shortcut, so it becomes a one
click operation in Windows or DOS machine. The batch file can
also copy the "GPS.TLE" to your tracking program directory.

Please read NMEA2ALM.TXT for further info.

Thanks go to Dave Checkett (St Louis USA) for his initial
experimenting with the Magellan serial interface, and for
finding out why the Magellan almanac sentence is different from
other NMEA almanac sentences.  His work prompted the writing of
this program, Dave has succesfully tested it on his Magellan.

Have fun, regards, Geoff....

Technical Notes:
----------------

When MAG2NMEA.EXE starts it sets up Interrupt processes for the
Timer Tick, and the Serial Port, then sends "only" the following
string once to the GPS.

$PMGNCMD,ALMANAC*3F

It then waits up to 10 seconds for a "$PMGNALM" string e.g.

$PMGNALM,27,1,01,1084,00,282C,39,0C7C,FD55,A10CD8,B91BF0,3A9A9F,3BD4A3,000,000*33

The program then tests the line, if it fails the checksum, the
program tells you it has failed, and suggests you start again.
If the checksum is OK, it then changes the "week number" (5th
field) by doing a modulo 1024, so turning (above) 1084 into 60.
The program changes the start string to $GPALM, calculates new
checksum and saves to NMEA.TXT. The following line shows how the
above line is saved. After processing all the messages it then
calls NMEA2ALM.EXE.

$GPALM,27,1,01,60,00,282C,39,0C7C,FD55,A10CD8,B91BF0,3A9A9F,3BD4A3,000,000*3B

It has been noted that the last two fields (clock parameters)
are always set to ZERO by the Magellan Receiver. These fields
are not used on ALM2TLE, but people wanting to use the produced
YUMA almanac for "other" purposes may need these paramaters.

Only satellites with a ZERO health status are sent in the
Magellan Almanac, so a satellite that may be having temporary
maintenance will not be included.
