Making a flying star effect with LEDs


Closed Thread
Results 1 to 23 of 23

Hybrid View

  1. #1
    Join Date
    May 2009
    Location
    Montreal, QC, Canada
    Posts
    118


    Did you find this post helpful? Yes | No

    Default Re: Making a flying star effect with LEDs

    I was looking at MIBAM but then moved away due to its limitations:
    @ 4Mhz, you can only run 4 LEDs MAX. This can be useful for RGB LED's on small chips.
    @ 20Mhz, you can run 20 LEDs since there are more instructions available per period.
    @ 48Mhz, you can run 48 LEDs, and anywhere in-between you can have the equivelant number of LEDs to match the OSC frequency.
    If you attempt to use too many LEDs for a specific OSC frequency, the program will give a warning to indicate the results will be "Blinky".
    I am planing to use 64 LEDs (maybe more) and I am trying to keep the components to minimal.

    I haven't figured out if the above limitations apply to MIBAM or BAM. I am still searching for a good BAM explanation.

    Mike

  2. #2
    Join Date
    May 2009
    Location
    Montreal, QC, Canada
    Posts
    118


    Did you find this post helpful? Yes | No

    Default Re: Making a flying star effect with LEDs

    I think I am starting to understand BAM and I am not sure this applies to what I need to do.
    Fist I should specify, I indicated in the subject "flying star" as the french that I am but "Shooting star" is more appropriate.
    I don't really need to dim any LEDs although it might give an extra quality effect, I only need to turn on and off each LED independently within 64+ LEDs and I was able to do this one by one but failed to have more than one row of LEDs on at the same time.



    Mike

  3. #3
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default Re: Making a flying star effect with LEDs

    If you are using 64 LEDs via a matrix, then you only need 8 I/O for MIBAM output.

    For the video you posted, you need MIBAM.
    Last edited by sayzer; - 23rd December 2011 at 17:04.
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  4. #4
    Join Date
    May 2009
    Location
    Montreal, QC, Canada
    Posts
    118


    Did you find this post helpful? Yes | No

    Default Re: Making a flying star effect with LEDs

    I'm trying...

    One MIBAM output (B0) going to a resistor then a LED which is then connected to VDD
    Using a PIC16F628A with this code the LED remains on with no dimming.
    Code:
    @ __config _INTOSC_OSC_NOCLKOUT & _WDT_OFF & _MCLRE_ON & _LVP_OFF & _CP_OFF
    clear
    DEFINE OSC 8
    INCLUDE "MIBAM.pbp"                 ' Mirror Image BAM module                                           
    
    ;____[ For 12F/16F only - Interrupt Context save locations]_________________
    wsave   var byte    $20     SYSTEM  ' location for W if in bank0
    ;wsave  var byte    $70     SYSTEM  ' Alternate save location for W 
                                            ' if using $70, comment out wsave1-3
    ' --- IF any of these next three lines cause an error ?? -------------------
    '       Comment them out to fix the problem ----
    ' -- The chip being used determines which variables are needed -------------
    wsave1  VAR BYTE    $A0     SYSTEM      ' location for W if in bank1
    wsave2  VAR BYTE    $120    SYSTEM      ' location for W if in bank2
    ;wsave3 VAR BYTE    $1A0    SYSTEM      ' location for W if in bank3
    '---DO NOT change these-----------------------------------------------------
    ssave   VAR BYTE    BANK0   SYSTEM      ' location for STATUS register
    psave   VAR BYTE    BANK0   SYSTEM      ' location for PCLATH register
    
    TRISB = 000000
    PORTB = 0
    
    LED1 VAR byte    
    
    BAM_COUNT   CON 1;      How many BAM Pins are used?
    Speed       CON 20;     Smaller = Faster
    Brightness  CON 200;    Max DutyCycle
    
    
      ASM
    BAM_LIST  macro              ; Define PIN's to use for BAM
         BAM_PIN (PORTB,0, LED1)  ; and the associated Duty variables
      endm
      BAM_INIT  BAM_LIST         ; Initialize the Pins
    ENDASM
    
    
      
    Main:
        FOR LED1 = 0 to Brightness -1          ' Ramp up 1 by 1
            PAUSE Speed
        NEXT 
    
        FOR LED1 = Brightness to 1 STEP -1     ' Ramp down 1 by 1
            PAUSE Speed
        NEXT
    GOTO Main
    
    End
    What am I doing wrong?

    Mike

  5. #5
    Join Date
    May 2009
    Location
    Montreal, QC, Canada
    Posts
    118


    Did you find this post helpful? Yes | No

    Default Re: Making a flying star effect with LEDs

    I played with the settings and the LED is now dimming.
    I am now facing my first issue... how to produce the effect I want.

    I will try to find more examples, there's lots of scrolling text but so far I found nothing that resemble what I'm trying to do.
    If anyone have a link feel free to share.

    Mike
    Last edited by lilimike; - 23rd December 2011 at 21:02.

  6. #6
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default Matrix LED example 64 LED.

    Name:  ledmatrix.gif
