HI
I'm currently working on a GPS based project. I am relatively new to PB programming. I am able to parse out the string and now I am trying to get the distance between 2 GPS Modules. I have an algorithm to complete it but I am unfamiliar with floating point operations. The distances will be relatively small, less than 800meters. Here is what I need the code to do..with obvious errors b/c of the floating point and the overflow issues.
TRISB.0 = 1 ' Set PORTB, pin 0 to an input
OSCCON = %01100010
ADCON0 = %00011100
ADCON1 = %01111111
GPSin VAR PORTB.0 'pin 8
'Allocate Variables for GPS:
TimeOut CON 3000
baudGPS CON 188 '16572 + 8192 (bit 13)
dist var word
bearing Var byte
time var byte(10)
x var word
y var word
lat_min var word
lat var word
latitude var word
long_min var word
long var word
longitude var word
bearing1 var byte
bearing2 var byte
lat1 var word
long1 var word
gps:
serin2 PORTB.1,188,[wait("GPGGA"),str time\8,wait(","),skip 2, dec2 lat,wait("."),_
dec4 lat_min,wait(","),bearing1,wait(","),skip 3,dec2 long,wait("."),dec4 long_min]
'next serin2 for other GPS-----------------------------------------------------
lat1 = 2832 'these are used for simulating the data from GPS2
long1 = 5320
'-----------------------------------------------------------------------------
latitude = abs(lat1 - lat_min)
latitude = latitude*1847
latitude = latitude/100
longitude = abs(long1 - long_min)
longitude = longitude*1591
longitude = longitude/100
dist = sqr(latitude*latitude + longitude*longitude)
gosub gps1
pause 500
Any help or suggestions will be greatly appreciated.
Matt
Bookmarks