Shop OBEX P1 Docs P2 Docs Learn Events
plx-daq able to post text using variables? — Parallax Forums

plx-daq able to post text using variables?

jhtoolman2000jhtoolman2000 Posts: 9
edited 2007-07-24 02:42 in BASIC Stamp
hello all,
using the plx-daq and not sure if i can do this--want to be able to read serial code·(11101010) or something like that from bs2sx and then based on the serial code, use a lookup tabel to find a name of someone that matches that code and then send that to a cell in the plx-daq.· Not sure if i can use text as a variable.· for example:

chad var word
chad con 1001

start:
if in8 = 1001 then jump

jump:
LOOKUP index, [noparse][[/noparse]"chad","john","mike"], result
SEROUT 16,240,[noparse][[/noparse]CELL, SET,C4,result,CR]
goto start

or something like this.· want to be able to crossreference the code to a name and then post name to·a cell.· Or can i do this at all?· hope this makes sense.· thanks to all in advance.

jon

Comments

  • Martin HebelMartin Hebel Posts: 1,239
    edited 2007-07-23 23:40
    Hi Jon,

    Got your Email, but was in Chicago this weekend so haven't gotten around to answering.

    Strings get tricky and the indexing is based on the number of bytes.· While not as elegant, you would probably be better off using·a SELECT CASE structure to decide which name to send to the spreadsheet and have it hardcoded in the CASE.

    -Martin



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    StampPlot - GUI and Plotting, and XBee Wireless Adapters
    Southern Illinois University Carbondale, Electronic Systems Technologies
  • jhtoolman2000jhtoolman2000 Posts: 9
    edited 2007-07-24 01:31
    martin-
    some how i knew you would have an answer.· Perhaps you could expand on that a little more when you have time.· my work email or here would be fine.· thanks again for all the help.

    jon
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2007-07-24 02:42
    ·
     
       [b]SELECT[/b] [i]value              ' base choice on values of the binary code read[/i]
         [b]CASE[/b] [i]%11111110                           ' if this value[/i]
           SEROUT 16,240,[noparse][[/noparse]"CELL,SET,C4,Mike",CR]   ' perform this (and more code if needed)
         [b]CASE[/b] [i]%11111101                           ' if this value[/i]
           SEROUT 16,240,[noparse][[/noparse]"CELL,SET,C4,Joe",CR]    ' perform this
         [b]CASE ELSE[/b]                                ' if none of the above
           SEROUT 16,240,[noparse][[/noparse]"CELL,SET,C4,Fred",CR]   ' perform this                          
       [b]ENDSELECT[/b] 
    

    Use the help files and look up SELECT CASE for more info.

    Also, in your code, I notice you check IN8 = 0101110101 or such.· First, IN8 is a single bit, so it can never be anythign other than 1 or 0.·2nd, if you use a binary value, you need to preceed it with %.

    If you ever want to take a drive down with your setup, we could probably sit in the lab and get some code straightened out.

    -Martin


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    StampPlot - GUI and Plotting, and XBee Wireless Adapters
    Southern Illinois University Carbondale, Electronic Systems Technologies
Sign In or Register to comment.