PDA

View Full Version : Problems with Definitions



Andreas
07-24-2005, 04:06 PM
I have a stringvalue that I save in "SerString1" (Se below):

pw·VAR WORD
SerString1 VAR Byte(6)
SerString1(9)=0
SERIN Port,Baud,Main,2000,Main, [WAIT ("coord"), STR SerString1\5\"*", STR SerString2\5\"*", STR SerString3\5\"*"]

My question is, how can I put the whole value thats saved in "Serstring1" and put it into a "WORD" defined constant for example pw? See below


"SEROUT 15, ServoBaud+$8000,["!SC", 11, 0, pw.LOWBYTE, pw.HIGHBYTE,CR]"

I have tried almost everything but nothing seems to·be working.
I have tried·pw.HIGHBYTE = SerString1(0) but only the first Byte are shown. I need all bytes.

See my code if it helps
Please help me

Andreas

Bruce Bates
07-24-2005, 04:50 PM
Andreas -

Any of the text strings that you have defined (SerString1, SerString2, or SerString3) are at least 7 bytes long (SerString1 VAR Byte(6) yields SerString(0) through SerString(6) inclusive; thus 7 bytes), per your explicit definiton. Perhaps this is where the problem begins, it's yet hard to say. I'm having a problem getting by the logic of what you're trying to accomplish.

How would you propose to stuff 7 bytes (any of the fields SerStringN) into a variable defined as 2 bytes long (pw var word), regardless of how it's actually done?

If you can answer that question, I can probably answer your question. Sorry, I don't read or understand the cryptic Visual Basic, otherwise I'd have tried to seek my own answers in your main program.

Here is another answer to your quandry, but it may not be appealing to you. It would seem that this data (regardless of what it actually is) is being created in the Visual Basic program. If it's not in a form you like, want, or can use for processing at the PBasic Stamp end, why not change it to something that can be utilized easily?

Type: numeric numeric numeric numeric num num alpha-num
Ex. of revised data: nnnn1, nnnn2, nnnn3, nnn4, nn5, nn6, txt1, etc.

Regards,

Bruce Bates

Chris Savage
07-25-2005, 12:36 AM
Hello,

·· As per Bruce's explanation, the largest value you're going to stuff into a Word variable will be 5 digits, and cannot be over 65535.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com (mailto:csavage@parallax.com)