chipKIT® Development Platform

Inspired by Arduino™

TLC5940 Library for ChipKIT MAX32

Created Wed, 13 Nov 2013 07:48:04 +0000 by shahrul


shahrul

Wed, 13 Nov 2013 07:48:04 +0000

Hi, I'm using this Library https://github.com/ColinHarrington/tlc5940chipkit

The connection using pin 3, 9, 10, 11, 13. At some code in the Tlc5940.cpp as the picture below [attachment=0]chipkit.jpg[/attachment]

Is that true what I understand. #define SOUT 0x100 #define SOUT_PORT PORTG is point to pin RG8 (PIC32) so pin 11 in Uno.

I wan't to use with chipKIT MAX32, but it's not working. How to declare pin? I don't understand the SPI protocol for TLC5940 because it's don't have Chip Select. Don't know when to send the first bit.


dangeljs

Wed, 13 Nov 2013 16:49:01 +0000

From the looks of his code he is using the SPI module to communicate and has the bit-banging portion not used (with #ifdef statements). So pin 11 is the SPI data out and pin13 is the SPI clock out.

He is using a lot of hardware modules (timers, OC) to do his work in the background which is nice, but because his interface is through the SPI you are locked to the specific pins that the SPI belong to (in this case it is SPI2). Likewise you are stuck with your XLAT and and BLANK pins because they are controlled through the OC module which reside on specific pins.

There is a lot of hard coding in this library so it isn't very flexible, but if it works for what you need then you can stick with it and work around the library (instead of have the library work around you).

As far as the SPI communication, this chip's front end is really just a dumb shift register so you would shift in 192 bits and then pulse XLAT to latch the values into the grayscale registers. You can shift as many times as you want as long as the last 192 clock pulse contain the data you want to latch into the TLC5940 (more pulses required if you have multiple chips cascaded obviously).

Hope this helps,

Jason