PDA

View Full Version : oddity



s2jesse
03-25-2009, 07:37 AM
am i having a brain fart? or what is the deal here..


· REPEAT 3
··· templat:=gps.latitude
··· waitcnt(80_000_000 + cnt)

· REPEAT·
··· gr.clear····
··· gr.text(50, 95,templat)
··· gr.copy(@__Screen)



ok first repeat loop is just setting a var template a couple times to the gps latitude string. im just testing and looping it 3 times to make sure it had time to grab it.

now after the 3rd loop the variable should be set to whatever gps.latitude was.

now in my second loop which just draws the value of templat to the screen should just simply·show the last value passed to templat in the earlier loop.. however its not. The display is·constnatly changing...· as if i was reading gps.latitude there.

again total brain fart? or am i missing something more complicated


fyi im using the gps io mini object which is working fine . gps.latitude just returns lat in a string
·

mctrivia
03-25-2009, 07:51 AM
strings are pointers so you are setting template to a pointer to the value of gps.latitude


since it is a pointer and not the actual value if gps.latitude changes so will the value associated with the pointer.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Need to make your prop design easier or secure? Get a PropMod (http://propmodule.com) has crystal, eeprom, and programing header in a 40 pin dip 0.7" pitch module with uSD reader, and RTC options.

s2jesse
03-25-2009, 08:00 AM
ahh i see
would i then just have to make an array of bytes and then a loop to fill and read it?

Post Edited (s2jesse) : 3/25/2009 12:05:41 AM GMT

mctrivia
03-25-2009, 08:03 AM
yes an array of bytes with a function to copy the bites would do the job to copy your string. you can stop copying when you hit a 0

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Need to make your prop design easier or secure? Get a PropMod (http://propmodule.com) has crystal, eeprom, and programing header in a 40 pin dip 0.7" pitch module with uSD reader, and RTC options.