Shop OBEX P1 Docs P2 Docs Learn Events
Driver for Radio Shack tricolor LED Strip - Page 2 — Parallax Forums

Driver for Radio Shack tricolor LED Strip

2»

Comments

  • PublisonPublison Posts: 12,366
    edited 2014-06-07 07:48
    NWCCTV wrote: »
    12V DC @ 1Amp. Connected correctly. I have tried Pins 14, 15 and 16, 17. When connected to 16 or 17 running only 5V, the whole strip will light up and run the sequence but only in red. When connected to 14 or 15 running 12V, I only get the first 9 and that is only if I toggle h power switch as I indicated before. I am going o dig up another Prop board and see if that is the problem.

    I just revisited this project, and I could not get the either of my two strips to work on an Activity Board, or Propeller BOE. Looking at the signal output on P14-P19, it's not reaching 3 volts. This is due to the 3.9K resistors inline with those pins. Once I change to P0, it worked fine.

    I can't understand why it worked before on P16. ?

    May want to give this a try Andy.
  • NWCCTVNWCCTV Posts: 3,629
    edited 2014-06-07 17:16
    I will give it a try later this evening. Thanks for the info.
  • NWCCTVNWCCTV Posts: 3,629
    edited 2014-06-11 15:40
    And that worked!!!
  • NWCCTVNWCCTV Posts: 3,629
    edited 2014-06-12 22:00
    So what needs to be done to the tm1803_demo program to just have the RGB LED's flash as they do when the program first runs, without going through each individual color?
  • ke4pjwke4pjw Posts: 1,155
    edited 2015-01-26 18:41
    I think I have found a bug in this code. The Red and Blue appear to be swapped when used with my 276-0249 strip.

    I need to grok what is happening here and will post a fix.

    --Terry


    ' Shifts long in colorbits to TM1803 chain
    '
    ' This routine manipulates the value in colorbits so that elements are
    ' transmitted GRB as required by the TM1803. Rearrange-on-the-fly code
    ' trick by TonyP12 in the Propeller forum.
    '
    ' Entry $00_RR_GG_BB
    ' Step 1 $BB_00_RR_GG
    ' Step 2-24 $GG_BB_00_RR - when nbits == 24
    ' $BB_00_RR_GG - after sending GG
    ' Step 2-16 $RR_GG_BB_00 - when nbits == 16
    ' $GG_BB_00_RR - after sending RR
    ' Step 2-8 $BB_00_RR_GG - when nbits == 8

    shiftout ror colorbits, #8 ' {1} to offset the rol 24 below
    mov nbits, #24 ' shift 24 bits (3 x 8)

    :loop test nbits, #%111 wz ' {2} nbits at 24, 16 or 8?
    if_z rol colorbits, nbits ' if yes, modify colorbits
    rol colorbits, #1 wc ' msb --> C
    if_c mov bittimer, bit1hi ' set bit timing
    if_nc mov bittimer, bit0hi
    or outa, txmask ' tx line 1
    add bittimer, cnt ' sync bit timer
    if_c waitcnt bittimer, bit1lo
    if_nc waitcnt bittimer, bit0lo
    andn outa, txmask ' tx line 0
    waitcnt bittimer, #0 ' hold while low
    djnz nbits, #:loop ' next bit

    djnz nleds, #frameloop ' done with all leds?

    jmp #rgbmain ' back to top
  • JonnyMacJonnyMac Posts: 9,105
    edited 2015-01-26 19:11
    This is brute force and brutally easy -- I use this in my WS2801 driver.
    ' swap red and blue channels
                            ' -- swaps only if xrb <> 0
    
    swaprb                  tjz     xrb, #shiftout                  ' skip if swap flag is 0    
    
                            mov     t2, t1                          ' copy original
                            and     t1, HX_00_FF_00                 ' isolate green     
                            and     t2, HX_FF_00_FF                 ' isolate red and blue
                            rol     t2, #16                         ' swap red and blue
                            or      t1, t2                          ' re-mix
    
  • ke4pjwke4pjw Posts: 1,155
    edited 2015-01-26 20:18
    Thanks Jon. Almost working. Green is correct. Red is pinkish and blue as a shade of violet. Not sure where the issue is yet. Here is what I added:
    ' Shifts long in colorbits to WS2812 chain
    '
    '  WS2812 Timing (slot is 1.25us for 800kHz)
    '
    '  0   &#61569;&#61570;&#61574;&#61573;&#61569;&#61569;&#61569;&#61569;&#61570;   0.35us / 0.80us
    '  1   &#61569;&#61570;&#61574;&#61574;&#61574;&#61573;&#61569;&#61569;&#61570;   0.70us / 0.60us
    '
    '  At least 50us (reset) between frames
    '
    '  This routine manipulates the value in colorbits so that elements are
    '  transmitted GRB as required by the WS2812. Rearrange-on-the-fly code
    '  trick by TonyP12 in the Propeller forum.  
    '
    '  Entry      $00_RR_GG_BB
    '  Step 1     $BB_00_RR_GG
    '  Step 2-24  $GG_BB_00_RR - when nbits == 24
    '             $BB_00_RR_GG - after sending GG
    '  Step 2-16  $RR_GG_BB_00 - when nbits == 16
    '             $GG_BB_00_RR - after sending RR
    '  Step 2-8   $BB_00_RR_GG - when nbits == 8
    
    
    shiftout
                            mov     t3, colorbits                          ' copy original
                            and     colorbits, HX_00_FF_00                 ' isolate green     
                            and     t3, HX_FF_00_FF                 ' isolate red and blue
                            rol     t3, #16                         ' swap red and blue
                            or      colorbits, t3 
    
                            ror     colorbits, #8                   ' {1} to offset the rol 24 below
                            mov     nbits, #24                      ' shift 24 bits (3 x 8) 
    ..........
    
    
    
    
    t3                      long    $0000_0000
    
    HX_00_FF_00             long    $0000_FF00
    HX_FF_00_FF             long    $00FF_00FF
    
Sign In or Register to comment.