Shop OBEX P1 Docs P2 Docs Learn Events
How do I use a string stored in a 8 byte array to... — Parallax Forums

How do I use a string stored in a 8 byte array to...

denodeno Posts: 242
edited 2005-07-25 16:05 in BASIC Stamp
to make a comparison.· Suppose I have the string FORWARD_· already stored·in a 8 byte array called keyboard_data.· Now I want to retreive that whole string to make a comparison:

IF (8 byte array...keyboard_data) =·"forward_" then
· GOSUB robo_forward
ENDIF

I have the string in the array in eeprom, but I can't figure out how to get it out in one piece to make the above comparison.

I am trying to use the ezKEYER from Multilabs to control "robo child".

Deno

Comments

  • YanroyYanroy Posts: 96
    edited 2005-07-25 16:05
    As far as I know, there isn't any way to do it all at once.· You have to check each byte individually.· Here's some pseudocode which assumes you have two arrays that you want to compare between (I know this isn't exactly your situation, but I assume you can figure out how to replace the second array with reading the appropriate character from eeprom or however you wish to store it).

    for n = 0 to 8

    if keyboard_data(n) <> comparison_string(n) then goto no_match

    next

    ' if execution reaches here, the strings are the same

    no_match:

    ' if this label is jumped to, the strings aren't the same
Sign In or Register to comment.