CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

TM1809

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
jackmicro



Joined: 07 May 2013
Posts: 23

View user's profile Send private message

TM1809
PostPosted: Fri Nov 15, 2013 10:15 pm     Reply with quote

Hello all,

Do any of you golden hearted coders know of any library to handle LED strips, namely the TM1809 chip?

Any help will be truly appreciated.

Jack
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Nov 16, 2013 1:28 am     Reply with quote

Google for it. Look at his ws2811.c file:
http://www.insomnialighting.com/products/rgbsmdws2811.html
temtronic



Joined: 01 Jul 2010
Posts: 9243
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sat Nov 16, 2013 5:32 pm     Reply with quote

here's a test I did 2 years ago....yikes, time flies !!
it might help...
jay

Code:

//46k22_ws2801_2.c
//46k22 ws2801 8 LED test code
// working blu-grn-red-yel-vio-tel-bnk-wht


#include <18f46k22.h>
#include "46k22_fuses.h"
#include "46k22_pins.h"

#use delay(clock=16000000)
#use rs232(baud=9600,xmit=SIO_TX1,rcv=SIO_RX1,errors,stream=SIOport)
#use rs232(baud=9600,xmit=SIO_TX2,rcv=SIO_RX2,errors,stream=USBport)

#include "46k22_LCD.c"
#include "jay_DS1307.c"


#USE SPI (MASTER, SPI1, MODE=0, BITS=8, STREAM=SPI_1, MSB_FIRST)

#define LED_STRIP_LEN 8 // number of LEDs on the strip
#define RAND_MAX 255
unsigned int32 led_strip_colors[LED_STRIP_LEN];

void send_frame() {   
  unsigned int16 i;
  unsigned int8 red,green,blue;
 
  for(i=0;i<LED_STRIP_LEN;i++) {
    blue = led_strip_colors[i] & 0xFF;
    green = (led_strip_colors[i] >> 8) & 0xFF;
    red = (led_strip_colors[i] >> 16) & 0xFF;
    spi_write(red);
    spi_write(green);
    spi_write(blue);
  }
  delay_us(500);    // delay 500us to latch the IC
}


void main()
{
    unsigned int16 i;
   unsigned int16 x;

lcd_init();
delay_ms(500);
printf(lcd_putc,"WS2801 test 1");
delay_ms(500);


while(true){



    for(i = 0 ; i < LED_STRIP_LEN ; i++) {led_strip_colors[i] = 0;}

    led_strip_colors[0] = 0xFF0000;  // red
    led_strip_colors[1] = 0x00FF00;  // green
    led_strip_colors[2] = 0x0000FF;  // blue
    led_strip_colors[3] = 0x00FFFF;  // green + blue
    led_strip_colors[4] = 0xFF00FF;  // red + blue (purple)
    led_strip_colors[5] = 0xFFFF00;  // red + green (org)
    led_strip_colors[6] = 0x000000;  // off + off + off
    led_strip_colors[7] = 0xFFFFFF;  // red + green + blue (white)

    send_frame();

    delay_ms(500);

lcd_gotoxy(2,2);
printf(lcd_putc,"%lu pass",x);
x=x+1;


}// forever while loop   
}// end of main

jackmicro



Joined: 07 May 2013
Posts: 23

View user's profile Send private message

PostPosted: Sat Nov 16, 2013 5:51 pm     Reply with quote

many thanks. appreciated!
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group