Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

GPS16X-HVS & CR5000


Bruce Jan 28, 2011 12:14 AM

If any body know how to use the GPS16X-HVS + SDM-SIO4 + CR5000 ?
I want to record the Longitude and Latitude data to CR5000. Please send me a sample program.

Thanks.


TweeedleDum Feb 20, 2011 06:13 AM

Dim LatDeg_IntPart,LatDeg_FracPart,LngDeg_IntPart,LngDeg_FracPart
Public LattitudeDegrees : Units LattitudeDegrees=Deg
Public LongitudeDegrees : Units LongitudeDegrees=Deg
Public UTC_Hr,UTC_Min,UTC_Sec
Dim UTC_SecOfDay
Public MainScanCntr,SlowSeqCntr
Const Send120Bytes=120
Const SDM_Adr_0=0
Const Port1=1
Const Port2=2
Const AllPorts=5
Public Sio4Sig(2)
Alias Sio4Sig(1)=Sio4EEPROMSig
Alias Sio4Sig(2)=Sio4MemorySig
Dim ResultCode(1),fltst1(Send120Bytes),Null
Const _Null = 0000
Const PollForData0001 = 0001
Const GetSigs0002 = 0002
Const SendDataToLgr = 0004
Const ResultCode0067 = 0067
Const Sio4CmdLine0321 = 0321
Const Sio4COMSetUpCmd = 2049
Const StartRxFilter = 2054
Const RxFilt9001 = 9001
Const Port2ComCode = 9147
Public GotSio4Sigs,Sio4COMSetUp,Sio4Programmed,DataPoll
Dim i,j,k
Const ElevenGGAValues=11
Const FourVTGValues=4
Const FifteenGPSValues=ElevenGGAValues+FourVTGValues
Dim RawGPSData(FifteenGPSValues)
Public Latitude_S As String *9
Public Longitude_S As String *10
Units Latitude_S = ddmm.mmmm
Units Longitude_S = dddmm.mmmm
Public RawGGAData(ElevenGGAValues)
Alias RawGGAData(1) = GGA_UTC_Time : Units GGA_UTC_Time =hhmmss
Alias RawGGAData(2) = Latt_Int : Units Latt_Int =ddmm
Alias RawGGAData(3) = Latt_Frac : Units Latt_Frac = .mmmm
Alias RawGGAData(4) = LattH_NS
Alias RawGGAData(5) = Longit_Int : Units Longit_Int =dddmm
Alias RawGGAData(6) = Longit_Frac : Units Longit_Int = .mmmm
Alias RawGGAData(7) = LongH_EW
Alias RawGGAData(8) = GPSQuality
Alias RawGGAData(9) = Satilites
Alias RawGGAData(10) = HDOP
Alias RawGGAData(11) = Altitude : Units Altitude=Meters
Public RawVTGData(FourVTGValues)
Alias RawVTGData(1) =COG_True : Units COG_True = COGndDgT
Alias RawVTGData(2) =COG_Magnetic : Units COG_Magnetic = COGndDgM
Alias RawVTGData(3) =SOG_Knots : Units SOG_Knots = SpeedOG_K
Alias RawVTGData(4) =SOG_KPH : Units SOG_KPH = SpeedOGKPH
Public VTG_MilesPerHr
Public GPS_Flag

DataTable(GPSData,True,-1)
Sample(1,Latitude_S,String)
Sample(1,Longitude_S,String)
Sample(ElevenGGAValues,RawGGAData(),IEEE4)
Sample(1,LattitudeDegrees,IEEE4)
Sample(1,LongitudeDegrees,IEEE4)
Sample(1,UTC_SecOfDay,IEEE4)
Sample(FourVTGValues,RawVTGData(),IEEE4)
EndTable

DataTable(Sio4Prog,True,1)
Sample(1,ResultCode(),IEEE4)
Sample(1,j,Long) : FieldNames("fltst1ProgTrys")
Sample(1,i,FP2) : FieldNames("ResultCodeTrys")
Sample(Send120Bytes,fltst1(),IEEE4)
EndTable

DataTable(Sio4Sigs,True,1)
Sample(1,i,IEEE4) : FieldNames("SigTrys")
Sample(2,Sio4Sig(),IEEE4)
EndTable


Sub ProgSio4
Do
j=j+1
SIO4(fltst1(),1,SDM_Adr_0,AllPorts,Sio4CmdLine0321,_Null,_Null,Send120Bytes,1.0,0.0)
Delay(1,1000,mSec)
ResultCode(1)=NaN
i=0
For i= 1 To 10
If ResultCode(1)=23 Then ExitFor
SIO4(ResultCode(),1,SDM_Adr_0,AllPorts,ResultCode0067,_Null,_Null,1,1.0,0.0)
Delay(1,500,mSec)
Next i
CallTable(Sio4Prog)
If ResultCode(1)=23 Then ExitDo
Sio4Programmed=True
Loop
EndSub

