Shop OBEX P1 Docs P2 Docs Learn Events
Table Sequencer to LED — Parallax Forums

Table Sequencer to LED

bennettdanbennettdan Posts: 614
edited 2011-05-27 01:34 in Propeller 1
Hello,
I have written a LED sequencer in pasm that I would like to know if their are any shortcuts or any advice that could be used to optomise this?
This is mainly to get a grasp on how to cycle through a LookUp table and control an led with it. Thanks for any info.

Comments

  • kuronekokuroneko Posts: 3,623
    edited 2011-05-26 19:25
    It doesn't actually do anything (visible) on a demoboard. Are you sure you attached the right version?
  • bennettdanbennettdan Posts: 614
    edited 2011-05-26 19:56
    kuroneko,
    Sorry about that i was having some trouble uploading and I hope that I just uploaded the wrong one...I have uploaded it again.
  • kuronekokuroneko Posts: 3,623
    edited 2011-05-26 20:02
    That looks better, however, you should put the LoopCount initialisation between setup and LEDLoop otherwise the djnz will take a walk.
  • bennettdanbennettdan Posts: 614
    edited 2011-05-26 20:08
    kuroneko,
    I though I had that changed in the one i just uploaded it..was it only sequencing one loop for you?
  • kuronekokuroneko Posts: 3,623
    edited 2011-05-26 20:13
    More than that, first time it goes from 7 to 0, next from $FFFFFFFF to 0 because the loop counter is only initialised right at the start of your code (and the primary loop cycles at Setup).
  • bennettdanbennettdan Posts: 614
    edited 2011-05-26 20:23
  • kuronekokuroneko Posts: 3,623
    edited 2011-05-26 20:30
    Cool, that's working as intended (I hope) :)

    Any particular reason why you picked 7 when you have 8 entries? Also, why do you use movs to grab the LED pattern? Someone may want more than 9bit ... just thinking aloud ...
  • bennettdanbennettdan Posts: 614
    edited 2011-05-26 20:37
    I started with only 7 but started adding more then stopped but I will be adding more in the future program this is just some stepping stone code to a larger program. the Movs was in some code examples i found online, what would you suggest if you want more just a mov ?
  • kuronekokuroneko Posts: 3,623
    edited 2011-05-26 20:43
    bennettdan wrote: »
    ... the Movs was in some code examples i found online, what would you suggest if you want more just a mov ?
    Sure. You have a long table so you might as well grab all of it. Which LEDs finally light up is controlled by dira so no harm done.

    Just noticed your comment regarding ch. If you set it to the maximum entry then the sequence starts there but doesn't wrap. Also, if offset start isn't important you might want to consider this version:
    Setup
                            MOVS         look_up,    #table                   '<- points to look up table
                            MOV        LoopCount,    NumberOfLoopsToRun
    LEDLoop     
    look_up                 MOV         LEDsetup,    0-0
                            ADD          look_up,    #1
    
  • bennettdanbennettdan Posts: 614
    edited 2011-05-27 01:34
    kuroneko,
    The ch offset is going to be used in the final code but it will never be more then 50% so i think it should be fine. Thanks again I will try your example out and if might come in handy later.
Sign In or Register to comment.