LOOKUP2 please help


Closed Thread
Results 1 to 20 of 20

Hybrid View

  1. #1
    Join Date
    Apr 2009
    Posts
    29

    Exclamation LOOKUP2 please help

    lookup2 not counting all table. who can help?
    is there any way to devide into wo parts?
    or is there any way that count goes until sutain figure and then start counting backward?



    Freq var word
    say var byte
    countera var word


    loop:

    If PORTB.7 =0 THEN
    CounterA = 0
    Yelp3:
    Lookup2 CounterA,[902,902,902,884,884,884,851,851,835,820,820,806,80 6,792,778,765,_
    752,740,740,716,716,705,705,683,683,653,663,663,64 4,635,618,627,602,594,578,578,557,_
    564,549,531,531,519,513,501,492,475,465,465,456,44 2,434,422,414,406,389,389,373,373,_
    352,334,329,318,307,296,283,279,263,252,249,238,23 2,232,238,249,252,263,279,283,296,_
    307,318,329,334,352,373,373,389,389,406,414,422,43 4,442,456,465,465,475,492,501,_
    513,519,531,531,549,564,557,578,578,594,602,627,61 8,635,644,663,663,653,683,683,_
    705,705,716,716,740,740,752,765,778,792,806,806,82 0,820,835,851,851,884,884,884,_
    902,902,902],Freq

    For say=1 to 25
    High PORTa.0
    PauseUS Freq
    Low PORTa.0
    PauseUS Freq
    Next say
    pause 50

    if PORTB.7=0 then
    CounterA = CounterA + 1
    if Countera < 142 then goto yelp3

    endif
    ENDIF
    goto loop

  2. #2
    Join Date
    Apr 2009
    Posts
    29


    Did you find this post helpful? Yes | No

    Default anybody please help to beginner

    please give a hand

  3. #3
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    May be something like this can/could/possibly/hopefully help !


    Code:
    <font color="#000000">Loop:
    
        <font color="#000080"><b>IF </b></font>PORTB.<font color="#FF0000">7 </font>= <font color="#FF0000">0 </font><font color="#000080"><b>THEN
            </b></font>CounterA = <font color="#FF0000">0
    
            </font>Yelp3:
                <font color="#000080"><b>LOOKUP2 </b></font>CounterA,[<font color="#FF0000">902</font>,<font color="#FF0000">902</font>,<font color="#FF0000">902</font>,<font color="#FF0000">884</font>,<font color="#FF0000">884</font>,<font color="#FF0000">884</font>,<font color="#FF0000">851</font>,<font color="#FF0000">851</font>,<font color="#FF0000">835</font>,<font color="#FF0000">820</font>,<font color="#FF0000">820</font>,<font color="#FF0000">806</font>,<font color="#FF0000">806</font>,<font color="#FF0000">792</font>,<font color="#FF0000">778</font>,<font color="#FF0000">765</font>,_
                <font color="#FF0000">752</font>,<font color="#FF0000">740</font>,<font color="#FF0000">740</font>,<font color="#FF0000">716</font>,<font color="#FF0000">716</font>,<font color="#FF0000">705</font>,<font color="#FF0000">705</font>,<font color="#FF0000">683</font>,<font color="#FF0000">683</font>,<font color="#FF0000">653</font>,<font color="#FF0000">663</font>,<font color="#FF0000">663</font>,<font color="#FF0000">644</font>,<font color="#FF0000">635</font>,<font color="#FF0000">618</font>,<font color="#FF0000">627</font>,<font color="#FF0000">602</font>,<font color="#FF0000">594</font>,<font color="#FF0000">578</font>,<font color="#FF0000">578</font>,<font color="#FF0000">557</font>,_
                <font color="#FF0000">564</font>,<font color="#FF0000">549</font>,<font color="#FF0000">531</font>,<font color="#FF0000">531</font>,<font color="#FF0000">519</font>,<font color="#FF0000">513</font>,<font color="#FF0000">501</font>,<font color="#FF0000">492</font>,<font color="#FF0000">475</font>,<font color="#FF0000">465</font>,<font color="#FF0000">465</font>,<font color="#FF0000">456</font>,<font color="#FF0000">442</font>,<font color="#FF0000">434</font>,<font color="#FF0000">422</font>,<font color="#FF0000">414</font>,<font color="#FF0000">406</font>,<font color="#FF0000">389</font>,<font color="#FF0000">389</font>,<font color="#FF0000">373</font>,<font color="#FF0000">373</font>,_
                <font color="#FF0000">352</font>,<font color="#FF0000">334</font>,<font color="#FF0000">329</font>,<font color="#FF0000">318</font>,<font color="#FF0000">307</font>,<font color="#FF0000">296</font>,<font color="#FF0000">283</font>,<font color="#FF0000">279</font>,<font color="#FF0000">263</font>,<font color="#FF0000">252</font>,<font color="#FF0000">249</font>,<font color="#FF0000">238</font>,<font color="#FF0000">232</font>,<font color="#FF0000">232</font>,<font color="#FF0000">238</font>,<font color="#FF0000">249</font>,<font color="#FF0000">252</font>,<font color="#FF0000">263</font>,<font color="#FF0000">279</font>,<font color="#FF0000">283</font>,<font color="#FF0000">296</font>,_
                <font color="#FF0000">307</font>,<font color="#FF0000">318</font>,<font color="#FF0000">329</font>,<font color="#FF0000">334</font>,<font color="#FF0000">352</font>,<font color="#FF0000">373</font>,<font color="#FF0000">373</font>,<font color="#FF0000">389</font>,<font color="#FF0000">389</font>,<font color="#FF0000">406</font>,<font color="#FF0000">414</font>,<font color="#FF0000">422</font>,<font color="#FF0000">434</font>,<font color="#FF0000">442</font>,<font color="#FF0000">456</font>,<font color="#FF0000">465</font>,<font color="#FF0000">465</font>,<font color="#FF0000">475</font>,<font color="#FF0000">492</font>,<font color="#FF0000">501</font>,_
                <font color="#FF0000">513</font>,<font color="#FF0000">519</font>,<font color="#FF0000">531</font>,<font color="#FF0000">531</font>,<font color="#FF0000">549</font>,<font color="#FF0000">564</font>,<font color="#FF0000">557</font>,<font color="#FF0000">578</font>,<font color="#FF0000">578</font>,<font color="#FF0000">594</font>,<font color="#FF0000">602</font>,<font color="#FF0000">627</font>,<font color="#FF0000">618</font>,<font color="#FF0000">635</font>,<font color="#FF0000">644</font>,<font color="#FF0000">663</font>,<font color="#FF0000">663</font>,<font color="#FF0000">653</font>,<font color="#FF0000">683</font>,<font color="#FF0000">683</font>,_
                <font color="#FF0000">705</font>,<font color="#FF0000">705</font>,<font color="#FF0000">716</font>,<font color="#FF0000">716</font>,<font color="#FF0000">740</font>,<font color="#FF0000">740</font>,<font color="#FF0000">752</font>,<font color="#FF0000">765</font>,<font color="#FF0000">778</font>,<font color="#FF0000">792</font>,<font color="#FF0000">806</font>,<font color="#FF0000">806</font>,<font color="#FF0000">820</font>,<font color="#FF0000">820</font>,<font color="#FF0000">835</font>,<font color="#FF0000">851</font>,<font color="#FF0000">851</font>,<font color="#FF0000">884</font>,<font color="#FF0000">884</font>,<font color="#FF0000">884</font>,_
                <font color="#FF0000">902</font>,<font color="#FF0000">902</font>,<font color="#FF0000">902</font>],Freq
                
                <font color="#000080"><b>FOR </b></font>Say = <font color="#FF0000">1 </font><font color="#000080"><b>TO </b></font><font color="#FF0000">25
                    </font><font color="#000080"><b>HIGH </b></font>PORTA.<font color="#FF0000">0
                    </font><font color="#000080"><b>PAUSEUS </b></font>Freq
                    <font color="#000080"><b>LOW </b></font>PORTA.<font color="#FF0000">0
                    </font><font color="#000080"><b>PAUSEUS </b></font>Freq
                <font color="#000080"><b>NEXT </b></font>Say
               
                <font color="#000080"><b>PAUSE </b></font><font color="#FF0000">50
                
                </font>CounterA = CounterA + <font color="#FF0000">1
                </font><font color="#000080"><b>IF </b></font>Countera &lt; <font color="#FF0000">142 </font><font color="#000080"><b>THEN </b></font>Yelp3
    
        <font color="#000080"><b>ENDIF
    
    
    GOTO </b></font>Loop
    
    
    <font color="#000080"><b>END
    
    </b></font>
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  4. #4
    Join Date
    Apr 2009
    Posts
    29


    Did you find this post helpful? Yes | No

    Default tried not working

    Tried this one not working

  5. #5
    Join Date
    Apr 2009
    Posts
    29


    Did you find this post helpful? Yes | No

    Default 2 parts

    is there any way to devide one table into two parts and count one part and then the second one?

  6. #6
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by emilhs View Post
    is there any way to divide into two parts?
    Or is there any way that count goes until certain figure and then start counting backward?
    In the short answer Yes sort of.
    something like
    Code:
    repeat
    counterA = counterA + 1
    LOOKUP2 CounterA,[902,902,902,884,884,884,851,851,835,820,820,806,806,792,778,765,_
                752,740,740,716,716,705,705,683,683,653,663,663,644,635,618,627,602,594,578,578,557,_
                564,549,531,531,519,513,501,492,475,465,465,456,442,434,422,414,406,389,389,373,373,_
                352,334,329,318,307,296,283,279,263,252,249,238,232,232,238,249,252,263,279,283,296,_
                307,318,329,334,352,373,373,389,389,406,414,422,434,442,456,465,465,475,492,501,_
                513,519,531,531,549,564,557,578,578,594,602,627,618,635,644,663,663,653,683,683,_
                705,705,716,716,740,740,752,765,778,792,806,806,820,820,835,851,851,884,884,884,_
                902,902,902],Freq
    until counterA = 75
    repeat
    counterA = counterA - 1
    LOOKUP2 CounterA,[902,902,902,884,884,884,851,851,835,820,820,806,806,792,778,765,_
                752,740,740,716,716,705,705,683,683,653,663,663,644,635,618,627,602,594,578,578,557,_
                564,549,531,531,519,513,501,492,475,465,465,456,442,434,422,414,406,389,389,373,373,_
                352,334,329,318,307,296,283,279,263,252,249,238,232,232,238,249,252,263,279,283,296,_
                307,318,329,334,352,373,373,389,389,406,414,422,434,442,456,465,465,475,492,501,_
                513,519,531,531,549,564,557,578,578,594,602,627,618,635,644,663,663,653,683,683,_
                705,705,716,716,740,740,752,765,778,792,806,806,820,820,835,851,851,884,884,884,_
                902,902,902],Freq
    until countera = 0
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  7. #7
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by emilhs View Post
    lookup2 not counting all table. who can help?
    The limitation of 85 values only applies to the LOOKUP2 statement.

    The plain old LOOKUP can have up to 255.

    Remove the 2, and your there.
    <br>
    DT

  8. #8
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor View Post
    The limitation of 85 values only applies to the LOOKUP2 statement.

    The plain old LOOKUP can have up to 255.

    Remove the 2, and you're there.
    <br>
    I didn't know about that limitation Darrel, Thank You.
    EDIT: it's in the book alright! It also takes up 3 times the space as lookup.
    Last edited by Archangel; - 8th May 2009 at 01:00.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  9. #9
    Join Date
    Apr 2009
    Posts
    29


    Did you find this post helpful? Yes | No

    Default thank you

    in my table only 142 figures.
    I have to use one of pic18cXX controllers

  10. #10
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    You don't need an 18?.

    The LOOKUP statement .. NOT the LOOKUP2, will do exactly what you want, even if it's a 12F.
    <br>
    DT

  11. #11
    Join Date
    Apr 2009
    Posts
    29


    Did you find this post helpful? Yes | No

    Default I will try

    but at the moment I use 16f84

Similar Threads

  1. need help! to beginner
    By emilhs in forum mel PIC BASIC Pro
    Replies: 27
    Last Post: - 6th May 2009, 18:44
  2. Kind of "customisable" LOOKUP(2), possible?
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 5th May 2009, 19:45
  3. lookup2?
    By jonas2 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 28th February 2009, 12:26
  4. Lookup2 & Lookdown2
    By saladlee in forum Serial
    Replies: 1
    Last Post: - 4th February 2008, 20:41
  5. PIC 16F84A and 7segment LED dispay
    By select in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 21st November 2007, 21:01

Members who have read this thread : 0

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