關於Basic Stamp 與相關產品GPS的程式問題,請求解答!!
以下是完整程式範例,我的問題是,要如何刪除簡化這些指令,
因為我只想要接收$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
minutesDVAR 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]
SERINSio, Baud, 3000, No_Response,
' 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]
SERINSio, Baud, 3000, No_Response,
' 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
以上我要如何刪除運算子運算??
這個問題希望各位能幫我解答,緊急需求,謝謝!!
以下是完整程式範例,
我的問題是,要如何刪除簡化這些指令,
因為我只想要接收$GPGGA,xxxx,x0xx,E,x.xx,N,.......的這種資料
想請各位懂BASIC STAMP的高手幫我解答。
log4518 發表於 2010-6-3 21:57 http://www.robofun.net/forum/images/common/back.gif
你是用Parallax GPS嗎?如果是的話,還是用簡化指令比較方便,如果直接解NMEA訊息的話,你大概會想寫到撞牆。XD
如果只想收到NMEA的話,把Parallax GPS的/raw 接low即可。
cdata VAR Byte
SERINSio, Baud,
DEBUG STR cdata\1
這樣你應該就能看到NMEA訊息了.... 回復 2# g921002
謝謝你的解答,不過我試出來是很多小數字跟一些亂碼字,
然後我試著把
data VAR Byte
SERINSio, Baud,
DEBUG STR cdata\1
改成
SERINSio, Baud,
DEBUG cdata
結果出現這個
跟我原來想要抓到的$GPGGA的資料有出入,
所以向各位高手請求解答求救!!!謝謝~
另外
STR 這個指令是什麼意思 是轉成字串顯示的嗎?
頁:
[1]