Shop OBEX P1 Docs P2 Docs Learn Events
Float32Full is going to kill me! — Parallax Forums

Float32Full is going to kill me!

Sniper KingSniper King Posts: 221
edited 2008-06-09 22:05 in Propeller 1
Here is the code:

Pub GetCoords
i:=0
· repeat until i==70
··· tv.str(gps.valid)
··· waitcnt(2000000+cnt)
··· i++
tv.str(string(13))
i:=0
bytemove(@lat,gps.latitude,9)···· ' Moves GPS coords into @LAT· DDMM.mmmm
bytemove(@lng,gps.longitude,10)·· [url=mailto:'@LNG]'@LNG[/url] DDDMM.mmmm
bytefill(@buf,0,65)············· 'Clear Buffer
tv.str(gps.latitude)············ 'Display Latitude
tv.str(string(13))
i:=0
·repeat until i==7··············· 'Put MM.mmmm into buffer
·· buf[noparse][[/noparse]i]:=lat[noparse][[/noparse]i+2]
·· i++
·tv.str(@buf)····················· 'Display minutes Latitude
·tv.str(string(13))
b:=FMT.atoi(@buf)··················· 'Format string data into floating decimal.
Y:=60.0···················
a:=fp.fdiv(b,Y)····················· '********* Problem Child!!!!! **************··· MM.mmmm / 60 and then add it to the··················
···································· ' whole decimal for DD.ddddd· below.
tv.dec(a)···························
i:=0
bytefill(@buf,0,64)··
·repeat until i==2
· buf[noparse][[/noparse]i]:=lat[noparse][[/noparse]i]
· i++
·B:=FMT.atoi(@buf)
·b:=b+a···························· 'B=DD.ddddd



The FP.FDIV isn't working and is hanging the code!·

A is LONG
B is LONG
Y is LONG

Help please



▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·- Was it pin 11 or 26?· Hmmm....··I think the smell of smoke tells the whole story.· Must be 26.



Michael King
Application Engineer
R&D
Digital Technology Group

Comments

  • PerryPerry Posts: 253
    edited 2008-06-09 21:05
    maybe You should be passing the address, not the value in a:=fp.fdiv(b,Y) should be a:=fp.fdiv(@b,@Y).

    check out Paul H's GoogleEarthLogger it does the same kind of arithmetic as you seem to want.


    Perry
  • Graham StablerGraham Stabler Posts: 2,507
    edited 2008-06-09 21:26
    please put code in code tags as it helps readibility.

    [noparse][[/noparse]code ]


    [noparse][[/noparse]/code ]

    (without spaces)
  • John AbshierJohn Abshier Posts: 1,116
    edited 2008-06-09 22:05
    I am not sure what object FMT is but atoi looks like ASCII to integer

    John Abshier
Sign In or Register to comment.