LookDown2 question


Closed Thread
Results 1 to 9 of 9

Hybrid View

  1. #1
    Join Date
    Jun 2005
    Location
    Wisconsin
    Posts
    382

    Default LookDown2 question

    In the first example var=1. In the second example var=0. I don't understand why the table isn't being search when I use variables. Thoughts?

    This works:

    Value=$5C
    LookDown2 Value,[$FF,$5C,$41],Var

    This doesn't:
    Zero=$FF
    First=$5C
    Second=$41

    Value=$5C
    LookDown2 Value,[Zero,First,Second],var

  2. #2
    Join Date
    Jun 2005
    Location
    Wisconsin
    Posts
    382


    Did you find this post helpful? Yes | No

    Default

    *bump*

    Sorry I really need some resolution on this issue.

  3. #3
    Join Date
    Mar 2005
    Location
    Iowa, USA
    Posts
    216


    Did you find this post helpful? Yes | No

    Post

    In your first example, var = 1 is correct, since it is the second value in the list. As for the second example, I've got to assume that var = 0 since "$5C" is not in the list and var is already 0? The manual says if the search value is not found, then var is unchanged. Have you tried setting var to a known value then run through the second example and see if it changes? Just an idea. Good luck!
    Wisdom is knowing what path to take next... Integrity is taking it.
    Ryan Miller

  4. #4
    Join Date
    Jun 2005
    Location
    Wisconsin
    Posts
    382


    Did you find this post helpful? Yes | No

    Default

    I think the issue is that you can't use a variable as a value.

    The manual reads as follows:
    "Array variables with a variable index may not be used in LOOKDOWN2 although array variables with a constant index are allowed."


    To me this means you can't do B0[1] but you can do B0. I'm I thinking wrong?

    Any help is appricated. Basically I have a list of 7 values in EEProm I need to compare to a calculated variable.
    Basically the functionality of LookDown with EEProm variable in the list.

  5. #5
    Join Date
    Mar 2005
    Location
    Iowa, USA
    Posts
    216


    Did you find this post helpful? Yes | No

    Post

    The first example in the manual uses a variable in the value list.
    LOOKDOWN2 W0,[512,W1,1024],B0
    My question is will it work if your values in the list are constants?
    Wisdom is knowing what path to take next... Integrity is taking it.
    Ryan Miller

  6. #6
    Join Date
    Jun 2005
    Location
    Wisconsin
    Posts
    382


    Did you find this post helpful? Yes | No

    Default

    I will try constants and post my results.

Similar Threads

  1. Timer0 Instant Interrupts Question
    By wmarchewka in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 14th December 2009, 05:29
  2. Lookup2 & Lookdown2
    By saladlee in forum Serial
    Replies: 1
    Last Post: - 4th February 2008, 20:41
  3. AN Question for "word" variable read The serial port
    By redfoen in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 14th December 2007, 17:39
  4. Question for a math guru
    By Christopher4187 in forum General
    Replies: 3
    Last Post: - 22nd November 2006, 09:45
  5. Please answer my first question
    By John_001 in forum Off Topic
    Replies: 1
    Last Post: - 15th September 2006, 06:49

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts