Show Posts
Pages: [1]
1  Using Arduino / LEDs and Multiplexing / Help!! tlc5940 library maximum fade buffer length with 10 tlc's on: December 16, 2012, 08:24:13 pm
Hi, I'm using the Tlc5940.h library to control 10 Tlc chips, I figured that I needed to change the TLC_FADE_BUFFER_LENGTH in tlc_fades.h from the default 24 to 240. However, it stopped working at 120. Is it because of not enough ram?

If so what should I do to get it working?

thanks
2  Using Arduino / Programming Questions / Use C++ libraries in Eclipse on: December 12, 2012, 12:22:36 am
Hi I'm using Eclipse as my IDE and wonder if it is possible to use c++ libraries like iostream.h, which enables me to use cout and cin classes. And how should I setup? Do I need to include library paths etc?

thank you!
3  Using Arduino / LEDs and Multiplexing / Re: TLC5940 Flickering on: December 11, 2012, 09:30:39 pm
Continuing from my problem previously. I do have the decoupling 100nF capacitor on all my tlc's, and the problem still stands. Now I switched from a UNO board to a Nano 168 board and strangely the problem disappears. But the fading speed also becomes much slower. Again, I'm using the example Fades in the tlc5940 library.

So why the speed is different? Is it because of the faster clock speek on UNO? But I thought the example would have taken this into account when I change the board setting in the arduino menu.

And why the flickering disappears on the Nano but not the UNO?

thanks
4  Using Arduino / LEDs and Multiplexing / Re: TLC5940 Flickering on: December 11, 2012, 01:56:27 pm
I have also the problem with random flickering for my 5940, and it happens on the first tlc already at OUT10 onwards. The first few output pins are ok though.

I have the 100nF between Vcc and GND. What else could be the problem? I'm using the Fades example code from the tlc5940 library.
5  Using Arduino / LEDs and Multiplexing / Timer1 refresh problem with 8x8 LED Matrix on: October 14, 2012, 10:54:56 am
I'm using two 74HC595 to control a 8x8 LED Matrix with the row-column scanning method. I want to switch between two patterns with specified times, using the TimerOne.h library similar to that shown here.
http://arduino.cc/playground/Main/DirectDriveLEDMatrix#Timer1

But somehow my code does work. Can someone point out what I did wrong?
Here is my code

Code:
#include <Streaming.h>
#include <TimerOne.h>

// ST_CP of 74HC595
int latchPin = 6;
// SH_CP of 74HC595
int clockPin = 5;
// DS of 74HC595
int dataPin = 7;

int ledPin = 9;

PROGMEM prog_uint8_t BitMap1[8] = {   // store in program memory to save RAM
        B00011000,
        B00111100,
        B00011000,
        B00000000,
        B00011000,
        B00011000,
        B00011000,
        B00111100
 };
 
 
  PROGMEM prog_uint8_t BitMap3[8] = {   // store in program memory to save RAM
        B00000000,
        B11100111,
        B11100111,
        B01111110,
        B01111110,
        B00111100,
        B00111100,
        B00011000
 };

byte Map[8];

#define row_no 8
#define col_no 8


void setup()
{
  pinMode(ledPin, OUTPUT);
  pinMode(latchPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
  pinMode(dataPin, OUTPUT);
 
  Serial.begin(9600);

  Timer1.initialize(100);
  Timer1.attachInterrupt(DisplayBitMap);
}




void loop()
{
  // Clear screen
  for(int i=0; i<8; i++){
   Map[i] = 0;
  }
  delay(1000);
 
  // load first pattern
  for(int i=0; i<8; i++){
   Map[i] = pgm_read_byte (&BitMap1[i]);
  }
  delay(1000);

  // Clear screen
  for(int i=0; i<8; i++){
   Map[i] = 0;
  }
  delay(1000);
 
  // load second pattern
  for(int i=0; i<8; i++){
   Map[i] = pgm_read_byte (&BitMap3[i]);
  }
  delay(1000);


}

// Row-Column Scanning
 void DisplayBitMap()
 {
   // Initialize in the off configuration
   int colData;
   int rowData;


   for (byte x=0; x<row_no; ++x) {

   byte data = Map[x];   // fetch data from program memory

   for (byte y=0; y<col_no; ++y) {
     colData=0;
     rowData=255;
   
     if (data & (1<<(col_no-y-1))) {
       // turn on the LED at location (x,y)
       colData = 1 << y;
       rowData &= ~(1 << x);
       } else {
       // turn off the LED at location (x,y)
       colData = 0;
       rowData = 255;
       }
       digitalWrite(latchPin, LOW);
       shiftOut(dataPin, clockPin, LSBFIRST, colData);
       shiftOut(dataPin, clockPin, LSBFIRST, rowData);
       digitalWrite(latchPin, HIGH);
 
     }
   }
}
6  Using Arduino / Programming Questions / Re: pgm_read_byte doesn't work on: October 14, 2012, 06:17:05 am
Thanks, Nick. If I change const to PROGMEM, then it works.
7  Using Arduino / Programming Questions / pgm_read_byte doesn't work on: October 13, 2012, 08:24:21 pm
Hi, I want to use the flash memory of my Arduino Nano 168, but somehow it gives strange results.

Here is the code:
Code:
const prog_uint8_t BitMap[8] = {   // store in program memory to save RAM
        B10000000,
        B00000000,
        B00000000,
        B00000000,
        B00000000,
        B00000000,
        B00000000,
        B00000000,
 };
 
 void setup()
{
  Serial.begin(9600);

}


void loop()
{

  Serial.print(BitMap[0]);
  Serial.print("    ");
  Serial.print(pgm_read_byte (&BitMap[0]));
  Serial.print("    ");
 
}

The values BitMapp[0] and pgm_read_byte (&BitMap[0]) are different.
BitMapp[0] is 128 (correct), but pgm_read_byte (&BitMap[0]) gives 144 and sometimes different depending on where i put the print command.

And why would one need pgm_read_byte at all. Why not just use BitMapp[0]?

thanks..


8  Using Arduino / LEDs and Multiplexing / LED Matrix Fading with TLC5940 in column-row scanning possible? on: October 11, 2012, 08:50:37 am
Hi, I want to make dynamic patterns on a 8x24 LED matrix, with fading effects on each individual LED. I know I can use TLC5940 to expand the PWM outputs of my arduino nano. But can I connect the LEDs in the column-row scanning configuration while still having these effects? I hope to save up the number of pins I have to use. Thanks
Pages: [1]