PIC BASIC TLC5940 code


Results 1 to 10 of 10

Threaded View

  1. #1
    Join Date
    Aug 2009
    Posts
    5

    Default PIC BASIC TLC5940 code

    Hello,

    I'm trying to setup a PIC using a TLC5940 chip to fade an LED array. I'm writing the code in BASIC. I've been trying to convert over some example code from an Arduino setup but haven't had much luck.

    I think I'm pretty close to getting it, the PIC is shifting out the information and I can see the LEDs blinking on and off, but I don't think I'm getting the BLANK, LATCHING, CLOCKING sequence correct... not sure what the problem is, it should just be a straight conversion.

    Any help would really be great. Thanks!

    Chip specs:
    http://www.ti.com/lit/gpn/tlc5940

    Arduino example code from here:
    http://pixelriot.com/pmatp/node/15

    BASIC code and example Arduino code is attached.

    EDIT: Also, going through the spec sheet it says "Only 3 pins are needed to input data into the device. The rising edge of the SCLK signal shifts the data from the SIN (in my code "SER") pin to the internal register. After all data is clocked in, a high-level pulse of XLAT signal latches the serial data to the internal registers.." So it seems like there should be a method of sending data using only 3 pins, however whenever I search on the internet for examples they always have a much more complicated setup to send data to the TLC5940. There are 2 basic modes Dot Correction Mode and GreyScale mode. I want to use GreyScale mode because it allows you a wider range of fading LEDs. What is the simplest operation to set the LED current for each pin??

    I tried this method (below), which turns on the LEDs but it's not steady. Which leads me to believe I'm not latching correctly or in the right order..

    high BLANK

    for z = 0 to 15
    shiftout SER, SCLK, 1, [4000]
    next z

    high XLAT
    LOW XLAT
    low blank
    Attached Files Attached Files
    Last edited by eletrokat; - 16th August 2009 at 12:17.

Similar Threads

  1. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 08:26
  2. pic Basic Pro 2.50a & debug statement
    By Phil Moore in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 17th March 2008, 09:41
  3. PIC BASIC or PIC BASIC PRO
    By kirkmans in forum USB
    Replies: 3
    Last Post: - 20th April 2007, 00:52
  4. Replies: 5
    Last Post: - 17th January 2006, 19:26
  5. Help with MPASM and PIC Basic
    By johngb in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 21st February 2003, 13:07

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