View Full Version : Lookup - question on proper use.

Thomas Taylor
10-28-2011, 08:56 PM
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


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

10-28-2011, 09:46 PM
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:

patterns word %1100110011001100, %1010101010101010, ....

Then you'd simply say:

repeat Index from 0 to 1

Thomas Taylor
10-30-2011, 08:41 PM
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.