|
以下是完整程式範例,
我的問題是,要如何刪除簡化這些指令,
因為我只想要接收$GPGGA,xxxx,x0xx,E,x.xx,N,.......的這種資料
想請各位懂BASIC STAMP的高手幫我解答。
' -----[ I/O Definitions ]-------------------------------------------------
Sio PIN 15 ' connects to GPS Module SIO pin
' -----[ Constants ]-------------------------------------------------------
T4800 CON 188
Open CON $8000
Baud CON Open | T4800 ' Open mode to allow daisy chaining
MoveTo CON 2 ' DEBUG positioning command
ClrRt CON 11 ' clear line right of cursor
FieldLen CON 22 ' length of debug text
EST CON -5 ' Eastern Standard Time
CST CON -6 ' Central Standard Time
MST CON -7 ' Mountain Standard Time
PST CON -8 ' Pacific Standard Time
EDT CON -4 ' Eastern Daylight Time
CDT CON -5 ' Central Daylight Time
MDT CON -6 ' Mountain Daylight Time
PDT CON -7 ' Pacific Daylight Time
UTCfix CON PST ' for San Diego, California
DegSym CON 176 ' degrees symbol for report
MinSym CON 39 ' minutes symbol
SecSym CON 34 ' seconds symbol
' GPS Module Commands
GetInfo CON $00
GetValid CON $01
GetSats CON $02
GetTime CON $03
GetDate CON $04
GetLat CON $05
GetLong CON $06
GetAlt CON $07
GetSpeed CON $08
GetHead CON $09
' -----[ Variables ]-------------------------------------------------------
char VAR Byte
workVal VAR Word ' for numeric conversions
eeAddr VAR workVal ' pointer to EE data
ver_hw VAR Byte
ver_fw VAR Byte
valid VAR Byte ' signal valid? 0 = not valid, 1 = valid
sats VAR Byte ' number of satellites used in positioning calculations
tmHrs VAR Byte ' time fields
tmMins VAR Byte
tmSecs VAR Byte
day VAR Byte ' day of month, 1-31
month VAR Byte ' month, 1-12
year VAR Byte ' year, 00-99
degrees VAR Byte ' latitude/longitude degrees
minutes VAR Byte ' latitude/longitude minutes
minutesD VAR Word ' latitude/longitude decimal minutes
dir VAR Byte ' direction (latitude: 0 = N, 1 = S, longitude: 0 = E, 1 = W)
heading VAR Word ' heading in 0.1 degrees
alt VAR Word ' altitude in 0.1 meters
speed VAR Word ' speed in 0.1 knots
' -----[ EEPROM Data ]-----------------------------------------------------
NotValid DATA "No", 0
IsValid DATA "Yes", 0
DaysInMon DATA 31,28,31,30,31,30,31,31,30,31,30,31
MonNames DATA "JAN",0,"FEB",0,"MAR",0,"APR",0,"MAY",0,"JUN",0
DATA "JUL",0,"AUG",0,"SEP",0,"OCT",0,"NOV",0,"DEC",0
' -----[ Initialization ]--------------------------------------------------
Initialize:
PAUSE 250 ' let DEBUG open
DEBUG CLS ' clear the screen
DEBUG "Parallax GPS Receiver Module Test Application", CR,
"---------------------------------------------"
Draw_Data_Labels:
DEBUG MoveTo, 0, 3, " Hardware Version: "
DEBUG MoveTo, 0, 4, " Firmware Version: "
DEBUG MoveTo, 0, 6, " Signal Valid: "
DEBUG MoveTo, 0, 7, " Acquired Satellites: "
DEBUG MoveTo, 0, 9, " Local Time: "
DEBUG MoveTo, 0, 10, " Local Date: "
DEBUG MoveTo, 0, 12, " Latitude: "
DEBUG MoveTo, 0, 13, " Longitude: "
DEBUG MoveTo, 0, 14, " Altitude: "
DEBUG MoveTo, 0, 15, " Speed: "
DEBUG MoveTo, 0, 16, " Direction of Travel: "
' -----[ Program Code ]----------------------------------------------------
Main:
GOSUB Get_Info
GOSUB Get_Valid
GOSUB Get_Sats
GOSUB Get_TimeDate
GOSUB Get_Lat
GOSUB Get_Long
GOSUB Get_Alt
GOSUB Get_Speed
GOSUB Get_Head
GOTO Main
---------------------------------------------------------------
Get_Lat:
SEROUT Sio, Baud, ["!GPS", GetLat]
SERIN Sio, Baud, 3000, No_Response, [degrees, minutes, minutesD.HIGHBYTE, minutesD.LOWBYTE, dir]
' convert decimal minutes to tenths of seconds
workVal = minutesD ** $0F5C ' minutesD * 0.06
DEBUG MoveTo, FieldLen, 12, DEC3 degrees, DegSym, " ", DEC2 minutes, MinSym, " "
DEBUG DEC2 (workVal / 10), ".", DEC1 (workVal // 10), SecSym, " "
DEBUG "N" + (dir * 5)
' convert to decimal format, too
workVal = (minutes * 1000 / 6) + (minutesD / 60)
DEBUG " (", " " + (dir * 13), DEC degrees, ".", DEC4 workVal, " ) "
RETURN
' ----------------------------從這裡開始副程式------------------------
Get_Long:
SEROUT Sio, Baud, ["!GPS", GetLong]
SERIN Sio, Baud, 3000, No_Response, [degrees, minutes, minutesD.HIGHBYTE, minutesD.LOWBYTE, dir]
' convert decimal minutes to tenths of seconds
workVal = minutesD ** $0F5C ' minutesD * 0.06
DEBUG MoveTo, FieldLen, 13, DEC3 degrees, DegSym, " ", DEC2 minutes, MinSym, " "
DEBUG DEC2 (workVal / 10), ".", DEC1 (workVal // 10), SecSym, " "
DEBUG "E" + (dir * 18)
' convert to decimal format, too
workVal = (minutes * 1000 / 6) + (minutesD / 60)
DEBUG " (", " " + (dir * 13), DEC degrees, ".", DEC4 workVal, " ) "
RETURN
以上我要如何刪除運算子運算??
這個問題希望各位能幫我解答,緊急需求,謝謝!! |
|