home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 24 / CD_ASCQ_24_0995.iso / vrac / aprs72a.zip / MOTOROLA.BAS < prev    next >
BASIC Source File  |  1994-09-29  |  4KB  |  106 lines

  1. CLS
  2. PRINT "This program allows you to send control codes to the MOTOROLA GPS receivers."
  3. PRINT
  4. PRINT "You could do this with a dumb terminal, but you would need to enter the "
  5. PRINT "exact checksum characters before the GPS receiver will recognize the"
  6. PRINT "command.  This program computes the checksum characters and automatically"
  7. PRINT "inserts them on the end.."
  8. PRINT
  9. PRINT
  10. PRINT
  11. INPUT "To which COM port is your GPS connected (1/2)"; p$
  12. IF p$ = "" THEN p$ = "1"
  13.  
  14.  
  15. CLS
  16. PRINT
  17. PRINT "PREPARING TO SEND THE BINARY COMMAND TO SHIFT THE GPS FROM BINARY TO NMEA"
  18. PRINT
  19. PRINT "If the receiver is in an unknown status, or known to be in the Motorola"
  20. PRINT "Binary mode, then you need to send this command.  It should be sent at the"
  21. PRINT "default Binary speed of 9600 baud.  This program will use 9600 baud..."
  22. PRINT
  23. PRINT
  24. PRINT " MODE COMMAND:       @@Ci^a+CRLF"
  25. PRINT " where                ||| || | *- LINE FEED CHARACTER"
  26. PRINT "                      ||| || *--- Carriage Return character"
  27. PRINT "                      ||| |*----- Check sum (+) for this exact string"
  28. PRINT "                      ||| *------ Control A (sent as a single 8 bit char)"
  29. PRINT "                      ||*-------- lower case i"
  30. PRINT "                      |*--------- capital C"
  31. PRINT "                      *---------- @@ characters"
  32. PRINT
  33. INPUT "Proceed to place the receiver in to NMEA mode (y/n) (N)"; A$
  34. IF UCASE$(A$) = "Y" THEN
  35.    PRINT
  36.    PRINT "Sending NMEA mode command at 9600 baud..."
  37.    OPEN "COM" + p$ + ":9600,N,8,1,CS0,CD0,DS0" FOR RANDOM AS #1
  38.    PRINT #1,
  39.    PRINT #1, "@@Ci"; CHR$(1); "+"; CHR$(13); CHR$(10);
  40.    CLOSE #1
  41. END IF
  42.  
  43.  
  44. CLS
  45. PRINT "Now re-opening the COM port at the default NMEA 4800 baud rate..."
  46. PRINT
  47.  
  48. OPEN "COM" + p$ + ":4800,N,8,1,CS0,CD0,DS0" FOR RANDOM AS #1
  49. PRINT "DONE!"
  50. PRINT
  51. PRINT
  52.  
  53. Again:
  54.  
  55. PRINT "Now send a Motorola command to enable any selected NMEA string in the"
  56. PRINT "following list.  The RAW format for the command is as follows:"
  57. PRINT
  58. PRINT "     $PMOTG,GGA,xxxx*ccCRLF   Where cc is the XOR checksum of all"
  59. PRINT "                              characters between the $ and the *."
  60. PRINT "                              then end the line with CR/LF.  The"
  61. PRINT "                              xxxx (4 digits) is the periodicity"
  62. PRINT "                              of that NMEA command in seconds."
  63. PRINT
  64. PRINT "Other NMEA sentences are:     GGA,GLL,RMC,GSA,GSV,VTG,ZDA"
  65. PRINT ""
  66. PRINT "To return to BINARY, send the NMEA command: $PMOTG,FOR,0*ccCRLF"
  67. PRINT ""
  68. PRINT "To send the command, type all characters between the $PMOTG,... and *."
  69. PRINT "To view the receiver output, type VIEW."
  70. PRINT "To end this program, type END."
  71. PRINT ""
  72.  
  73. DO
  74.  
  75.    LINE INPUT "Enter the desired command string (or VIEW or END) > "; S$
  76.    S$ = UCASE$(S$): IF S$ = "END" THEN STOP
  77.    IF S$ = "VIEW" THEN EXIT DO
  78.  
  79.    IF RIGHT$(S$, 1) = "*" THEN S$ = LEFT$(S$, LEN(S$) - 1)
  80.    S$ = "PMOTG," + S$
  81.    cs = 0
  82.    FOR i = 1 TO LEN(S$)
  83.        cs = cs XOR ASC(MID$(S$, i, 1))
  84.    NEXT i
  85.    Cmd$ = "$" + S$ + "*" + RIGHT$("0" + HEX$(cs), 2)
  86.    PRINT Cmd$: PRINT #1, Cmd$; CHR$(13); CHR$(10);
  87. LOOP
  88.  
  89. CLS
  90. LOCATE 25, 1: PRINT "Hit ESC to return to menu...";
  91. LOCATE 1, 1
  92.  
  93.  
  94. DO
  95. A$ = INPUT$(LOC(1), 1)
  96. REM If you get an error here, then your GPS is still outputting BINARY and
  97. REM never got set to NMEA.  Restart the program and be sure to indicate the
  98. REM correct COM port and to answer (Y)es to SEND THE NMEA MODE COMMAND.
  99. PRINT A$;
  100. IF INKEY$ = CHR$(27) THEN EXIT DO
  101. LOOP
  102. CLS
  103. GOTO Again
  104. END
  105.  
  106.