Today 08:54
Forum: The Lounge
Starter: craig
Views: 0
Replies: 2
Today 08:32
Forum: The Lounge
Starter: shantanu@india
Views: 0
Replies: 0
Yesterday 14:18
Forum: Proton Plus Compiler v3
Starter: mjturner
Views: 0
Replies: 15
Yesterday 14:17
Forum: Proton Plus Compiler v3
Starter: mjturner
Views: 0
Replies: 0
+ Reply to Thread
Page 2 of 2 FirstFirst 12
Results 11 to 17 of 17

Thread: Driving SK9822 or APA102 RGB LED's43 days old

  1. #11
    Fanatical Contributor Les's Avatar
    Join Date
    Feb 2002
    Posts
    2,963
    Thumbs Up
    Received: 296
    Given: 109
    Total Downloaded
    1.50 GB

    0 Not allowed!

    Default Re: Driving SK9822 or APA102 RGB LED's

    Take a look at page 153 of the manual, under the declares section.

    The Shin and Shout commands are software based, but for the APA and SK devices, Shout will be too fast, because the LED chips only operate on a slower clock rate.

    The "Shift_DelayUs" declare will slow down the clock rate in the Shin and Shout commands. However, you are still better off creating a small subroutine that performs a 32-bit SPI mechanism , that the LEDs want. This way it can be tailored to match the devices perfectly, instead of using a generic routine.
    For more example programs for Proton and Proton24 or updates, please visit: Proton WIKI or Proton Files

  2. #12
    Junior Member Dave Purola's Avatar
    Join Date
    Jul 2004
    Posts
    14
    Thumbs Up
    Received: 9
    Given: 0
    Total Downloaded
    66.92 MB

    0 Not allowed!

    Default Re: Driving SK9822 or APA102 RGB LED's

    Les, What is the SHOut and SHin clock rate for reference?

  3. #13
    Junior Member Dave Purola's Avatar
    Join Date
    Jul 2004
    Posts
    14
    Thumbs Up
    Received: 9
    Given: 0
    Total Downloaded
    66.92 MB

    0 Not allowed!

    Default Re: Driving SK9822 or APA102 RGB LED's

    Les, What is your idea of a slower clock rate? Since your post I have read about a dozen of so posts that have proof of operation at 1 to 10 Mhz. I have since your post whipped up a set of hardware registers made of CMOS and operated individual APA102c"s at 1 Mhz. Do you mean that the software driven commands SHOut and SHin run faster than 10 Mhz.? Rick's problem is probably a hardware issue rather than a software issue.

  4. #14
    Fanatical Contributor Les's Avatar
    Join Date
    Feb 2002
    Posts
    2,963
    Thumbs Up
    Received: 296
    Given: 109
    Total Downloaded
    1.50 GB

    0 Not allowed!

    Default Re: Driving SK9822 or APA102 RGB LED's

    My mistake. :-(

    I made the very foolish mistake of reading, and believing, an internet page that stated something like 19KHz. Yet even after actually reading the APA102's datasheet it does not seem to state a maximum for its SPI interface, but it will have one. :-O

    I'm still waiting for the APA102 devices to arrive from China, and when they do, I will create a library for them.

    The internet is so full of absolute crap, that it is getting to the point where it is pointless reading it. Even doing a simple search now on the internet brings back so much rubbish that has nothing to do with what the search was for. :-(
    Last edited by Les; 15th July 2018 at 15:55.
    For more example programs for Proton and Proton24 or updates, please visit: Proton WIKI or Proton Files

  5. #15
    Junior Member Dave Purola's Avatar
    Join Date
    Jul 2004
    Posts
    14
    Thumbs Up
    Received: 9
    Given: 0
    Total Downloaded
    66.92 MB

    0 Not allowed!

    Default Re: Driving SK9822 or APA102 RGB LED's

    Yes Les, I have NOT found anything on an actual spec. sheet about the upper limit of the clock frequency. One can only assume it is the minimum of the data setup time and hold time. I wrote my own .ASM routine for operating APA102c's and have incorporated it into a project for my daughter. It is a table lamp utilizing 204, APA102c's with an update rate of just under 5 Ms. The clock rate is about 1.7 Mhz. I have been using PBP for about 15 or so years now. I did purchase the Proton compiler back in 2004 but never upgraded it to the latest release. I kind of doubt the version I have will even work on my windows 10 machine. I have purchased some of the Amacus18 development boards for my work and am looking forward to the newest version to come out.
    Attached Images Attached Images

  6. #16
    Prolific Poster rcurl's Avatar
    Join Date
    Mar 2002
    Posts
    1,774
    Thumbs Up
    Received: 28
    Given: 46
    Total Downloaded
    1.46 GB

    0 Not allowed!

    Default Re: Driving SK9822 or APA102 RGB LED's

    Hi guys-
    I made a couple changes and it is working better. I added the declare "Shift_DelayUS 100" and changed the Shout command to MSBFirst_L so the clock will idle low.
    It seems to be stable now. Thanks for the info!

    -Rick

  7. #17
    Junior Member Maxi's Avatar
    Join Date
    Mar 2010
    Posts
    87
    Thumbs Up
    Received: 1
    Given: 20
    Total Downloaded
    2.01 GB

    0 Not allowed!

    Default Re: Driving SK9822 or APA102 RGB LED's

    Dear friends, I need some help

    I use @Dave Purola php codes (thank you dave)
    controlling x13 SK9822 leds, its working.

    Led lights run left to right side from 1 to 13
    after this, wait 1 second and leds closed left to right side again.

    I want to closed leds from 13 to 1 (back to the first led)
    I need this.

    here is code
    Code:
    Device 18F26K22
    Declare Xtal=16
    
    OSCCON.6=1
    OSCCON.5=1
    OSCCON.4=1
    
    OSCCON.1=1
    OSCCON.0=1
    
    Config_Start
      FOSC = INTIO67	;Internal oscillator block
      PLLCFG = OFF
      PRICLKEN = On	;Primary clock enabled
      FCMEN = OFF	;Fail-Safe Clock Monitor disabled
      IESO = OFF	;Oscillator Switchover mode disabled
      PWRTEN = On	;Power up timer enabled
      BOREN = SBORDIS ;Brown-out Reset enabled in hardware only and disabled in Sleep mode (SBOREN is disabled)
      BORV = 190	;VBOR set to 2.50 V nominal
      WDTEN = OFF	;Watch dog timer is always disabled. SWDTEN has no effect.
      WDTPS = 32768	;1:32768
      CCP2MX = PORTC1	;CCP2 input/output is multiplexed with RC1
      PBADEN = OFF
      CCP3MX = PORTC6	;P3A/CCP3 input/output is mulitplexed with RC6
      HFOFST = OFF	;HFINTOSC output and ready status are not delayed by the oscillator stable status
      T3CMX = PORTC0	;T3CKI is on RC0
      P2BMX = PORTC0	;P2B is on RC0
      MCLRE = INTMCLR	;RE3 input pin enabled; MCLR disabled
      STVREN = OFF	;Stack full/underflow will not cause Reset
      LVP = OFF	;Single-Supply ICSP disabled
      XINST = OFF	;Instruction set extension and Indexed Addressing mode disabled (Legacy mode)
      Debug = OFF	;Disabled
      Cp0 = On	;Block 0 (000800-001FFFh) code-protected
      CP1 = On	;Block 1 (002000-003FFFh) code-protected
      CP2 = On	;Block 2 (004000-005FFFh) code-protected
      CP3 = On	;Block 3 (006000-007FFFh) code-protected
      CPB = On	;Boot block (000000-0007FFh) code-protected
      CPD = OFF	;Data EEPROM not code-protected
      WRT0 = OFF	;Block 0 (000800-001FFFh) not write-protected
      WRT1 = OFF	;Block 1 (002000-003FFFh) not write-protected
      WRT2 = OFF	;Block 2 (004000-005FFFh) not write-protected
      WRT3 = OFF	;Block 3 (006000-007FFFh) not write-protected
      WRTC = OFF	;Configuration registers (300000-3000FFh) not write-protected
      WRTB = OFF	;Boot Block (000000-0007FFh) not write-protected
      WRTD = OFF	;Data EEPROM not write-protected
      EBTR0 = OFF	;Block 0 (000800-001FFFh) not protected from table reads executed in other blocks
      EBTR1 = OFF	;Block 1 (002000-003FFFh) not protected from table reads executed in other blocks
      EBTR2 = OFF	;Block 2 (004000-005FFFh) not protected from table reads executed in other blocks
      EBTR3 = OFF	;Block 3 (006000-007FFFh) not protected from table reads executed in other blocks
      EBTRB = OFF	;Boot Block (000000-0007FFh) not protected from table reads executed in other blocks
    Config_End
    
        
    TRISA=%00000000:TRISB=%00000000:TRISC=%00000000
    PORTA=%00000000:PORTB=%00000000:PORTC=%00000000
    Declare All_Digital= true          
    Declare Shift_DelayUs 100
        
    Symbol SCL=PORTC.0
    Symbol SDA=PORTC.1
    Symbol PC2=PORTC.2
    Symbol PC3=PORTC.3
    
    Dim TEMP As Byte
    Dim DUTY As Byte
    Clear
    DelayMS 500
    
    DUTY=225  '224=%0 TO 255=%100 (32 STEP)
    	
    MAIN:	
    Inc TEMP
    If TEMP>26 Then TEMP=1
    
    If TEMP=1 Then 
    SHOut SDA,SCL,1,[$00,$00,$00,$00,DUTY,$00,$00,$FF]
    EndIf
    
    If TEMP=2 Then
    SHOut SDA,SCL,1,[DUTY,$00,$00,$FF]	
    EndIf
    
    If TEMP=3 Then
    SHOut SDA,SCL,1,[DUTY,$00,$00,$FF]	
    EndIf
    
    If TEMP=4 Then
    SHOut SDA,SCL,1,[DUTY,$00,$00,$FF]	
    EndIf
    
    If TEMP=5 Then
    SHOut SDA,SCL,1,[DUTY,$00,$00,$FF]	
    EndIf
    
    If TEMP=6 Then
    SHOut SDA,SCL,1,[DUTY,$00,$00,$FF]	
    EndIf
    
    If TEMP=7 Then
    SHOut SDA,SCL,1,[DUTY,$00,$00,$FF]	
    EndIf
    
    If TEMP=8 Then
    SHOut SDA,SCL,1,[DUTY,$00,$00,$FF]	
    EndIf
    
    If TEMP=9 Then
    SHOut SDA,SCL,1,[DUTY,$00,$00,$FF]	
    EndIf
    
    If TEMP=10 Then
    SHOut SDA,SCL,1,[DUTY,$00,$00,$FF]	
    EndIf
    
    If TEMP=11 Then
    SHOut SDA,SCL,1,[DUTY,$00,$00,$FF]	
    EndIf
    
    If TEMP=12 Then
    SHOut SDA,SCL,1,[DUTY,$00,$00,$FF]	
    EndIf
    
    
    If TEMP=13 Then
    SHOut SDA,SCL,1,[DUTY,$00,$00,$FF,$FF,$FF,$FF,$FF]	
    DelayMS 1000
    EndIf
    '-------------------------------------------------
    
    
    If TEMP=14 Then
    SHOut SDA,SCL,1,[$00,$00,$00,$00,DUTY,$00,$00,$00]	
    EndIf
    
    If TEMP=15 Then
    SHOut SDA,SCL,1,[DUTY,$00,$00,$00]	
    EndIf
    
    If TEMP=16 Then
    SHOut SDA,SCL,1,[DUTY,$00,$00,$00]	
    EndIf
    
    If TEMP=17 Then
    SHOut SDA,SCL,1,[DUTY,$00,$00,$00]	
    EndIf
    
    If TEMP=18 Then
    SHOut SDA,SCL,1,[DUTY,$00,$00,$00]	
    EndIf
    
    If TEMP=19 Then
    SHOut SDA,SCL,1,[DUTY,$00,$00,$00]	
    EndIf
    
    If TEMP=20 Then
    SHOut SDA,SCL,1,[DUTY,$00,$00,$00]	
    EndIf
    
    If TEMP=21 Then
    SHOut SDA,SCL,1,[DUTY,$00,$00,$00]	
    EndIf
    
    If TEMP=22 Then
    SHOut SDA,SCL,1,[DUTY,$00,$00,$00]	
    EndIf
    
    If TEMP=23 Then
    SHOut SDA,SCL,1,[DUTY,$00,$00,$00]	
    EndIf
    
    If TEMP=24 Then
    SHOut SDA,SCL,1,[DUTY,$00,$00,$00]	
    EndIf
    
    If TEMP=25 Then
    SHOut SDA,SCL,1,[DUTY,$00,$00,$00]	
    EndIf
    
    If TEMP=26 Then
    SHOut SDA,SCL,1,[DUTY,$00,$00,$00,$FF,$FF,$FF,$FF]	
    DelayMS 1000	
    EndIf
    
    DelayMS 25
    GoTo MAIN

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. DMX512 RGB led controller
    By Roshan in forum Proton Plus Compiler v3
    Replies: 5
    Last Post: 17th November 2015, 09:49
  2. Apa102 led
    By StipoGill in forum Projects discussion
    Replies: 0
    Last Post: 10th June 2014, 04:07
  3. Octobrite RGB Led Display and TLC5947
    By ohararp in forum Projects discussion
    Replies: 0
    Last Post: 20th December 2010, 14:27
  4. RGB led's parallel
    By pe1pme in forum The Lounge
    Replies: 1
    Last Post: 2nd December 2010, 03:31
  5. 2 Pin RGB LED
    By Darlington in forum The Lounge
    Replies: 7
    Last Post: 22nd December 2008, 21:01

Members who have read this thread since 14th August 2018, 11:00 : 23

Actions :  (Set Date)  (Clear Date)

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