http://forum.arduino.cc/index.php?topic=110394.0
I went through all the process and this solution works fine. This post is my documentation.
step by step:
1. Backup the chip_includes.h file in the 'pinouts' folder in the TLC5940 library folder, since leonardo uses different definitions of pins. Then edit the chip_includes.h as follows:
=====================================
/* Copyright blablabla*/
#ifndef TLC_CHIP_INCLUDES_H
#define TLC_CHIP_INCLUDES_H
/** \file
Includes the chip-specfic defaults and pin definitions. */
#include <avr/io.h>
#ifndef PB0
#define PB0 PORTB0
#define PB1 PORTB1
#define PB2 PORTB2
#define PB3 PORTB3
#define PB4 PORTB4
#define PB5 PORTB5
#define PB6 PORTB6
#define PB7 PORTB7
#endif
/* Chip Specific Pinouts */
#if defined (__AVR_ATmega32U4__)
/* Leonardo */
#include "Arduino_Leonardo.h"
#else
#error "Unknown Chip!"
#endif
#endif
=====================================
2. create a file named "Arduino_Leonardo.h" and modify the file as follows:
=====================================
#ifndef TLC_Teensy_xxU4_h
#define TLC_Teensy_xxU4_h
#if DATA_TRANSFER_MODE == TLC_BITBANG
#error "If you want bitbang mode, insert pin defs here"
#endif
// MOSI (Leo outter center ICSP pin) -> SIN (TLC pin 26)
#define TLC_MOSI_PIN 2
#define TLC_MOSI_PORT PORTB
#define TLC_MOSI_DDR DDRB
// SCK (Leo inner center ICSP pin) -> SCLK (TLC pin 25)
#define TLC_SCK_PIN 1
#define TLC_SCK_PORT PORTB
#define TLC_SCK_DDR DDRB
// SS (Leo RX LED)
#define TLC_SS_PIN 0
#define TLC_SS_DDR DDRB
// OC1A (Leo pin 9) -> XLAT (TLC pin 24)
#define XLAT_PIN 5
#define XLAT_PORT PORTB
#define XLAT_DDR DDRB
// OC1B (Leo pin 10) -> BLANK (TLC pin 23)
#define BLANK_PIN 6
#define BLANK_PORT PORTB
#define BLANK_DDR DDRB
// OC3A (Leo pin 5) -> GSCLK (TLC pin 18)
#define GSCLK_PIN 6
#define GSCLK_PORT PORTC
#define GSCLK_DDR DDRC
#define TLC_TIMER3_GSCLK 1
#endif
=========================================
3. Connect to Arduino Leonardo as follows:
TLC5940 to Leonardo
pin 27 to Gnd
pin 26 to MOSI (see picture)
pin 25 to SCK (see picture)
pin 24 to pin 9
pin 23 to pin 10
pin 22 to Gnd
pin 21 to +5V
pin20 to Gnd with a 2k resistor
pin 19 to +5V
pin 18 to pin 5
see picture below:
4. Connect LEDs with the positive legs to +5V and negative legs to TLC outputs.
5. finished, upload sketch.
Reference:
http://forum.arduino.cc/index.php?topic=110394.0
4. Connect LEDs with the positive legs to +5V and negative legs to TLC outputs.
5. finished, upload sketch.
Reference:
http://forum.arduino.cc/index.php?topic=110394.0
No comments:
Post a Comment