How to put a string value to an array variable? And GPS issues relating.
aladas
Posts: 18
I can't find any instance of code which assigns a string, lets us say "ABCD" into an array, let us say MyString VAR Byte(5). I have got the hang of using STR with debug but so far all my experiment with assignment come up with syntax errors. I have searched on the forums and I came across one piece of advice to store a string in EEPROM. Am I being thick, or is this just out of the areas where the BS2 excels?
I am stuck on this point when what I am actually trying to do is see what my EB500 is getting from a bluetooth GPS unit.
Writing this has helped me spot a way round the immediate need for string assignment, but I still wish I knew how to do it.
But now my stuckness comes from trying to read the strings coming in from the GPS unit. The PC with hyperterminal is getting good NMEA sentences in at 9600,8,1,n and the Stamp 2 with the EB500 bluetooth can connect and can detect the GP strings I am waiting for, but after that I only get just a very few bits of what might be GPS speak.
Here is some of the debug output:
This is Connect3GSP.bs2 - for EB500
Trying to connect to 00:16:CF:E6:E4:28
EB500 connected to BT GPS
Apparently connected
.
I am stuck on this point when what I am actually trying to do is see what my EB500 is getting from a bluetooth GPS unit.
Writing this has helped me spot a way round the immediate need for string assignment, but I still wish I knew how to do it.
But now my stuckness comes from trying to read the strings coming in from the GPS unit. The PC with hyperterminal is getting good NMEA sentences in at 9600,8,1,n and the Stamp 2 with the EB500 bluetooth can connect and can detect the GP strings I am waiting for, but after that I only get just a very few bits of what might be GPS speak.
Here is some of the debug output:
This is Connect3GSP.bs2 - for EB500
Trying to connect to 00:16:CF:E6:E4:28
EB500 connected to BT GPS
Apparently connected
.
Comments
Part of your problem may be that you're trying to receive a sequence of characters at 9600 Baud and the BS2 just can't do that reliably. The best you get is about 4800 Baud or isolated characters at 9600 Baud with pauses in-between.
Drat!
So I will have to do loops though the index of my array. And use an older serial GPS which works at 4800. (Perish the thought that I might have to buy a Parallax GPS. Well, maybe later.)
In general - from what you have seen of how many different things I want to be able to do, shall I run out of variable space and/or pins, do you think? I knew I was going to need to reuse variable names in a lot of different contexts - aha, but now I have come across the concept of aliases - and pins too. If I want to go all the way would you sugest going to two BS2s or up a level or so? Or adding a pickaxe or three?
regards - A.L.
A lot depends on how quickly the device feeds characters to the Stamp. Even though the characters may be sent at 9600 Baud, if the device uses 2 stop bits or otherwise pauses a little between characters, the Stamp has a chance to do its stuff. Setting up the formatters, like DEC, is particularly problematic since this can take enough time for the Stamp to miss the next start bit and get out of sync with the data stream.
Do recheck your Baud mode constants.
This is what produced .
-Phil
-Phil
Post Edited (Phil Pilgrim (PhiPi)) : 3/19/2008 5:28:14 PM GMT
Don't necessarily bother answering this - my mind may have turned into a hamster on a wheel, but that is no reason yours should. Actually of course you obviously won't if you haven't the time or the inclination, but be aware that I do not take your help for granted.