Shop OBEX P1 Docs P2 Docs Learn Events
Better Data comparison perhaps? — Parallax Forums

Better Data comparison perhaps?

Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
edited 2008-09-14 12:33 in Propeller 1
I've become a bit stumped over a simple data comparison I'm working on for a passcode demo.

Code looks something like this...
relevant portion shown..

 repeat

    if key == 16384
      text.str(string("A"))
      code := code + "A"

    if key == 32768
      text.str(string("B"))
      code := code + "B"

    if code == combination
      outa[noparse][[/noparse]8]:=0  '' Turn off P8 showing deactivaed.
      
    waitcnt(12_000_000 + cnt)

         
DAT

combination  byte  "BA",0




For some reason my comparison sees the B entered first and thinks it's a complete match.
What am I not seeing?

Thanks
OBC

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
New to the Propeller?

Getting started with a Propeller Protoboard?
Check out: Introduction to the Proboard & Propeller Cookbook 1.4
Updates to the Cookbook are now posted to: Propeller.warrantyvoid.us
Got an SD card connected? - PropDOS

Comments

  • TimmooreTimmoore Posts: 1,031
    edited 2008-09-13 21:13
    I think combination is defined as a byte so accessed as a byte so doesn't look at A, dont you want

    code == word[noparse][[/noparse]@combination]
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2008-09-13 21:20
    Duh! Thanks.. Just had to switch my brain back on..

    Solved it mathematically instead, but I see the error of my original method.

    Thanks!
    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Getting started with a Propeller Protoboard?
    Check out: Introduction to the Proboard & Propeller Cookbook 1.4
    Updates to the Cookbook are now posted to: Propeller.warrantyvoid.us
    Got an SD card connected? - PropDOS
  • WhitWhit Posts: 4,191
    edited 2008-09-14 12:33
    Good job Timmoore!

    As one of my college profs used to say, "Unfortunately computers do exacly what you tell them to do." wink.gif
    OBC, Glad you got it firgured out.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Whit+


    "We keep moving forward, opening new doors, and doing new things, because we're curious and curiosity keeps leading us down new paths." - Walt Disney
Sign In or Register to comment.