Allegro A6280 with PICBASIC


Closed Thread
Results 1 to 26 of 26

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959

    Default

    Great! Glad you got it working.

    Besides that, Do I really need to use the Dot Correction?
    I guess you don't "really need" to use them. You could just set the current with the REXT resistor, and use the PWM like normal. But if you want to match the brightness of the 3 LED's, then you'll need to set the DOT correction registers.

    They Power-up at 36% of the REXT current setting.
    So be sure you don't have too much current set-up before trying this. I don't want to blow up your LED's.
    But this should set the DOT registers to full current.
    Code:
    Rdot VAR BYTE
    Gdot VAR BYTE
    Bdot VAR BYTE
    Zeros VAR BYTE : Zeros = 0
    
    Rdot = 127  ; Set these to match LED brightness (max 127)
    Gdot = 127
    Bdot = 127
    
    SetDots:
        funct = 1
        CCP1CON = 0
        shiftout d2pin, c2pin, 1, [funct\1,Zeros\3,Gdot\7,Zeros\3, _
                                   Rdot\7,Zeros\3,Bdot\7]
        high latch
        @ NOP
        low latch
        CCP1CON = %00001100
        funct = 0
    RETURN
    Then just GOSUB SetDots

    HTH,
    DT

  2. #2
    Join Date
    Aug 2007
    Posts
    10

    Red face

    Dear Darrel, thanks for the code so I think maybe you're right. The dot correction might not playing a necessary character in here. I still have a question if you don't mind, I'm trying to dim the led by decreasing the value of bvar (let say from 1023 to 0) but no luck. May I know why? Besides that, do u have a complete set of code for this IC's controller for sale? Hope you have a good day.

  3. #3
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959

    Default

    I don't know why it wouldn't, except maybe for the PAUSEs.
    The last code posted would take over 42 minutes to dim from 1023 to 0 with the included pauses.

    Can you post your code again the way it is now?

    DT

  4. #4
    Join Date
    Aug 2007
    Posts
    10

    Red face

    BVar = 1023

    blue:
    shiftout d2pin, c2pin,1 [funct\1,Rvar\10,Gvar\10,Bvar\10]
    gosub latch
    gosub BringUpPWM
    pause 100
    Bvar = Bvar - 2
    if bvar < 3 then goto end
    gosub blue

    end

    I was expecting gradual dimming of the LED, but it pulsates and intensity seems the same.

  5. #5
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959

    Default

    END is a reserved word and can't be used as a label.

    The blue loop is GOSUBing back to itself. It should be GOTO.

    And, it needs to turn off the CCP module before shifting any data.

    Make sure the PAUSE 500 is NOT in the latching: subroutine anymore.

    Code:
    BVar = 1023
    
    blue:
        CCP1CON = 0
        shiftout d2pin, c2pin,1 [funct\1,Rvar\10,Gvar\10,Bvar\10]
        gosub latch
        gosub BringUpPWM
        pause 100
        Bvar = Bvar - 2
        if bvar < 3 then goto BlueDone
    GOTO blue
    
    BlueDone:
    DT

  6. #6
    Join Date
    Aug 2007
    Posts
    10

    Default

    Ok, I'll try the code tomorrow morning as it is too late now. Hope it works, thanks and I'll let you know the result by tomorrow. Thanks

  7. #7
    Join Date
    Aug 2007
    Posts
    10

    Thumbs up

    BINGO! Darrel, you're the best! Thank you again for the code, now I can dim the LED. Now, the only think in my concern is that when I control too many clusters, the PIC might not be able to store that much of data isn't it? Do you have any recommendation? Hehehe, sorry if I ask too much but really appreciate your help. God bless. Thanks again.

  8. #8
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959

    Default

    Awesome!

    Not bad for someone that's never seen that chip before. eh

    Well, as far as the memory requirements go. At 6 bytes per cluster (PWM only), you can run an awful lot of clusters with just about any chip. But if it gets to be too many, just throw on a serial FRAM, and you could light up several hundred or thousand clusters, easily.

    Well, assuming you had that may pins on your PIC.
    Since each cluster needs it's own Latch line, it's kind of limiting.
    Of course you could always run the devices in series with a common latch, or add some shift registers to increase the Latch count, but now I'm getting into a whole different area.

    DT

Similar Threads

  1. Picbasic VS C Compiler
    By koossa in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 11th October 2005, 21:44
  2. Replies: 22
    Last Post: - 12th July 2005, 17:39
  3. 1st 16F877A program in PICBasic
    By Borisw37 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 19th January 2005, 04:46
  4. PicBasic Fundamentals
    By Billyc in forum General
    Replies: 9
    Last Post: - 4th May 2004, 10:04
  5. PicBasic Pro & PicBasic syntax different
    By Billyc in forum General
    Replies: 5
    Last Post: - 16th April 2004, 21:19

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