Tutorial.LEDDriver History

Hide minor edits - Show changes to markup

June 07, 2010, at 02:57 PM by Equipo Traduccion -
Changed lines 1-8 from:

LED Driver

This example makes use of an LED Driver in order to control an almost endless amount of LEDs with only 4 pins. We use the 4794 from Philips. There is more information about this microchip that you will find in its datasheet.

An LED Driver has a shift register embedded that will take data in serial format and transfer it to parallel. It is possible to daisy chain this chip increasing the total amount of LEDs by 8 each time.

The code example you will see here is taking a value stored in the variable dato and showing it as a decoded binary number. E.g. if dato is 1, only the first LED will light up; if dato is 255 all the LEDs will light up.

to:

Controlador LED

Este ejemplo utiliza un controlador LED que nos permite controlar una cantidad casi ilimitada de LEDs con tan solo 4 pins. Utilizamos el 4794 de Philips. Hay más información acerca de este microchop que podras encontrar en su datasheet. Un controlador LED tiene un shift register incrustado que recibe datos en forma serial y los transfiere en paralelo. Es posible formar una cadena con este chip incrementando la cantidad total de LEDs en 8 por cada unidad.

El codigo de ejemplo que aqui se aprecia toma un valor almacenado en la varibale dato y lo muestra como un numero binario decodificado. Ej: si dato es 1, solo el primer LED se enciende; si dato es 255 todos los LEDs se encenderan.

Changed lines 10-11 from:

Example of connection of a 4794

to:

Ejemplo de conexion de un 4794

Changed line 17 from:
 * Shows a byte, stored in "dato" on a set of 8 LEDs
to:
 * Muestra un byte, almacenado en "dato" en un grupo de 8 LEDs.
Changed line 20 from:
 * @author: David Cuartielles, Marcus Hannerstig
to:
 * @autor: David Cuartielles, Marcus Hannerstig
Changed line 22 from:
 * @project: made for SMEE - Experiential Vehicles
to:
 * @proyecto: made for SMEE - Experiential Vehicles
Changed line 73 from:
 delay(100);                  // waits for a moment
to:
 delay(100);                  // espera por un momento.
November 11, 2005, at 08:45 AM by 81.236.128.105 -
Changed line 73 from:
 delay(100);                  // waits for a second
to:
 delay(100);                  // waits for a moment
November 10, 2005, at 09:00 PM by 195.178.229.25 -
Added lines 1-77:

LED Driver

This example makes use of an LED Driver in order to control an almost endless amount of LEDs with only 4 pins. We use the 4794 from Philips. There is more information about this microchip that you will find in its datasheet.

An LED Driver has a shift register embedded that will take data in serial format and transfer it to parallel. It is possible to daisy chain this chip increasing the total amount of LEDs by 8 each time.

The code example you will see here is taking a value stored in the variable dato and showing it as a decoded binary number. E.g. if dato is 1, only the first LED will light up; if dato is 255 all the LEDs will light up.

http://static.flickr.com/30/61941877_d74eae045b.jpg

Example of connection of a 4794

 
/* 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()
{
  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 = 5;
   for (count = 0; count < 8; count++) {
    digitalWrite(data, dato & 01);
    //serialWrite((dato & 01) + 48);
    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);
 delay(100);                  // waits for a second
}



Share