WS2811 and WS2812 One-Wire Communication Assembly Help


Results 1 to 25 of 25

Threaded View

  1. #4
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,821


    Did you find this post helpful? Yes | No

    Default WS2811 One-Wire Communication Assembly Help

    I am after such a project too. Unfortunately Assembly is not too friendly.

    I found this AN from Microchip, AN1606 that uses the CLC module on some new chips, like the 16F1509.

    After a cryptic analysis of the timing using TMR, PWM and CLC modules, the AN claims that can produce the strict timing required for the WS2811 chip.

    Well, only the setting is shown and not the use of this settings on the PIC.

    Anyone has any idea how to use the PIC for sending the RGB data?

    Following is the settings for the 1509 registers to obtain the correct timing on the RC4/CLC4 port pin #6, based on the slow mode of WS2811.

    Code:
    ' Initialize PIC16(L)F1509 CLC2, CLC4, Timer2, and MSSP
    ' for WS2811 signal transmission protocol
    ' Loading SSP1BUF register sends that data byte out the RC4/CLC4 pin
    ' PWM1 routed straight through CLC2
    CLC2GLS0 = $20
    CLC2GLS1 = $00
    CLC2GLS2 = $00
    CLC2GLS3 = $00
    CLC2SEL0 = $00
    CLC2SEL1 = $06
    CLC2POL = $0E
    CLC2CON = $82;
    
    ' (SPI SDO & SPI CLK) || (nSPI SDO & SPI CLK & PWM1)
    ' PWM1 comes through CLC2
    CLC4GLS0 = $44
    CLC4GLS1 = $10
    CLC4GLS2 = $80
    CLC4GLS3 = $20
    CLC4SEL0 = $50
    CLC4SEL1 = $05
    CLC4POL = $01
    CLC4CON = $C0
    
    ' Adjust Timer2 period for desired baud rate
    ' One bit period is two Timer2 periods
    T2CON = $04
    PR2 = 5
    ' Adjust PWM1 duty cycle for desired "0" data-bit duty cycle
    ' ‘1’ data-bit duty cycle is automatically 50%
    PWM1CON = $E0
    PWM1DCH = 2
    PWM1DCL = 0
    
    ' MSSP configured for SPI master with Timer2_Period/2 clock
    SSP1CON1 = $23
    
    ' Output on RC4/CLC4
    TRISC = $EF
    Any help appreciated.

    Ioannis
    Last edited by Ioannis; - 14th October 2017 at 20:52.

Similar Threads

  1. PIC to WS2812B / WS2811 IC
    By comwarrior in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 19th January 2018, 19:37
  2. ws2812 - pic12f1822
    By richard in forum Code Examples
    Replies: 0
    Last Post: - 12th January 2016, 09:52
  3. Assembly
    By Normnet in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 19th March 2007, 03:44
  4. How do you do this in Assembly
    By ice in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 10th May 2005, 06:47
  5. Assembly?
    By Dwayne in forum General
    Replies: 11
    Last Post: - 4th January 2004, 18:18

Members who have read this thread : 1

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