#define BAUD 115200 //TLC5940NT pin definitions #define VPRG 2 #define SIN 11 #define SCLK 13 #define XLAT 4 #define BLANK 5 #define DCPRG 6 #define GSCLK 7 #define MISO 12 //No se usan #define SS 10 //No se usan const byte remap[7][5] = { //Mapeo de los leds {6,17,24,35,42}, {5,16,23,34,41}, {4,11,22,33,40}, {3,10,21,32,39}, {2,9,20,27,38}, {1,8,19,26,37}, {0,7,18,25,36}, }; /*byte code[128][35] = {{ 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0}, //0 = NULL { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0}, //1 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0}, //2 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0}, //3 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0}, //4 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0}, //5 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0}, //6 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0}, //7 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0}, //8 { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; // Variables for interpreting the serial commands byte command = 0; // For interrupt timing; needed only to do intermediate clock speeds /* Divide interrupt frequency by a factor of FREQ. It is preferable to keep FREQ as small as possible, and control the frequency of the interrupts using the hardware clock. Setting it to 1 disables this entirely, which, if it works, is ideal; this should be the same as commenting out the "#define FREQ" statement entirely. */ #define FREQ 1 // How many interrupts occur before the serial commands are read #if FREQ > 1 byte int_counter = 0; #endif // Transfer a character out over hardware SPI char spi_transfer(volatile byte data) { SPDR = data; // Start the transmission while (!(SPSR & (1< 1 if(++int_counter == FREQ){ // Only do this once every FREQ-th interrupt int_counter = 0; #endif //FREQ if(Serial.available()){ command = Serial.read(); } // If the serial buffer is getting too close to full, keep executing the parsing until it falls below a given level // This might cause flicker, or even dropped messages, but it should prevent a crash. #if FREQ > 1 } #endif //FREQ }*/ void setup() { //Setup data directions, and set everything to the correct initial levels, // For TLC5940 pinMode(VPRG, OUTPUT); pinMode(SIN, OUTPUT); pinMode(SCLK, OUTPUT); pinMode(XLAT, OUTPUT); pinMode(BLANK, OUTPUT); pinMode(DCPRG, OUTPUT); pinMode(GSCLK, OUTPUT); pinMode(MISO, INPUT); pinMode(SS,OUTPUT); digitalWrite(SS,HIGH); //disable device digitalWrite(SIN, LOW); digitalWrite(SCLK, LOW); digitalWrite(XLAT, LOW); digitalWrite(VPRG, LOW); digitalWrite(BLANK, HIGH); digitalWrite(GSCLK, HIGH); digitalWrite(DCPRG, LOW); // USE EEPROM DC register if LOW //Setup the Hardware SPI registers // SPCR = 01010000 //interrupt disabled,spi enabled,msb 1st,master,clk low when idle, //sample on leading edge of clk,system clock/4 (fastest) byte clr; SPCR = (1<=0; i--){ spi_transfer( (levelW[2*i+1] & 0x0FF0) >> 4 ); spi_transfer( ((levelW[2*i+1] & 0xF) << 4) | ((levelW[2*i] & 0x0F00) >> 8) ); spi_transfer( levelW[2*i] & 0xFF); } digitalWrite(XLAT,HIGH); digitalWrite(XLAT,LOW); digitalWrite(BLANK, LOW); } void feedPorts() { // Clock for TLC5940's PWM digitalWrite(BLANK, HIGH); digitalWrite(BLANK, LOW); //=all outputs ON, start PWM cycle for (int i=0; i<4096; i++) { pulseGSCLK(); } } void pulseGSCLK() { //ultra fast pulse trick, using digitalWrite caused flickering PORTD |= 0x80 ; // bring pin 7 high, but don't touch any of the other pins in PORTB //16 nanosecs is the min pulse width for the 5940, but no pause seems needed here PORTD &= 0x7F; // bring pin 7 low without touching the other pins in PORTB } void letra(byte let[35] ) { byte letbool=0; for(byte x = 0; x < 7; ++x){ for(byte y = 0; y <5; ++y){ //levelR[remap[x][y]] = 4095; if (let[letbool]) levelW[remap[x][y]] = 500; else levelW[remap[x][y]] = 0; ++letbool; } } }