Sub Sio4ComSU
SIO4(Null,1,SDM_Adr_0,Port2,Sio4COMSetUpCmd,Port2ComCode,_Null,0,1.0,0.0)
Delay(1,500,mSec)
Sio4COMSetUp = True
EndSub
Sub GetSio4Sigs
For i= 1 To 10
SIO4(Sio4Sig(),1,SDM_Adr_0,Port2,GetSigs0002,Port2ComCode,_Null,2,1.0,0.0)
Delay(1,200,mSec)
If Sio4Sig(1)>-1 AND Sio4Sig(1)<>314 AND Sio4Sig(2)>-1 AND Sio4Sig(2)<>314 Then ExitFor
Next i
CallTable (Sio4Sigs)
GotSio4Sigs=True
EndSub

Sub FormatGPSData()
Latitude_S=Latt_Int+CHR(46)+Latt_Frac
Longitude_S=Longit_Int+CHR(46)+Longit_Frac
LatDeg_IntPart=INT(Latt_Int/100)
LatDeg_FracPart=((100*FRAC(Latt_Int/100))+(Latt_Frac/10000))/60
If LattH_NS=83 Then LatDeg_IntPart=-1*LatDeg_IntPart
If LattH_NS=83 Then LatDeg_FracPart=-1*LatDeg_FracPart
LattitudeDegrees=LatDeg_IntPart+LatDeg_FracPart
LngDeg_IntPart=INT(Longit_Int/100)
LngDeg_FracPart=((100*FRAC(Longit_Int/100))+(Longit_Frac/10000))/60
If LongH_EW=87 Then LngDeg_IntPart=-1*LngDeg_IntPart
If LongH_EW=87 Then LngDeg_FracPart=-1*LngDeg_FracPart
LongitudeDegrees=LngDeg_IntPart+LngDeg_FracPart
UTC_Hr=INT(GGA_UTC_Time/10000)
UTC_Min=INT(GGA_UTC_Time/100)
UTC_Min=FRAC(UTC_Min/100)*100
UTC_Sec=FRAC(GGA_UTC_Time/100)*100
UTC_SecOfDay=UTC_Sec+UTC_Min*60+UTC_Hr*60*60
VTG_MilesPerHr=SOG_KPH*0.6214
EndSub

BeginProg


Scan(50,mSec,100,0)
MainScanCntr=MainScanCntr+1
NextScan


SlowSequence

Data 102,108,116,115,116,32,49,32,34,116,91,71,80,71,71,65,44,93
Data 120,70,116,91,44,93,68,116,91,46,93,74,52,58,49,116,91,44,93,98,49,116,91,44,93,68,116,91,46,93,74,52,58,49,116,91,44,93,98,49,116,91,,44,93,70
Data 116,91,44,93,70,116,91,44,93,70,116,91,44,93,70,88
Data 116,91,71,80,86,84,71,44,93,68,116,91,44,84,44,93,68,116,91,44,77,44,93,70,116,91,44,78,44,93,70,116,91,44,75,44,93,98,49
Data 115,34
For k= 1 To Send120Bytes
Read fltst1(k)
Next k


Do
Call GetSio4Sigs
Call Sio4ComSU
Call ProgSio4
SIO4(Null,1,SDM_Adr_0,Port2,Sio4COMSetUpCmd,Port2ComCode,_Null,0,1.0,0.0)
Delay(1,100,mSec)
Do
SIO4(Null,1,SDM_Adr_0,Port2,0003,_Null,_Null,0,1.0,0.0)
Delay(1,80,mSec)
SIO4(Null,1,SDM_Adr_0,Port2,0009,_Null,_Null,0,1.0,0.0)
Delay(1,80,mSec)
SIO4(Null,1,SDM_Adr_0,Port2,StartRxFilter,RxFilt9001,_Null,0,1.0,0.0)
Delay(1,20,mSec)
Scan(100,mSec,50,50)
SlowSeqCntr=SlowSeqCntr+1
SIO4(DataPoll,1,SDM_Adr_0,Port2,PollForData0001,_Null,_Null,1,1.0,0.0)
If DataPoll>0 OR GPS_Flag Then
Delay(1,40,mSec)
SIO4(RawGPSData(),1,SDM_Adr_0,Port2,SendDataToLgr,_Null,_Null,FifteenGPSValues,1.0,0.0)
Delay(1,40,mSec)
Move(RawGGAData(1),ElevenGGAValues,RawGPSData(01),ElevenGGAValues)
Move(RawVTGData(1),FourVTGValues,RawGPSData(12),FourVTGValues)
Call FormatGPSData
CallTable(GPSData)
GPS_Flag=False
ExitScan
EndIf
NextScan
Loop
Loop


EndProg'778771

* Last updated by: TweeedleDum on 2/19/2011 @ 11:26 PM *


Bruce Mar 23, 2011 02:23 PM

I have solved the problem.

Thank you for your assistance.

Log in or register to post/reply in the forum.