Shop OBEX P1 Docs P2 Docs Learn Events
BS2 Keyboard Code — Parallax Forums

BS2 Keyboard Code

ArchiverArchiver Posts: 46,084
edited 2002-06-26 19:18 in General Discussion
Okay, nobody bit before, so I'll rephrase the question...

Anybody got a compact routine in PBASIC for comparing 2 strings?
I need something to compare a string stored in EEPROM to see if there
is a password match. I get each character from the keypad by calling
my KeyScan routine as a subroutine.

Chris

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2002-06-24 07:39
    >Okay, nobody bit before, so I'll rephrase the question...
    >
    >Anybody got a compact routine in PBASIC for comparing 2 strings?
    >I need something to compare a string stored in EEPROM to see if there
    >is a password match. I get each character from the keypad by calling
    >my KeyScan routine as a subroutine.
    >
    >Chris


    Something like this?,,,


    i var nib
    x var byte
    char var byte
    pw data "crab7zuni" ' password in eeprom

    for i=0 to 8
    gosub keboard ' get char
    read pw+i,x ' get stored match
    if char<>x then badpass ' exact match, case sensitive
    next
    goodpass:
    ' you're in!
    ' continue
    goto top

    badpass:
    ' mismatch, try again
    goto top
  • ArchiverArchiver Posts: 46,084
    edited 2002-06-26 19:18
    --- Tracy Allen <tracy@e...> wrote:
    > Something like this?,,,
    > i var nib
    > x var byte
    > char var byte

    Yes Tracy, something like that...I printed your
    message...Will examine it more closely in a few, but
    at first glance, it seems to do what I need, given a
    single fixed-length password. Thanks.

    Chris



    __________________________________________________
    Do You Yahoo!?
    Yahoo! - Official partner of 2002 FIFA World Cup
    http://fifaworldcup.yahoo.com
Sign In or Register to comment.