Shop OBEX P1 Docs P2 Docs Learn Events
How to use the LOOKDOWN command? — Parallax Forums

How to use the LOOKDOWN command?

ArchiverArchiver Posts: 46,084
edited 2003-10-12 04:23 in General Discussion
my question is in the sample program below i want to know how to
change all the constants in the beginning x1,x2,x3,etc... into a
lookdown command to be used with the lookup command which is already
in the code...

'{$STAMP BS2}
TB_POS VAR BYTE
X VAR WORD
x0 CON 650
x1 CON 660
x2 CON 670
x3 CON 680
x4 CON 690
x5 CON 700
x6 CON 710
x7 CON 720
x8 CON 730
x9 CON 740
x10 CON 750
x11 CON 760
x12 CON 780
x13 CON 790

MAIN:

LOOKUP TB_POS MIN 2 MAX 15 -2
[noparse][[/noparse]X0,X1,X2,X3,X4,X5,X6,X7,X8,X9,X10,X11,X12,X13],X

PULSOUT 12,X

GOTO MAIN



*** as you see i already have the lookup command set in there , ive
tried to do it my self but i couldnt figure out which variables
needed to be defined with there location inside the lookdown
command...

Sean...

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2003-10-12 04:23
    LOOKDOWN returns the (0-based) index of a value from a table. Is that
    what you're wanting? If so, what is the control variable (that is
    compared with the table entries). Also, LOOKDOWN allows an optional
    comparison operator, so you can look for the first value that is greater
    than the control variable (for example).

    What -- specifically -- are you trying to accomplish?

    -- Jon Williams
    -- Applications Engineer, Parallax
    -- Dallas Office


    Original Message
    From: djrevolution99 [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=ByUG-AQTFC8FeRxdi2mesS_OfKay206IsIhEzESiY1YSz_AkPfVo7x755F5JdlE2qfejc1IdAVMr86rGwEg]djrevolution99@y...[/url
    Sent: Saturday, October 11, 2003 10:21 PM
    To: basicstamps@yahoogroups.com
    Subject: [noparse][[/noparse]basicstamps] How to use the LOOKDOWN command?


    my question is in the sample program below i want to know how to
    change all the constants in the beginning x1,x2,x3,etc... into a
    lookdown command to be used with the lookup command which is already
    in the code...

    '{$STAMP BS2}
    TB_POS VAR BYTE
    X VAR WORD
    x0 CON 650
    x1 CON 660
    x2 CON 670
    x3 CON 680
    x4 CON 690
    x5 CON 700
    x6 CON 710
    x7 CON 720
    x8 CON 730
    x9 CON 740
    x10 CON 750
    x11 CON 760
    x12 CON 780
    x13 CON 790

    MAIN:

    LOOKUP TB_POS MIN 2 MAX 15 -2
    [noparse][[/noparse]X0,X1,X2,X3,X4,X5,X6,X7,X8,X9,X10,X11,X12,X13],X

    PULSOUT 12,X

    GOTO MAIN



    *** as you see i already have the lookup command set in there , ive
    tried to do it my self but i couldnt figure out which variables
    needed to be defined with there location inside the lookdown
    command...

    Sean...



    To UNSUBSCRIBE, just send mail to:
    basicstamps-unsubscribe@yahoogroups.com
    from the same email address that you subscribed. Text in the Subject
    and Body of the message will be ignored.


    Your use of Yahoo! Groups is subject to
    http://docs.yahoo.com/info/terms/




    This message has been scanned by WebShield. Please report SPAM to
    abuse@p....
Sign In or Register to comment.