has anyone ever used mega-brites


Closed Thread
Results 1 to 3 of 3
  1. #1

    Default has anyone ever used mega-brites

    Here is what I am trying to drive:

    http://docs.macetech.com/doku.php/megabrite

    I can't say that I completely get their arduino code snip in their sample ( for example, what the heck is going on in the while loops in the SB_SendPacket() function? ).

    Anyhow, the code below "seems to work" but I am not completely convinced that I have the bit mixing correct. So on the chance that somebody had tried these devices before I thought I would post this for some other eyes to look it over.


    Code:
    
    ' simple looping driver
    
    Main:
      DO
        FOR RLED = 1 TO 1000 STEP 30
          FOR BLED = 1 TO 1000 STEP 20
            FOR GLED = 1 TO 1000 STEP 10
              GOSUB RGB_LED
              PAUSE 1
            NEXT
          NEXT
        NEXT
    
        FOR GLED = 1000 TO 1 STEP -10
          FOR BLED = 1000 TO 1 STEP -20
            FOR RLED = 1000 TO 1 STEP -30
              GOSUB RGB_LED
              PAUSE 1
            NEXT
          NEXT
        NEXT
    
      LOOP
    END
    
    ' my attempt at bit mixing
    
    RGB_LED:
      LO_WORD = 0
      HI_WORD = 0
    
      ' 10bits G  10bits R  10bits B then two zeros
      '
      HI_WORD = ( ( BLED << 2 ) & $FFFC ) | ( ( RLED << 10 ) & $FC00 )
      LO_WORD =  RLED >> 6 | ( ( GLED << 6 ) & $FFC0 )
    
      SHIFTOUT DataPin, ClockPin, LSBFIRST, [HI_WORD]  ' send the bits
      SHIFTOUT DataPin, ClockPin, LSBFIRST, [LO_WORD]  ' send the bits
    
      HIGH  LatchPin
      PAUSE 1
      LOW   LatchPin
    RETURN
    Thanks, in advance, to anyone that may have some help for me here.

    For more ideas on what can be done with these things, see:

    http://mbed.org/users/4180_1/notebook/shiftbrite1/

  2. #2
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    949


    Did you find this post helpful? Yes | No

    Default Re: has anyone ever used mega-brites

    Quote Originally Posted by TinkersALotV2 View Post
    I can't say that I completely get their arduino code snip in their sample ( for example, what the heck is going on in the while loops in the SB_SendPacket() function? ).
    The while loops in Sb_SendPacket wait for the SPI engine to complete the transmission. That is when the SPIF bit gets set in the SPSR register.

  3. #3


    Did you find this post helpful? Yes | No

    Default Re: has anyone ever used mega-brites

    Quote Originally Posted by Jerson View Post
    The while loops in Sb_SendPacket wait for the SPI engine to complete the transmission. That is when the SPIF bit gets set in the SPSR register.
    Okay. Thanks for that. I will refer to their sample again with that new information in mind -- particularly what kicks off the SPI -- as I recall maybe it is the assignment of their mixed bits into another "special variable"

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