I'm using a set of daisy chained shift registers (595's) for expanding my digital output pins on my Uno. I am now incorporating the TLC5940 chip into my project to control servos.
What I want to do is use 4 pins off my 595 for the digital control high/low signals to the 5940 rather than wire the 5940 directly to the arduino.
I have my own functions for writing high/low values to specific 595 pins. Is anyone familiar with the Tlc5940 .cpp library to offer suggestions for how I could incorporate my 595 output pins instead of the dedicated Uno pin usage hard coded into the tlc library?
I am only talking about the TLC high/low control pins, not the PWM pin.
Since I presume its not possible for the tlc .cpp library to call my own sketch functions, it sounds like I will need to rewrite my 595 shift functions into the tlc library???
I've started to review the tlc library but, I haven't determined the actual writes out to the clock pins yet The best I can find are the references to function "_BV()". Is that the actual function that writes high/lows out to the control pins? I can't find that actual function in the .cpp anywhere.
This 5940 chip you plan to use to control servos, is this the same one that controls LED's ?
yes, its this popular library (Arduino Playground - HomePage). It can control LED's and servos.
Which of the TLC pins do you plan to connect to your shift register? The only ones that may be candidates in my opinion are optional ones (p.e. VPRG). But you need more pins to control the shift register than you may save by using it.
In the typical TLC wiring setup, these 4 wires from the TLC would be good candidates for running off the 595 instead of directly off the arduino.
- IC pin 23 - BLANK: ORANGE wire connected to the Arduino pin 10
- IC pin 24 - XLAT: YELLOW wire connected to the Arduino pin 9
- IC pin 25 - SCLK: BLUE wire connected to the Arduino pin 13
- IC pin 26 - SIN: GREEN wire connected to the Arduino pin 11
So I'd need to modify the TLC library to instead of using arduino pins 9,10,11, & 13 it would write out to the 595 output shift register to turn on/off 4 pins on it.
I'm just trying to reclaim the 4 arduino pins and use 4 on my daisy chained set of output shift registers. Seem reasonable?
In the most used Arduino library for the TLC the pins 9 and 10 are driven as PWM pins to generate the appropriate clock signals. And you really want to drive a serial clock and serial data signal by a shift register?
With such a modification or better re-implementation of the TLC library it would be much to slow for it's typical use (driving LEDs) as well as for most servos too. Take a look at the timing diagram in the datasheet of the TLC. Do you really want to drive these lines with a cascaded shift register?
humm ... I guess I did not realize those 9 & 10 pins where also driven as PWM; I thought only the output pin 3 was PWM and the rest were just high/low control pins, thus why I was attempting to convert them onto the shift register. If they are driven as PWM, then no, I presume I wouldn't want to make the shift register work that hard to sumulate the pwm.
It may be academic at this point anyways. I've determined that I have enough pins to run the 595 (output) and 168 (input) shift registers as well as the TLC as well as a couple spare pins; even the analog pins could be recovered for digital use if I need them.