Shop OBEX P1 Docs P2 Docs Learn Events
Lookup - question on proper use. — Parallax Forums

Lookup - question on proper use.

Thomas TaylorThomas Taylor Posts: 27
edited 2011-10-30 13:41 in Propeller 1
I am trying to learn how to make tables for displaying lots of patterns in a bank of 16 LEDs.
In trying to follow the example in the Propeller manual (pages 138-139) I have written the following code, but it does not produce any output in my LEDs [0..15].
Can anyone spot what I am doing wrong? Is there a way to handle LOTS of data in a better table? I need to output 16 bits at a time.
Thanks in advance. Tom

PUB Setup

    dira[0..15]~~
    outa[0..15]~


PUB List  |  Index, Temp
         repeat Index from 1 to 2
            Temp := lookup(Index: %1100110011001100, %1010101010101010)
             outa[0..15] := Temp
             waitcnt(clkfreq *2 + cnt)   

Comments

  • MagIO2MagIO2 Posts: 2,243
    edited 2011-10-28 14:46
    Do you have a main function which first calls Setup and then List? Do you start a function in a new COG?

    Defining your bitpatterns in a DAT section would also work:
    DAT
    patterns word %1100110011001100, %1010101010101010, ....
    

    Then you'd simply say:
      repeat Index from 0 to 1
        outa[0..15]:=patterns[Index]
        waitcnt(...
    
  • Thomas TaylorThomas Taylor Posts: 27
    edited 2011-10-30 13:41
    Thanks, MagIO2, for your help and quick reply.

    I like the DAT concept better than using LOOKUP and found your kind suggestion to work just fine!

    Take care - Tom.
Sign In or Register to comment.