Led Matrix with 4794--CODING

Hello, I’m doing a project where I need help with coding a matrix of 10*8 LEDs, each column of 8 driven by the 4794 LED driver. (datasheet here: http://www.standardics.nxp.com/products/hef/datasheet/hef4794b.pdf )

Now i have absolutely no coding experience, but i’ve been trying to study/manipulate the example codes and have been to some extent successful. But I only need the matrix to be scrolling text from one side to another, so i figured that I could code each letter/ pattern i make for only one of the 4794 chips, and then send that data to the next one down the line, while continuing to form the letters on the first column of 8 and continue that process till it reaches the end. Would such a code be possible? is there a better way?

I’m planning on driving the 13 I/O pins needed from the arduino board itself-- 10 data pins, one for each 4794–1 clock pin for all chips–one OE pin–and one strobe pin.

So how would i be able to take the value stored in dato (as shown in the LEDDriver example here: http://www.arduino.cc/en/Tutorial/LEDDriver ) from one column of 8, then apply that to the next?

okay sorry, i didn’t remember to add on some (horribly broken) code:

int dataArray[] = {1, 2, 3, 4, 5, 6, 7, 9, 12, 13};
int strob = 8;
int clock = 10;
int oe = 11;
int count = 0;
int datacount = 0;
int datoArray[] = {5, 255, 0, 1, 2, 1, 255, 1, 0, 5, 5};

void setup()
{
  beginSerial(9600);
  pinMode(data, OUTPUT);
  pinMode(clock, OUTPUT);
  pinMode(strob, OUTPUT);
  pinMode(oe, OUTPUT);
}

void PulseClock(void) {
    digitalWrite(clock, LOW);
    delayMicroseconds(20);
    digitalWrite(clock, HIGH);
    delayMicroseconds(50);
    digitalWrite(clock, LOW);
}

void loop()
{
   dato = datoArray(datacount);
   for (count = 0; count < 8; count++) {
    digitalWrite(dataArray(datacount), datoArray(datacount) & 01);
    dato>>=1;
    if (count == 7){
    digitalWrite(oe, LOW);
    digitalWrite(strob, HIGH);

    }
    PulseClock();
     digitalWrite(oe, HIGH);
 }

  delayMicroseconds(20);
  digitalWrite(strob, LOW);
  delay(100);


  serialWrite(10);
  serialWrite(13);
  datacount + 1;
  for (datacount = 9; datacount = 0)
 delay(100);                  // waits for a moment
}

i hope you can at least, a little bit, try to see what i’m doing here. (because i don’t really haha)

so i have two arrays; one controls the output pin and one controls the data that is fed out rom the output pins. so uhh does anyone have glaring insights to what i’m doing horribly wrong? XD

(sorry for leeching off the community–i’m not really of any use for tech insights but i hope to be helpful eventually)

See this: http://arduino.pastebin.com/f367139ea
:slight_smile:

thanks! the code compiles now (with minor tweaking i could figure out), so that i can at least try it out and upload it to the board.

Your question of what is dato: dato was what was being used to store the byte that goes into the shift-register LED driver. like in the LED driver example: http://www.arduino.cc/en/Tutorial/LEDDriver only i made mine an array.

will update with news when i test it

murr…

i’ve got problems; i tried the code that i modified to suit/work, but that didn’t work. so then i figured, oh hey it might be my wiring, i should try the LED driver example. So i wired that up, and gave it a go. Staring back at me was a slew of error messages from the code here:

these were the messages:

C:\DOCUME~1\Family\LOCALS~1\Temp\build31919.tmp\core.a(HardwareSerial.cpp.o): In function `__vector_18’:

C:\Documents and Settings\Family\My Documents\Arduino\arduino-0015-win\arduino-0015\hardware\cores\arduino/HardwareSerial.cpp:95: multiple definition of `__vector_18’

C:\DOCUME~1\Family\LOCALS~1\Temp\build31919.tmp\core.a(wiring_serial.c.o):C:\Documents and Settings\Family\My Documents\Arduino\arduino-0015-win\arduino-0015\hardware\cores\arduino/wiring_serial.c:112: first defined here

c:/documents and settings/family/my documents/arduino/arduino-0015-win/arduino-0015/hardware/tools/avr/bin/…/lib/gcc/avr/4.3.2/…/…/…/…/avr/bin/ld.exe: Warning: size of symbol `rx_buffer’ changed from 128 in C:\DOCUME~1\Family\LOCALS~1\Temp\build31919.tmp\core.a(wiring_serial.c.o) to 132 in C:\DOCUME~1\Family\LOCALS~1\Temp\build31919.tmp\core.a(HardwareSerial.cpp.o)

Couldn’t determine program size: C:\Documents and Settings\Family\My Documents\Arduino\arduino-0015-win\arduino-0015\hardware/tools/avr/bin/avr-size: ‘C:\DOCUME~1\Family\LOCALS~1\Temp\build31919.tmp\LedDriver.hex’: No such file

er… yeah.

so then i realized those serialWrite things weren’t really doing anything (i think) and then got rid of those. it compiled, but then when i ran it it wouldn’t light the LEDs. So i checked my wiring. four times. right now the code that i got from the LEDDriver example now looks like this;

/* Shift Out Data
 * --------------
 * 
 * Shows a byte, stored in "dato" on a set of 8 LEDs
 *
 * (copyleft) 2005 K3, Malmo University
 * @author: David Cuartielles, Marcus Hannerstig
 * @hardware: David Cuartielles, Marcos Yarza
 * @project: made for SMEE - Experiential Vehicles
 */


int data = 9;
int strob = 8;
int clock = 10;
int oe = 11;
int count = 0;
int dato = 0;

void setup()
{
  pinMode(data, OUTPUT);
  pinMode(clock, OUTPUT);
  pinMode(strob, OUTPUT);
  pinMode(oe, OUTPUT);
}

void PulseClock(void) {
    digitalWrite(clock, LOW);
    delayMicroseconds(20);
    digitalWrite(clock, HIGH);
    delayMicroseconds(50);
    digitalWrite(clock, LOW);
}

void loop()
{
   dato = 5;
   for (count = 0; count < 8; count++) {
    digitalWrite(data, dato & 01);
    dato>>=1;
    if (count == 7){
    digitalWrite(oe, LOW);
    digitalWrite(strob, HIGH);

    }
    PulseClock();
     digitalWrite(oe, HIGH);
 }

  delayMicroseconds(20);
  digitalWrite(strob, LOW);
  delay(100);                  // waits for a moment
}

any ideas what might be wrong? i can’t figure it out at all, so i went back and checked the knight rider example and wired that up and that works fine. so i have no idea… hrrm.

(sorry for bumping)