Views: 1612
Size:  57.2 KB
    Try this one.
    Pot changes index value for test purposes.
    You can have 64 LEDs with this example.
    LED corresponding to Index value will turn on.
    Playing with this code, you can drive PORTB pins via MIBAM and have lots of effects.


    Code:
    @ __config _HS_OSC & _WDT_OFF & _PWRTE_OFF & _BODEN_OFF & _LVP_OFF & _CP_ALL
    
    CLEAR
    DEFINE OSC 20
    DEFINE LCD_DREG PORTD
    DEFINE LCD_DBIT 0
    DEFINE LCD_RSREG PORTD
    DEFINE LCD_RSBIT 5
    DEFINE LCD_EREG PORTD
    DEFINE LCD_EBIT 4
    DEFINE LCD_BITS 4
    DEFINE LCD_LINES 2
    DEFINE LCD_COMMANDUS 2000
    DEFINE LCD_DATAUS 50
    
    DEFINE ADC_BITS 8      ' Set number of bits in result
    DEFINE ADC_CLOCK 3     ' Set clock source (rc = 3)
    DEFINE ADC_SAMPLEUS 50 ' Set sampling time in microseconds 
    CMCON = 7              ' Disable Comparator & VRef. etc.
    pauseus 10
    CVRCON = 0
    ADCON1 = 96 ' 100000    Set analog thingie.
    ADCON0 = 0              ' All analog, we just need RA0.
    TRISA = 255             ' PORTA all input. Others output.
    TRISB = 0
    TRISC = 0
    TRISD = 0
    X var PORTB
    Y var PORTC
    Index var byte
    Index2 var byte
    OldVal var byte
    Pause 10
    
    Begin:
        pause 500
        lcdout $fe,1,"Matrix Test"
        pause 1000
        
        X = 0               
        Y = 255
        
        index = 0
        oldval = 255
    
    Start:
        adcin 0, index      ' Index = max 255.
        index = index / 4   ' To get index values between 0 to 63.
        if oldval <> index then ' Act only when the number changes.
            index2 = index/8    ' X scans 8 bits.
            x = 0               ' turn it Off.
            x.0[index2] = 1     ' Set the bit in line.
            
            y = 255             ' turn all pins on (output is off).
            lookup index2,[7,15,23,31,39,47,55,63],index2   ' Get matrix line.
            y.0[index2-index] = 0                           ' Clear the bit in line (output is on)
        
        
            lcdout $fe,$c0,dec3 index , " ",dec3 index2
            pause 10   
            oldval = index
         endif    
    
        goto start
    
    end
    Last edited by sayzer; - 24th December 2011 at 17:07. Reason: percent sign does not show up in code block.
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  7. #7
    Join Date
    May 2009
    Location
    Montreal, QC, Canada
    Posts
    118


    Did you find this post helpful? Yes | No

    Default Re: Matrix LED example 64 LED.

    I will give this a try.
    which PIC are you using? I can't read the text in the picture.

    You are using one resistor per column, is it right to say that no matter what, there is only one LED ON at a time?

    Thank you for the example, this will help a lot.

    Mike

  8. #8
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default Re: Matrix LED example 64 LED.

    The example is for 16F877A.
    In the example, yes, there is only one LED at a time.
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

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