Hide minor edits - Show changes to markup
En algun momento surge la necesidad de usar mas pines de salida que las que trae la propia Arduino y necesitas ampliarlas, esto se hace con un registro de
desplazamiento. Este ejemplo está basado en el integrado 74HC595. En la hoja tecnica de datos se refieren a este integrado como un "registro de
desplazamiento de 8 bits con entrada serie, salida serie o paralelo con latch (bloqueo); 3 estados.". En otras palabras, puedes usarlo para controlar 8
salidas simultaneas usando unos pocos pines del microcontrolador. Incluso se pueden enlazar varios integrados de manera que ampliamos el numero de salidas
mucho mas. (Para encontrar integrados equivalentes en otros fabricantes hay que buscar "595" o "596" en sus números de referencia, hay muchos. El integrado
STP16C596 por ejemplo posee 16 salidas y elimina la resistencias en serie.)
El modo de funcionamiento es algo llamado "comunicación serie sincrona", por ejemplo, tu puedes transmitir un byte enviando pulsos altos y bajos por un pin
mientras en un segundo pin, el pin de reloj (clock) vas enviando pulsos constantes para diferenciar los bits enviados por el primer pin. Este modo de
comunicación difiere con la "comunicación seri asincrona" de la función Serial.begin() en la que emisor y receptor fijan de forma independiente una velocidad
de transferencia. Una vez que se ha transmitido el byte completo al registro los valores altos (HIGH) y bajos (LOW) de cada bit se asignan a los pines de
salida. Esta es la "salida paralelo", teniendo los valores situados en los pines que deseamos.
La "salida serie" de este integrado se basa en un pin extra que retransmite la información serie recibida desde el microcontrolador sin cambios. Esto
significa que podemos encadenar dos integrados 74HC595 y transmitir 16 bits (2 bytes) donde los primeros 8 bits "atraviesen" el primer integrado
almacenandose en el segundo. Esto lo veremos en uno de los ejemplos.
"3 estados" se refiere al hecho de que podemos seleccionar los pines de salida como alto (HIGH), bajo (LOW) or "[[http://en.wikipedia.org/wiki/High_impedance
| alta impedancia]]." Al contrario que HIGH y LOW no podemos seleccionar los pines para alta impedancia de forma individual. Solo podemos seleccionarlo para
todos los pines a un tiempo, esto es algo tan especializado que no es mostrado en los ejemplos.
En algun momento surge la necesidad de usar mas pines de salida que las que trae la propia Arduino y necesitas ampliarlas, esto se hace con un registro de desplazamiento. Este ejemplo está basado en el integrado 74HC595. En la hoja tecnica de datos se refieren a este integrado como un "registro de desplazamiento de 8 bits con entrada serie, salida serie o paralelo con latch (bloqueo); 3 estados.". En otras palabras, puedes usarlo para controlar 8 salidas simultaneas usando unos pocos pines del microcontrolador. Incluso se pueden enlazar varios integrados de manera que ampliamos el numero de salidas mucho mas. (Para encontrar integrados equivalentes en otros fabricantes hay que buscar "595" o "596" en sus números de referencia, hay muchos. El integrado STP16C596 por ejemplo posee 16 salidas y elimina la resistencias en serie.)
El modo de funcionamiento es algo llamado "comunicación serie sincrona", por ejemplo, tu puedes transmitir un byte enviando pulsos altos y bajos por un pin mientras en un segundo pin, el pin de reloj (clock) vas enviando pulsos constantes para diferenciar los bits enviados por el primer pin. Este modo de comunicación difiere con la "comunicación seri asincrona" de la función Serial.begin() en la que emisor y receptor fijan de forma independiente una velocidad de transferencia. Una vez que se ha transmitido el byte completo al registro los valores altos (HIGH) y bajos (LOW) de cada bit se asignan a los pines de salida. Esta es la "salida paralelo", teniendo los valores situados en los pines que deseamos.
La "salida serie" de este integrado se basa en un pin extra que retransmite la información serie recibida desde el microcontrolador sin cambios. Esto significa que podemos encadenar dos integrados 74HC595 y transmitir 16 bits (2 bytes) donde los primeros 8 bits "atraviesen" el primer integrado almacenandose en el segundo. Esto lo veremos en uno de los ejemplos.
"3 estados" se refiere al hecho de que podemos seleccionar los pines de salida como alto (HIGH), bajo (LOW) or "alta impedancia." Al contrario que HIGH y LOW no podemos seleccionar los pines para alta impedancia de forma individual. Solo podemos seleccionarlo para todos los pines a un tiempo, esto es algo tan especializado que no es mostrado en los ejemplos.
Esta configuración hace que todas las salidas estén activas y disponibles todo el tiempo. El inconveniente de esta configuracion es que los leds parpadearan
en su ultimo estado o de forma aleatoria cada vez que encendemos el circuito y antes de que el programa arranque. Esto se puede corregir controlando los
pines MR y OE desde la Arduino pero por el momento funciona y deja libres mas pines en la Arduino.
Esta configuración hace que todas las salidas estén activas y disponibles todo el tiempo. El inconveniente de esta configuracion es que los leds parpadearan en su ultimo estado o de forma aleatoria cada vez que encendemos el circuito y antes de que el programa arranque. Esto se puede corregir controlando los pines MR y OE desde la Arduino pero por el momento funciona y deja libres mas pines en la Arduino.
Desde ahora serán conocidos como dataPin (DS), clockPin (SH_CP) y latchPin (ST_CP) respectively. Aviso sobre el condensador de 0.1uF (100nF), si detecta
parpadeos cuando activa el latchpin puede cambiar este valor hasta corregirlo.
Desde ahora serán conocidos como dataPin (DS), clockPin (SH_CP) y latchPin (ST_CP) respectively. Aviso sobre el condensador de 0.1uF (100nF), si detecta parpadeos cuando activa el latchpin puede cambiar este valor hasta corregirlo.
En este caso conectamos el catodo (patilla corta) de cada led a masa (gnd), y el anodo (patilla larga) de cada led a su pin respectivo del integrado. Usando
el registro de desplazamiento como suministrador de corriente para encender los led se denomina "fuente de corriente". Algunos registros de desplazamiento no
pueden hacer esto y solo pueden funcionar como "sumidero de corriente" en cuyo caso tendrás que cambiar la dirección de los leds poniendo los anodos (patilla
larga) directamente a 5V y los catodos (patilla corta) a las salidas del integrado. Puedes verificar esto en la hoja de datos específica de tu chip "595".
NOTA: no olvides añadir una resistencia de 220 ohmios en serie con cada led para protegerlo de sobrecargas.
En este caso conectamos el catodo (patilla corta) de cada led a masa (gnd), y el anodo (patilla larga) de cada led a su pin respectivo del integrado. Usando el registro de desplazamiento como suministrador de corriente para encender los led se denomina "fuente de corriente". Algunos registros de desplazamiento no pueden hacer esto y solo pueden funcionar como "sumidero de corriente" en cuyo caso tendrás que cambiar la dirección de los leds poniendo los anodos (patilla larga) directamente a 5V y los catodos (patilla corta) a las salidas del integrado. Puedes verificar esto en la hoja de datos específica de tu chip "595". NOTA: no olvides añadir una resistencia de 220 ohmios en serie con cada led para protegerlo de sobrecargas.
Aqui tenemos tres codigos de ejemplo. El primero es el tipico codigo "Hola Mundo" que simplemente muestra un byte con valor entre 0 y 255. El segundo
programa enciende un led cada vez. El tercero efectua ciclos en un array.
Aqui tenemos tres codigos de ejemplo. El primero es el tipico codigo "Hola Mundo" que simplemente muestra un byte con valor entre 0 y 255. El segundo programa enciende un led cada vez. El tercero efectua ciclos en un array.

del 595 -]

de temporizaciones del 595 -]
Este código está basado en la información de arriba, temporizaciones y tabla logica. La tabla logica nos muestra basicamente lo que nos interesa saber sobre
lo que ocurre cuando usamos el integrado, como la forma en que los datos se almacenan en la memoria interna del registro de desplazamiento, la manera en que
los datos pasan de la memoria a los pines al pasar el latchpin de LOW a HIGH haciendo que se enciendan los LEDS.


Este código está basado en la información de arriba, temporizaciones y tabla logica. La tabla logica nos muestra basicamente lo que nos interesa saber sobre lo que ocurre cuando usamos el integrado, como la forma en que los datos se almacenan en la memoria interna del registro de desplazamiento, la manera en que los datos pasan de la memoria a los pines al pasar el latchpin de LOW a HIGH haciendo que se enciendan los LEDS.
Dos de esas conecciones simplemente alargan las lineas de reloj y latch desde la Arduino hasta el segundo integrado (cables amarillo y verde). El cable azul
sale desde la salida serie del primer integrado (pin 9) hasta la entrada serie del segundo integrado (pin 14).
Dos de esas conecciones simplemente alargan las lineas de reloj y latch desde la Arduino hasta el segundo integrado (cables amarillo y verde). El cable azul sale desde la salida serie del primer integrado (pin 9) hasta la entrada serie del segundo integrado (pin 14).
Solo tenemos que añadir una linea de codigo al ejemplo 1 para enviar un segundo byte. Esto fuerza al primer registro de desplazamiento pasar el primer byte a
traves de él hacia el segundo registro encendiendo los LEDs verdes. El segundo byte se muestra en los LEDs rojos.
Solo tenemos que añadir una linea de codigo al ejemplo 1 para enviar un segundo byte. Esto fuerza al primer registro de desplazamiento pasar el primer byte a traves de él hacia el segundo registro encendiendo los LEDs verdes. El segundo byte se muestra en los LEDs rojos.
Comparando este codigo con el del ejemplo 1 veras que hay muy poca diferencia. La funcion blinkAll() ha sido cambiada por la funcion blinkAll_2Bytes() para
incorporar los 16 bits. En la version 1 la activacion del latchpin estaba dentro de la subfuncion lightShiftPinA() y lightShiftPinB(), en este ejemplo lo
hemos movido al bucle principal por la necesidad de ejecutar cada subfunción dos veces por linea una para los LEDs verdes y otra para los rojos.
Comparando este codigo con el del ejemplo 1 veras que hay muy poca diferencia. La funcion blinkAll() ha sido cambiada por la funcion blinkAll_2Bytes() para incorporar los 16 bits. En la version 1 la activacion del latchpin estaba dentro de la subfuncion lightShiftPinA() y lightShiftPinB(), en este ejemplo lo hemos movido al bucle principal por la necesidad de ejecutar cada subfunción dos veces por linea una para los LEDs verdes y otra para los rojos.
Como en el ejemplo 2.2 este ejemplo 2.3 utiliza la nueva función blinkAll_2bytes(). La gran diferencia con respecto al ejemplo 1.3 es solo que en vez de
existir una variable llamada "data" y un simple array llamado "dataArray" ahora tenemos definidos dataRED, dataGREEN, dataArrrayRED y dataArrayGREEN.
Como en el ejemplo 2.2 este ejemplo 2.3 utiliza la nueva función blinkAll_2bytes(). La gran diferencia con respecto al ejemplo 1.3 es solo que en vez de existir una variable llamada "data" y un simple array llamado "dataArray" ahora tenemos definidos dataRED, dataGREEN, dataArrrayRED y dataArrayGREEN.
En algun momento surge la necesidad de usar mas pines de salida que las que trae la propia Arduino y necesitas ampliarlas, esto se hace con un registro de desplazamiento. Este ejemplo está basado en el integrado 74HC595. En la hoja tecnica de datos se refieren a este integrado como un "registro de desplazamiento de 8 bits con entrada serie, salida serie o paralelo con latch (bloqueo); 3 estados.". En otras palabras, puedes usarlo para controlar 8 salidas simultaneas usando unos pocos pines del microcontrolador. Incluso se pueden enlazar varios integrados de manera que ampliamos el numero de salidas mucho mas. (Para encontrar integrados equivalentes en otros fabricantes hay que buscar "595" o "596" en sus números de referencia, hay muchos. El integrado STP16C596 por ejemplo posee 16 salidas y elimina la resistencias en serie.)
El modo de funcionamiento es algo llamado "comunicación serie sincrona", por ejemplo, tu puedes transmitir un byte enviando pulsos altos y bajos por un pin mientras en un segundo pin, el pin de reloj (clock) vas enviando pulsos constantes para diferenciar los bits enviados por el primer pin. Este modo de comunicación difiere con la "comunicación seri asincrona" de la función Serial.begin() en la que emisor y receptor fijan de forma independiente una velocidad de transferencia. Una vez que se ha transmitido el byte completo al registro los valores altos (HIGH) y bajos (LOW) de cada bit se asignan a los pines de salida. Esta es la "salida paralelo", teniendo los valores situados en los pines que deseamos.
La "salida serie" de este integrado se basa en un pin extra que retransmite la información serie recibida desde el microcontrolador sin cambios. Esto significa que podemos encadenar dos integrados 74HC595 y transmitir 16 bits (2 bytes) donde los primeros 8 bits "atraviesen" el primer integrado almacenandose en el segundo. Esto lo veremos en uno de los ejemplos.
"3 estados" se refiere al hecho de que podemos seleccionar los pines de salida como alto (HIGH), bajo (LOW) or "alta impedancia." Al contrario que HIGH y LOW no podemos seleccionar los pines para alta impedancia de forma individual. Solo podemos seleccionarlo para todos los pines a un tiempo, esto es algo tan especializado que no es mostrado en los ejemplos.
En algun momento surge la necesidad de usar mas pines de salida que las que trae la propia Arduino y necesitas ampliarlas, esto se hace con un registro de
desplazamiento. Este ejemplo está basado en el integrado 74HC595. En la hoja tecnica de datos se refieren a este integrado como un "registro de
desplazamiento de 8 bits con entrada serie, salida serie o paralelo con latch (bloqueo); 3 estados.". En otras palabras, puedes usarlo para controlar 8
salidas simultaneas usando unos pocos pines del microcontrolador. Incluso se pueden enlazar varios integrados de manera que ampliamos el numero de salidas
mucho mas. (Para encontrar integrados equivalentes en otros fabricantes hay que buscar "595" o "596" en sus números de referencia, hay muchos. El integrado
STP16C596 por ejemplo posee 16 salidas y elimina la resistencias en serie.)
El modo de funcionamiento es algo llamado "comunicación serie sincrona", por ejemplo, tu puedes transmitir un byte enviando pulsos altos y bajos por un pin
mientras en un segundo pin, el pin de reloj (clock) vas enviando pulsos constantes para diferenciar los bits enviados por el primer pin. Este modo de
comunicación difiere con la "comunicación seri asincrona" de la función Serial.begin() en la que emisor y receptor fijan de forma independiente una velocidad
de transferencia. Una vez que se ha transmitido el byte completo al registro los valores altos (HIGH) y bajos (LOW) de cada bit se asignan a los pines de
salida. Esta es la "salida paralelo", teniendo los valores situados en los pines que deseamos.
La "salida serie" de este integrado se basa en un pin extra que retransmite la información serie recibida desde el microcontrolador sin cambios. Esto
significa que podemos encadenar dos integrados 74HC595 y transmitir 16 bits (2 bytes) donde los primeros 8 bits "atraviesen" el primer integrado
almacenandose en el segundo. Esto lo veremos en uno de los ejemplos.
"3 estados" se refiere al hecho de que podemos seleccionar los pines de salida como alto (HIGH), bajo (LOW) or "[[http://en.wikipedia.org/wiki/High_impedance
| alta impedancia]]." Al contrario que HIGH y LOW no podemos seleccionar los pines para alta impedancia de forma individual. Solo podemos seleccionarlo para
todos los pines a un tiempo, esto es algo tan especializado que no es mostrado en los ejemplos.
Esta configuración hace que todas las salidas estén activas y disponibles todo el tiempo. El inconveniente de esta configuracion es que los leds parpadearan en su ultimo estado o de forma aleatoria cada vez que encendemos el circuito y antes de que el programa arranque. Esto se puede corregir controlando los pines MR y OE desde la Arduino pero por el momento funciona y deja libres mas pines en la Arduino.
Esta configuración hace que todas las salidas estén activas y disponibles todo el tiempo. El inconveniente de esta configuracion es que los leds parpadearan
en su ultimo estado o de forma aleatoria cada vez que encendemos el circuito y antes de que el programa arranque. Esto se puede corregir controlando los
pines MR y OE desde la Arduino pero por el momento funciona y deja libres mas pines en la Arduino.
Desde ahora serán conocidos como dataPin (DS), clockPin (SH_CP) y latchPin (ST_CP) respectively. Aviso sobre el condensador de 0.1uF (100nF), si detecta parpadeos cuando activa el latchpin puede cambiar este valor hasta corregirlo.
Desde ahora serán conocidos como dataPin (DS), clockPin (SH_CP) y latchPin (ST_CP) respectively. Aviso sobre el condensador de 0.1uF (100nF), si detecta
parpadeos cuando activa el latchpin puede cambiar este valor hasta corregirlo.
En este caso conectamos el catodo (patilla corta) de cada led a masa (gnd), y el anodo (patilla larga) de cada led a su pin respectivo del integrado. Usando el registro de desplazamiento como suministrador de corriente para encender los led se denomina "surtidor de corriente". Algunos registros de desplazamiento no pueden hacer esto y solo pueden funcionar como "sumidero de corriente" en cuyo caso tendrás que cambiar la dirección de los leds poniendo los anodos (patilla larga) directamente a 5V y los catodos (patilla corta) a las salidas del integrado. Puedes verificar esto en la hoja de datos específica de tu chip "595". NOTA: no olvides añadir una resistencia de 220 ohmios en serie con cada led para protegerlo de sobrecargas.
En este caso conectamos el catodo (patilla corta) de cada led a masa (gnd), y el anodo (patilla larga) de cada led a su pin respectivo del integrado. Usando
el registro de desplazamiento como suministrador de corriente para encender los led se denomina "fuente de corriente". Algunos registros de desplazamiento no
pueden hacer esto y solo pueden funcionar como "sumidero de corriente" en cuyo caso tendrás que cambiar la dirección de los leds poniendo los anodos (patilla
larga) directamente a 5V y los catodos (patilla corta) a las salidas del integrado. Puedes verificar esto en la hoja de datos específica de tu chip "595".
NOTA: no olvides añadir una resistencia de 220 ohmios en serie con cada led para protegerlo de sobrecargas.
Aqui tenemos tres codigos de ejemplo. El primero es el tipico codigo "Hola Mundo" que simplemente muestra un byte con valor entre 0 y 255. El segundo programa enciende un led cada vez. El tercero efectua ciclos en un array.


The code is based on two pieces of information in the datasheet: the timing diagram and the logic table. The logic table is what tells you that basically everything important happens on an up beat. When the clockPin goes from low to high, the shift register reads the state of the data pin. As the data gets shifted in it is saved in an internal memory register. When the latchPin goes from low to high the sent data gets moved from the shift registers aforementioned memory register into the output pins, lighting the LEDs.
Code Sample 1.1 Hello World
Code Sample 1.2 One by One
Code Sample 1.3 Two shift registers
Aqui tenemos tres codigos de ejemplo. El primero es el tipico codigo "Hola Mundo" que simplemente muestra un byte con valor entre 0 y 255. El segundo
programa enciende un led cada vez. El tercero efectua ciclos en un array.
COMPARAR DESCRIPCIÓN CON CODIGOS FUENTE, PARECE QUE HAN AÑADIDO PROGRAMAS SIN DOCUMENTAR CORRECTAMENTE

del 595 -]

de temporizaciones del 595 -]
Este código está basado en la información de arriba, temporizaciones y tabla logica. La tabla logica nos muestra basicamente lo que nos interesa saber sobre
lo que ocurre cuando usamos el integrado, como la forma en que los datos se almacenan en la memoria interna del registro de desplazamiento, la manera en que
los datos pasan de la memoria a los pines al pasar el latchpin de LOW a HIGH haciendo que se enciendan los LEDS.
Code Sample 1.1 Hola mundo
Code Sample 1.2 Uno a Uno
Code Sample 1.3 Dos registros de desplazamiento
In this example you'll add a second shift register, doubling the number of output pins you have while still using the same number of pins from the Arduino.
Starting from the previous example, you should put a second shift register on the board. It should have the same leads to power and ground.
En este ejemplo añadiremos un segundo integrado, duplicando el número de pines de salida usando el mismo número de pines de la Arduino.
Comenzando desde el ejemplo anterior podemos añadir un segundo integrado en la protoboard. Usamos las mismas conexiones de tensión y masa.
Two of these connections simply extend the same clock and latch signal from the Arduino to the second shift register (yellow and green wires). The blue wire is going from the serial out pin (pin 9) of the first shift register to the serial data input (pin 14) of the second register.
Dos de esas conecciones simplemente alargan las lineas de reloj y latch desde la Arduino hasta el segundo integrado (cables amarillo y verde). El cable azul
sale desde la salida serie del primer integrado (pin 9) hasta la entrada serie del segundo integrado (pin 14).
In this case I added green ones so when reading the code it is clear which byte is going to which set of LEDs
En este caso añadimos leds de color verde para diferenciar los bytes enviados a cada integrado con mas facilidad.
Here again are three code samples. If you are curious, you might want to try the samples from the first example with this circuit set up just to see what happens.
Code Sample 2.1 Dual Binary Counters
There is only one extra line of code compared to the first code sample from Example 1. It sends out a second byte. This forces the first shift register, the one directly attached to the Arduino, to pass the first byte sent through to the second register, lighting the green LEDs. The second byte will then show up on the red LEDs.
Code Sample 2.2 2 Byte One By One
Comparing this code to the similar code from Example 1 you see that a little bit more has had to change. The blinkAll() function has been changed to the blinkAll_2Bytes() function to reflect the fact that now there are 16 LEDs to control. Also, in version 1 the pulsings of the latchPin were situated inside the subfunctions lightShiftPinA and lightShiftPinB(). Here they need to be moved back into the main loop to accommodate needing to run each subfunction twice in a row, once for the green LEDs and once for the red ones.
Code Sample 2.3 - Dual Defined Arrays
Like sample 2.2, sample 2.3 also takes advantage of the new blinkAll_2bytes() function. 2.3's big difference from sample 1.3 is only that instead of just a single variable called "data" and a single array called "dataArray" you have to have a dataRED, a dataGREEN, dataArrayRED, dataArrayGREEN defined up front. This means that line
De nuevo tenemos tres códigos fuente. Si eres curioso intentarás por ti mismo extender el primer ejemplo para usar ambos integrados y ver lo que ocurre.
Codigo de ejemplo 2.1 Doble Contador Binario
Solo tenemos que añadir una linea de codigo al ejemplo 1 para enviar un segundo byte. Esto fuerza al primer registro de desplazamiento pasar el primer byte a
traves de él hacia el segundo registro encendiendo los LEDs verdes. El segundo byte se muestra en los LEDs rojos.
Codigo de ejemplo 2.2 2 Bytes uno a uno
Comparando este codigo con el del ejemplo 1 veras que hay muy poca diferencia. La funcion blinkAll() ha sido cambiada por la funcion blinkAll_2Bytes() para
incorporar los 16 bits. En la version 1 la activacion del latchpin estaba dentro de la subfuncion lightShiftPinA() y lightShiftPinB(), en este ejemplo lo
hemos movido al bucle principal por la necesidad de ejecutar cada subfunción dos veces por linea una para los LEDs verdes y otra para los rojos.
Codigo de ejemplo 2.3 - Definicion de doble arrayl
Como en el ejemplo 2.2 este ejemplo 2.3 utiliza la nueva función blinkAll_2bytes(). La gran diferencia con respecto al ejemplo 1.3 es solo que en vez de
existir una variable llamada "data" y un simple array llamado "dataArray" ahora tenemos definidos dataRED, dataGREEN, dataArrrayRED y dataArrayGREEN. Esto siginfica que esta linea
becomes
se convierte en
and
por otro lado esta llamada
becomes
pasa a formularse así.
En algun momento surge la necesidad de usar mas pines de salida que las que trae la propia Arduino y necesitas ampliarlas, esto se hace con un registro de desplazamiento. Este ejemplo está basado en el integrado 74HC595. En la hoja tecnica de datos se refieren a este integrado como un "registro de desplazamiento de 8 bits con entrada serie, salida serie o paralelo con bloqueo; 3 estados.". En otras palabras, puedes usarlo para controlar 8 salidas simultaneas usando unos pocos pines del microcontrolador. Incluso se pueden enlazar varios integrados de manera que ampliamos el numero de salidas mucho mas. (Para encontrar integrados equivalentes en otros fabricantes hay que buscar "595" o "596" en sus números de referencia, hay muchos. El integrado STP16C596 por ejemplo posee 16 salidas y elimina la resistencias en serie.)
En algun momento surge la necesidad de usar mas pines de salida que las que trae la propia Arduino y necesitas ampliarlas, esto se hace con un registro de desplazamiento. Este ejemplo está basado en el integrado 74HC595. En la hoja tecnica de datos se refieren a este integrado como un "registro de desplazamiento de 8 bits con entrada serie, salida serie o paralelo con latch (bloqueo); 3 estados.". En otras palabras, puedes usarlo para controlar 8 salidas simultaneas usando unos pocos pines del microcontrolador. Incluso se pueden enlazar varios integrados de manera que ampliamos el numero de salidas mucho mas. (Para encontrar integrados equivalentes en otros fabricantes hay que buscar "595" o "596" en sus números de referencia, hay muchos. El integrado STP16C596 por ejemplo posee 16 salidas y elimina la resistencias en serie.)
"3 states" refers to the fact that you can set the output pins as either high, low or "high impedance." Unlike the HIGH and LOW states, you can"t set pins to their high impedance state individually. You can only set the whole chip together. This is a pretty specialized thing to do -- Think of an LED array that might need to be controlled by completely different microcontrollers depending on a specific mode setting built into your project. Neither example takes advantage of this feature and you won"t usually need to worry about getting a chip that has it.
Here is a table explaining the pin-outs adapted from the Phillip's datasheet.
"3 estados" se refiere al hecho de que podemos seleccionar los pines de salida como alto (HIGH), bajo (LOW) or "alta impedancia." Al contrario que HIGH y LOW no podemos seleccionar los pines para alta impedancia de forma individual. Solo podemos seleccionarlo para todos los pines a un tiempo, esto es algo tan especializado que no es mostrado en los ejemplos.
Aqui tenemos la definicion de los pines obtenida de Phillip's datasheet.
(:cell:) Output Pins
(:cell:) Pins de salida
(:cell:) Serial Out
(:cell:) Salida Serie
(:cell:) Master Reclear, active low
(:cell:) Master Reset, activo = low
(:cell:) Shift register clock pin
(:cell:) Pin Clock
(:cell:) Storage register clock pin (latch pin)
(:cell:) Pin Latch
(:cell:) Output enable, active low
(:cell:) Salida disponible, activo = low
(:cell:) Serial data input
(:cell:) Entrada Serie
(:cell:) Positive supply voltage
(:cell:) Voltaje
The first step is to extend your Arduino with one shift register.
Make the following connections:
This set up makes all of the output pins active and addressable all the time. The one flaw of this set up is that you end up with the lights turning on to their last state or something arbitrary every time you first power up the circuit before the program starts to run. You can get around this by controlling the MR and OE pins from your Arduino board too, but this way will work and leave you with more open pins.
El primer paso es ampliar tu Arduino con un registro de desplazamiento
Haz las siguientes conexiones:
Esta configuración hace que todas las salidas estén activas y disponibles todo el tiempo. El inconveniente de esta configuracion es que los leds parpadearan en su ultimo estado o de forma aleatoria cada vez que encendemos el circuito y antes de que el programa arranque. Esto se puede corregir controlando los pines MR y OE desde la Arduino pero por el momento funciona y deja libres mas pines en la Arduino.
From now on those will be refered to as the dataPin, the clockPin and the latchPin respectively. Notice the 0.1"f capacitor on the latchPin, if you have some flicker when the latch pin pulses you can use a capacitor to even it out.
Desde ahora serán conocidos como dataPin (DS), clockPin (SH_CP) y latchPin (ST_CP) respectively. Aviso sobre el condensador de 0.1uF (100nF), si detecta parpadeos cuando activa el latchpin puede cambiar este valor hasta corregirlo.
In this case you should connect the cathode (short pin) of each LED to a common ground, and the anode (long pin) of each LED to its respective shift register output pin. Using the shift register to supply power like this is called sourcing current. Some shift registers can't source current, they can only do what is called sinking current. If you have one of those it means you will have to flip the direction of the LEDs, putting the anodes directly to power and the cathodes (ground pins) to the shift register outputs. You should check the your specific datasheet if you aren"t using a 595 series chip. Don"t forget to add a 220-ohm resistor in series to protect the LEDs from being overloaded.
En este caso conectamos el catodo (patilla corta) de cada led a masa (gnd), y el anodo (patilla larga) de cada led a su pin respectivo del integrado. Usando el registro de desplazamiento como suministrador de corriente para encender los led se denomina "surtidor de corriente". Algunos registros de desplazamiento no pueden hacer esto y solo pueden funcionar como "sumidero de corriente" en cuyo caso tendrás que cambiar la dirección de los leds poniendo los anodos (patilla larga) directamente a 5V y los catodos (patilla corta) a las salidas del integrado. Puedes verificar esto en la hoja de datos específica de tu chip "595". NOTA: no olvides añadir una resistencia de 220 ohmios en serie con cada led para protegerlo de sobrecargas.
Here are three code examples. The first is just some "hello world" code that simply outputs a byte value from 0 to 255. The second program lights one LED at a time. The third cycles through an array.
Aqui tenemos tres codigos de ejemplo. El primero es el tipico codigo "Hola Mundo" que simplemente muestra un byte con valor entre 0 y 255. El segundo programa enciende un led cada vez. El tercero efectua ciclos en un array.
En algun momento surge la necesidad de usar mas pines de salida que las que trae la propia Arduino y necesitas ampliarlas, esto se hace con un
registro de desplazamiento. Este ejemplo está basado en el integrado 74HC595. En la hoja tecnica de datos se refieren a este integrado como un
"registro de desplazamiento de 8 bits con entrada serie, salida serie o paralelo con bloqueo; 3 estados.". En otras palabras, puedes
usarlo para controlar 8 salidas simultaneas usando unos pocos pines del microcontrolador. Incluso se pueden enlazar varios integrados de manera
que ampliamos el numero de salidas mucho mas. (Para encontrar integrados equivalentes en otros fabricantes hay que buscar "595" o "596" en sus
números de referencia, hay muchos. El integrado STP16C596 por ejemplo posee 16 salidas y elimina la resistencias en serie.)
En algun momento surge la necesidad de usar mas pines de salida que las que trae la propia Arduino y necesitas ampliarlas, esto se hace con un registro de desplazamiento. Este ejemplo está basado en el integrado 74HC595. En la hoja tecnica de datos se refieren a este integrado como un "registro de desplazamiento de 8 bits con entrada serie, salida serie o paralelo con bloqueo; 3 estados.". En otras palabras, puedes usarlo para controlar 8 salidas simultaneas usando unos pocos pines del microcontrolador. Incluso se pueden enlazar varios integrados de manera que ampliamos el numero de salidas mucho mas. (Para encontrar integrados equivalentes en otros fabricantes hay que buscar "595" o "596" en sus números de referencia, hay muchos. El integrado STP16C596 por ejemplo posee 16 salidas y elimina la resistencias en serie.)
Started by Carlyn Maw and Tom Igoe Nov, 06
At sometime or another you may run out of pins on your Arduino board and need to extend it with shift registers. This example is based on the 74HC595. The datasheet refers to the 74HC595 as an "8-bit serial-in, serial or parallel-out shift register with output latches; 3-state." In other words, you can use it to control 8 outputs at a time while only taking up a few pins on your microcontroller. You can link multiple registers together to extend your output even more. (Users may also wish to search for other driver chips with "595" or "596" in their part numbers, there are many. The STP16C596 for example will drive 16 LED's and eliminates the series resistors with built-in constant current sources.)
How this all works is through something called "synchronous serial communication," i.e. you can pulse one pin up and down thereby communicating a data byte to the register bit by bit. It's by pulsing second pin, the clock pin, that you delineate between bits. This is in contrast to using the "asynchronous serial communication" of the Serial.begin() function which relies on the sender and the receiver to be set independently to an agreed upon specified data rate. Once the whole byte is transmitted to the register the HIGH or LOW messages held in each bit get parceled out to each of the individual output pins. This is the "parallel output" part, having all the pins do what you want them to do all at once.
The "serial output" part of this component comes from its extra pin which can pass the serial information received from the microcontroller out again unchanged. This means you can transmit 16 bits in a row (2 bytes) and the first 8 will flow through the first register into the second register and be expressed there. You can learn to do that from the second example.
Carlyn Maw and Tom Igoe Nov, 06 Traducción Francisco Reinoso Jun, 10
En algun momento surge la necesidad de usar mas pines de salida que las que trae la propia Arduino y necesitas ampliarlas, esto se hace con un
registro de desplazamiento. Este ejemplo está basado en el integrado 74HC595. En la hoja tecnica de datos se refieren a este integrado como un
"registro de desplazamiento de 8 bits con entrada serie, salida serie o paralelo con bloqueo; 3 estados.". En otras palabras, puedes
usarlo para controlar 8 salidas simultaneas usando unos pocos pines del microcontrolador. Incluso se pueden enlazar varios integrados de manera
que ampliamos el numero de salidas mucho mas. (Para encontrar integrados equivalentes en otros fabricantes hay que buscar "595" o "596" en sus
números de referencia, hay muchos. El integrado STP16C596 por ejemplo posee 16 salidas y elimina la resistencias en serie.)
El modo de funcionamiento es algo llamado "comunicación serie sincrona", por ejemplo, tu puedes transmitir un byte enviando pulsos altos y bajos por un pin mientras en un segundo pin, el pin de reloj (clock) vas enviando pulsos constantes para diferenciar los bits enviados por el primer pin. Este modo de comunicación difiere con la "comunicación seri asincrona" de la función Serial.begin() en la que emisor y receptor fijan de forma independiente una velocidad de transferencia. Una vez que se ha transmitido el byte completo al registro los valores altos (HIGH) y bajos (LOW) de cada bit se asignan a los pines de salida. Esta es la "salida paralelo", teniendo los valores situados en los pines que deseamos.
La "salida serie" de este integrado se basa en un pin extra que retransmite la información serie recibida desde el microcontrolador sin cambios. Esto significa que podemos encadenar dos integrados 74HC595 y transmitir 16 bits (2 bytes) donde los primeros 8 bits "atraviesen" el primer integrado almacenandose en el segundo. Esto lo veremos en uno de los ejemplos.
At sometime or another you may run out of pins on your Arduino board and need to extend it with shift registers. This example is based on the 74HC595. The datasheet refers to the 74HC595 as an �8-bit serial-in, serial or parallel-out shift register with output latches; 3-state.� In other words, you can use it to control 8 outputs at a time while only taking up a few pins on your microcontroller. You can link multiple registers together to extend your output even more. (Users may also wish to search for other driver chips with "595" or "596" in their part numbers, there are many. The STP16C596 for example will drive 16 LED's and eliminates the series resistors with built-in constant current sources.)
How this all works is through something called �synchronous serial communication,� i.e. you can pulse one pin up and down thereby communicating a data byte to the register bit by bit. It's by pulsing second pin, the clock pin, that you delineate between bits. This is in contrast to using the �asynchronous serial communication� of the Serial.begin() function which relies on the sender and the receiver to be set independently to an agreed upon specified data rate. Once the whole byte is transmitted to the register the HIGH or LOW messages held in each bit get parceled out to each of the individual output pins. This is the �parallel output� part, having all the pins do what you want them to do all at once.
The �serial output� part of this component comes from its extra pin which can pass the serial information received from the microcontroller out again unchanged. This means you can transmit 16 bits in a row (2 bytes) and the first 8 will flow through the first register into the second register and be expressed there. You can learn to do that from the second example.
�3 states� refers to the fact that you can set the output pins as either high, low or �high impedance.� Unlike the HIGH and LOW states, you can�t set pins to their high impedance state individually. You can only set the whole chip together. This is a pretty specialized thing to do -- Think of an LED array that might need to be controlled by completely different microcontrollers depending on a specific mode setting built into your project. Neither example takes advantage of this feature and you won�t usually need to worry about getting a chip that has it.
At sometime or another you may run out of pins on your Arduino board and need to extend it with shift registers. This example is based on the 74HC595. The datasheet refers to the 74HC595 as an "8-bit serial-in, serial or parallel-out shift register with output latches; 3-state." In other words, you can use it to control 8 outputs at a time while only taking up a few pins on your microcontroller. You can link multiple registers together to extend your output even more. (Users may also wish to search for other driver chips with "595" or "596" in their part numbers, there are many. The STP16C596 for example will drive 16 LED's and eliminates the series resistors with built-in constant current sources.)
How this all works is through something called "synchronous serial communication," i.e. you can pulse one pin up and down thereby communicating a data byte to the register bit by bit. It's by pulsing second pin, the clock pin, that you delineate between bits. This is in contrast to using the "asynchronous serial communication" of the Serial.begin() function which relies on the sender and the receiver to be set independently to an agreed upon specified data rate. Once the whole byte is transmitted to the register the HIGH or LOW messages held in each bit get parceled out to each of the individual output pins. This is the "parallel output" part, having all the pins do what you want them to do all at once.
The "serial output" part of this component comes from its extra pin which can pass the serial information received from the microcontroller out again unchanged. This means you can transmit 16 bits in a row (2 bytes) and the first 8 will flow through the first register into the second register and be expressed there. You can learn to do that from the second example.
"3 states" refers to the fact that you can set the output pins as either high, low or "high impedance." Unlike the HIGH and LOW states, you can"t set pins to their high impedance state individually. You can only set the whole chip together. This is a pretty specialized thing to do -- Think of an LED array that might need to be controlled by completely different microcontrollers depending on a specific mode setting built into your project. Neither example takes advantage of this feature and you won"t usually need to worry about getting a chip that has it.
(:cell:) Q0 � Q7
(:cell:) Q0 " Q7
(:cell:) Q7�
(:cell:) Q7"
From now on those will be refered to as the dataPin, the clockPin and the latchPin respectively. Notice the 0.1�f capacitor on the latchPin, if you have some flicker when the latch pin pulses you can use a capacitor to even it out.
From now on those will be refered to as the dataPin, the clockPin and the latchPin respectively. Notice the 0.1"f capacitor on the latchPin, if you have some flicker when the latch pin pulses you can use a capacitor to even it out.
In this case you should connect the cathode (short pin) of each LED to a common ground, and the anode (long pin) of each LED to its respective shift register output pin. Using the shift register to supply power like this is called sourcing current. Some shift registers can't source current, they can only do what is called sinking current. If you have one of those it means you will have to flip the direction of the LEDs, putting the anodes directly to power and the cathodes (ground pins) to the shift register outputs. You should check the your specific datasheet if you aren�t using a 595 series chip. Don�t forget to add a 220-ohm resistor in series to protect the LEDs from being overloaded.
In this case you should connect the cathode (short pin) of each LED to a common ground, and the anode (long pin) of each LED to its respective shift register output pin. Using the shift register to supply power like this is called sourcing current. Some shift registers can't source current, they can only do what is called sinking current. If you have one of those it means you will have to flip the direction of the LEDs, putting the anodes directly to power and the cathodes (ground pins) to the shift register outputs. You should check the your specific datasheet if you aren"t using a 595 series chip. Don"t forget to add a 220-ohm resistor in series to protect the LEDs from being overloaded.
Here are three code examples. The first is just some �hello world� code that simply outputs a byte value from 0 to 255. The second program lights one LED at a time. The third cycles through an array.
Here are three code examples. The first is just some "hello world" code that simply outputs a byte value from 0 to 255. The second program lights one LED at a time. The third cycles through an array.
Like sample 2.2, sample 2.3 also takes advantage of the new blinkAll_2bytes() function. 2.3's big difference from sample 1.3 is only that instead of just a single variable called �data� and a single array called �dataArray� you have to have a dataRED, a dataGREEN, dataArrayRED, dataArrayGREEN defined up front. This means that line
Like sample 2.2, sample 2.3 also takes advantage of the new blinkAll_2bytes() function. 2.3's big difference from sample 1.3 is only that instead of just a single variable called "data" and a single array called "dataArray" you have to have a dataRED, a dataGREEN, dataArrayRED, dataArrayGREEN defined up front. This means that line
At sometime or another you may run out of pins on your Arduino board and need to extend it with shift registers. This example is based on the 74HC595. The datasheet refers to the 74HC595 as an 8-bit serial-in, serial or parallel-out shift register with output latches; 3-state. In other words, you can use it to control 8 outputs at a time while only taking up a few pins on your microcontroller. You can link multiple registers together to extend your output even more. (Users may also wish to search for other driver chips with "595" or "596" in their part numbers, there are many. The STP16C596 for example will drive 16 LED's and eliminates the series resistors with built-in constant current sources.)
How this all works is through something called synchronous serial communication, i.e. you can pulse one pin up and down thereby communicating a data byte to the register bit by bit. It's by pulsing second pin, the clock pin, that you delineate between bits. This is in contrast to using the asynchronous serial communication of the Serial.begin() function which relies on the sender and the receiver to be set independently to an agreed upon specified data rate. Once the whole byte is transmitted to the register the HIGH or LOW messages held in each bit get parceled out to each of the individual output pins. This is the parallel output part, having all the pins do what you want them to do all at once.
The serial output part of this component comes from its extra pin which can pass the serial information received from the microcontroller out again unchanged. This means you can transmit 16 bits in a row (2 bytes) and the first 8 will flow through the first register into the second register and be expressed there. You can learn to do that from the second example.
3 states refers to the fact that you can set the output pins as either high, low or high impedance. Unlike the HIGH and LOW states, you cant set pins to their high impedance state individually. You can only set the whole chip together. This is a pretty specialized thing to do -- Think of an LED array that might need to be controlled by completely different microcontrollers depending on a specific mode setting built into your project. Neither example takes advantage of this feature and you wont usually need to worry about getting a chip that has it.
At sometime or another you may run out of pins on your Arduino board and need to extend it with shift registers. This example is based on the 74HC595. The datasheet refers to the 74HC595 as an �8-bit serial-in, serial or parallel-out shift register with output latches; 3-state.� In other words, you can use it to control 8 outputs at a time while only taking up a few pins on your microcontroller. You can link multiple registers together to extend your output even more. (Users may also wish to search for other driver chips with "595" or "596" in their part numbers, there are many. The STP16C596 for example will drive 16 LED's and eliminates the series resistors with built-in constant current sources.)
How this all works is through something called �synchronous serial communication,� i.e. you can pulse one pin up and down thereby communicating a data byte to the register bit by bit. It's by pulsing second pin, the clock pin, that you delineate between bits. This is in contrast to using the �asynchronous serial communication� of the Serial.begin() function which relies on the sender and the receiver to be set independently to an agreed upon specified data rate. Once the whole byte is transmitted to the register the HIGH or LOW messages held in each bit get parceled out to each of the individual output pins. This is the �parallel output� part, having all the pins do what you want them to do all at once.
The �serial output� part of this component comes from its extra pin which can pass the serial information received from the microcontroller out again unchanged. This means you can transmit 16 bits in a row (2 bytes) and the first 8 will flow through the first register into the second register and be expressed there. You can learn to do that from the second example.
�3 states� refers to the fact that you can set the output pins as either high, low or �high impedance.� Unlike the HIGH and LOW states, you can�t set pins to their high impedance state individually. You can only set the whole chip together. This is a pretty specialized thing to do -- Think of an LED array that might need to be controlled by completely different microcontrollers depending on a specific mode setting built into your project. Neither example takes advantage of this feature and you won�t usually need to worry about getting a chip that has it.
(:cell:) Q0 Q7
(:cell:) Q0 � Q7
(:cell:) Q7
(:cell:) Q7�
From now on those will be refered to as the dataPin, the clockPin and the latchPin respectively. Notice the 0.1f capacitor on the latchPin, if you have some flicker when the latch pin pulses you can use a capacitor to even it out.
From now on those will be refered to as the dataPin, the clockPin and the latchPin respectively. Notice the 0.1�f capacitor on the latchPin, if you have some flicker when the latch pin pulses you can use a capacitor to even it out.
In this case you should connect the cathode (short pin) of each LED to a common ground, and the anode (long pin) of each LED to its respective shift register output pin. Using the shift register to supply power like this is called sourcing current. Some shift registers can't source current, they can only do what is called sinking current. If you have one of those it means you will have to flip the direction of the LEDs, putting the anodes directly to power and the cathodes (ground pins) to the shift register outputs. You should check the your specific datasheet if you arent using a 595 series chip. Dont forget to add a 220-ohm resistor in series to protect the LEDs from being overloaded.
In this case you should connect the cathode (short pin) of each LED to a common ground, and the anode (long pin) of each LED to its respective shift register output pin. Using the shift register to supply power like this is called sourcing current. Some shift registers can't source current, they can only do what is called sinking current. If you have one of those it means you will have to flip the direction of the LEDs, putting the anodes directly to power and the cathodes (ground pins) to the shift register outputs. You should check the your specific datasheet if you aren�t using a 595 series chip. Don�t forget to add a 220-ohm resistor in series to protect the LEDs from being overloaded.
Here are three code examples. The first is just some hello world code that simply outputs a byte value from 0 to 255. The second program lights one LED at a time. The third cycles through an array.
Here are three code examples. The first is just some �hello world� code that simply outputs a byte value from 0 to 255. The second program lights one LED at a time. The third cycles through an array.
In this example youll add a second shift register, doubling the number of output pins you have while still using the same number of pins from the Arduino.
In this example you'll add a second shift register, doubling the number of output pins you have while still using the same number of pins from the Arduino.
Like sample 2.2, sample 2.3 also takes advantage of the new blinkAll_2bytes() function. 2.3's big difference from sample 1.3 is only that instead of just a single variable called data and a single array called dataArray you have to have a dataRED, a dataGREEN, dataArrayRED, dataArrayGREEN defined up front. This means that line
Like sample 2.2, sample 2.3 also takes advantage of the new blinkAll_2bytes() function. 2.3's big difference from sample 1.3 is only that instead of just a single variable called �data� and a single array called �dataArray� you have to have a dataRED, a dataGREEN, dataArrayRED, dataArrayGREEN defined up front. This means that line
At sometime or another you may run out of pins on your Arduino board and need to extend it with shift registers. This example is based on the 74HC595. The datasheet refers to the 74HC595 as an 8-bit serial-in, serial or parallel-out shift register with output latches; 3-state. In other words, you can use it to control 8 outputs at a time while only taking up a few pins on your microcontroller. You can link multiple registers together to extend your output even more.
Users may also wish to search for other driver chips with "595" or "596" in their part numbers, there are many. The STP16C596 for example will drive 16 LED's and eliminates the series resistors with built-in constant current sources.
At sometime or another you may run out of pins on your Arduino board and need to extend it with shift registers. This example is based on the 74HC595. The datasheet refers to the 74HC595 as an 8-bit serial-in, serial or parallel-out shift register with output latches; 3-state. In other words, you can use it to control 8 outputs at a time while only taking up a few pins on your microcontroller. You can link multiple registers together to extend your output even more. (Users may also wish to search for other driver chips with "595" or "596" in their part numbers, there are many. The STP16C596 for example will drive 16 LED's and eliminates the series resistors with built-in constant current sources.)
At sometime or another you may run out of pins on your Arduino board and need to extend it with shift registers. This example is based on the 74HC595. The datasheet refers to the 74HC595 as an 8-bit serial-in, serial or parallel-out shift register with output latches; 3-state. In other words, you can use it to control 8 outputs at a time while only taking up a few pins on your microcontroller. You can link multiple registers together to extend your output even more.
At sometime or another you may run out of pins on your Arduino board and need to extend it with shift registers. This example is based on the 74HC595. The datasheet refers to the 74HC595 as an 8-bit serial-in, serial or parallel-out shift register with output latches; 3-state. In other words, you can use it to control 8 outputs at a time while only taking up a few pins on your microcontroller. You can link multiple registers together to extend your output even more.
Users may also wish to search for other driver chips with "595" or "596" in their part numbers, there are many. The STP16C596 for example will drive 16 LED's and eliminates the series resistors with built-in constant current sources.
(:cell:) Ground, Vss
(:cell:) Output Pins






The code is based on two pieces of information in the datasheet: the timing diagram and the logic table. The logic table is what tells you that basically everything important happens on an up beat. When the clockPin goes from low to high, the shift register reads the state of the data pin. As the data gets shifted in it is saved in an internal memory register. When the latchPin goes from low to high the sent data gets moved from the shift registers aforementioned memory register into the output pins, lighting the LEDs.
In this case you should connect the cathode (short pin) of each LED to a common ground, and the anode (long pin) of each LED to its respective shift register output pin. Some shift registers won't supply power, they will only ground. You should check the your specific datasheet if you arent using a 595 series chip. Dont forget to add a 220-ohm resistor in series to protect the LEDs from being overloaded.
In this case you should connect the cathode (short pin) of each LED to a common ground, and the anode (long pin) of each LED to its respective shift register output pin. Using the shift register to supply power like this is called sourcing current. Some shift registers can't source current, they can only do what is called sinking current. If you have one of those it means you will have to flip the direction of the LEDs, putting the anodes directly to power and the cathodes (ground pins) to the shift register outputs. You should check the your specific datasheet if you arent using a 595 series chip. Dont forget to add a 220-ohm resistor in series to protect the LEDs from being overloaded.
In this example youll add a second shift register, doubling the number of output pins you have while still using the same number of pins from the Arduino.
3 states refers to the fact that you can set the output pins as either high, low or high impedance. Unlike the HIGH and LOW states, you cant set pins to their high impedance state individually. You can only set the whole chip together. This is a pretty specialized thing to do -- Think of an LED array that might need to be controlled by completely different microcontrollers depending on a specific mode setting built into your project. Niether example takes advantage of this feature and you wont usually need to worry about getting a chip that has it.
3 states refers to the fact that you can set the output pins as either high, low or high impedance. Unlike the HIGH and LOW states, you cant set pins to their high impedance state individually. You can only set the whole chip together. This is a pretty specialized thing to do -- Think of an LED array that might need to be controlled by completely different microcontrollers depending on a specific mode setting built into your project. Neither example takes advantage of this feature and you wont usually need to worry about getting a chip that has it.
Here are three code examples. The first is just some hello world code that simply outputs a byte value from 0 to 255. The second program lights one LED at a time. The third cycles through an array.

Here are three code examples. The first is just some hello world code that simply outputs a byte value from 0 to 255. The second program lights one LED at a time. The third cycles through an array.
The code is based on two pieces of information in the datasheet: the timing diagram and the logic table. The logic table is what tells you that basically everything important happens on an up beat. When the clockPin goes from low to high, the shift register reads the state of the data pin. As the data gets shifted in it is saved in an internal memory register. When the latchPin goes from low to high the sent data gets moved from the shift registers aforementioned memory register into the output pins, lighting the LEDs.





http://www.arduino.cc/en/uploads/Tutorial/595_logic_table.png Here are three code examples. The first is just some hello world code that simply outputs a byte value from 0 to 255. The second program lights one LED at a time. The third cycles through an array.
Here are three code examples. The first is just some hello world code that simply outputs a byte value from 0 to 255. The second program lights one LED at a time. The third cycles through an array.


Here are three code examples. The first is just some hello world code that simply outputs a byte value from 0 to 255. The second program lights one LED at a time. The third cycles through an array.
http://www.arduino.cc/en/uploads/Tutorial/595_logic_table.png Here are three code examples. The first is just some hello world code that simply outputs a byte value from 0 to 255. The second program lights one LED at a time. The third cycles through an array.




In this case you should connect the cathode (short pin) of each LED to a common ground, and the anode (long pin) of each LED to its respective shift register output pin. Some shift registers won't supply power, they will only ground. You should check the your specific datasheet if you arent using a 595 series chip. Dont forget to add a 220-ohm resistor in series to protect the LEDs from being overloaded.
In this case you should connect the cathode (short pin) of each LED to a common ground, and the anode (long pin) of each LED to its respective shift register output pin. Some shift registers won't supply power, they will only ground. You should check the your specific datasheet if you arent using a 595 series chip. Dont forget to add a 220-ohm resistor in series to protect the LEDs from being overloaded.
Starting from the previous example, you should put a second shift register on the board. It should have the same leads to power and ground.
Starting from the previous example, you should put a second shift register on the board. It should have the same leads to power and ground.


In this case I added green ones so when reading the code it is clear which byte is going to which set of LEDs
In this case I added green ones so when reading the code it is clear which byte is going to which set of LEDs
(:cell rowspan=9 :)
(:cell rowspan=9 :)

















Here is a table explaining the pin-outs adapted from the datasheet.
(:table border=1 cellpadding=5 cellspacing=0:)
Here is a table explaining the pin-outs adapted from the Phillip's datasheet.
(:table border=1 bordercolor=#CCCCCC cellpadding=5 cellspacing=0:)
(:cell rowspan=9 :) a1 (:cell:) b1 (:cell:) c1 (:cell:) d1 (:cellnr:) b2 (:cell:) c2 (:cell:) d2 (:cellnr:) b2 (:cell:) c2 (:cell:) d2 (:cellnr:) b2 (:cell:) c2 (:cell:) d2 (:cellnr:) b2 (:cell:) c2 (:cell:) d2 (:cellnr:) b2 (:cell:) c2 (:cell:) d2 (:cellnr:) b2 (:cell:) c2 (:cell:) d2 (:cellnr:) b2 (:cell:) c2 (:cell:) d2 (:cellnr:) b2 (:cell:) c2 (:cell:) d2 (:cellnr:) b2 (:cell:) c2 (:cell:) d2
(:cell rowspan=9 :)
(:cell:) PINS 1-7, 15
(:cell:) Q0 Q7
(:cell:) Ground, Vss
(:cellnr:) PIN 8
(:cell:) GND
(:cell:) Ground, Vss
(:cellnr:) PIN 9
(:cell:) Q7
(:cell:) Serial Out
(:cellnr:) PIN 10
(:cell:) MR
(:cell:) Master Reclear, active low
(:cellnr:) PIN 11
(:cell:) SH_CP
(:cell:) Shift register clock pin
(:cellnr:) PIN 12
(:cell:) ST_CP
(:cell:) Storage register clock pin (latch pin)
(:cellnr:) PIN 13
(:cell:) OE
(:cell:) Output enable, active low
(:cellnr:) PIN 14
(:cell:) DS
(:cell:) Serial data input
(:cellnr:) PIN 16
(:cell:) Vcc
(:cell:) Positive supply voltage

(:table border=1 cellpadding=5 cellspacing=0:) (:cell rowspan=9 :) a1 (:cell:) b1 (:cell:) c1 (:cell:) d1 (:cellnr:) b2 (:cell:) c2 (:cell:) d2 (:cellnr:) b2 (:cell:) c2 (:cell:) d2 (:cellnr:) b2 (:cell:) c2 (:cell:) d2 (:cellnr:) b2 (:cell:) c2 (:cell:) d2 (:cellnr:) b2 (:cell:) c2 (:cell:) d2 (:cellnr:) b2 (:cell:) c2 (:cell:) d2 (:cellnr:) b2 (:cell:) c2 (:cell:) d2 (:cellnr:) b2 (:cell:) c2 (:cell:) d2 (:cellnr:) b2 (:cell:) c2 (:cell:) d2 (:tableend:)
3 states refers to the fact that you can set the output pins as either high, low or high impedance. Unlike the HIGH and LOW states, you cant set pins to their high impedance state individually. You can only set the whole chip together. This is a pretty specialized thing to do -- Think of an LED array that might need to be controlled by completely different microcontrollers depending on a specific mode setting built into your project. Niether example takes advantage of this feature and you wont usually need to worry about getting a chip that has it.
3 states refers to the fact that you can set the output pins as either high, low or high impedance. Unlike the HIGH and LOW states, you cant set pins to their high impedance state individually. You can only set the whole chip together. This is a pretty specialized thing to do -- Think of an LED array that might need to be controlled by completely different microcontrollers depending on a specific mode setting built into your project. Niether example takes advantage of this feature and you wont usually need to worry about getting a chip that has it.
Here is a table explaining the pin-outs adapted from the datasheet.

"3 states" refers to the fact that you can set the output pins as either high, low or high impedance. When you set a pin set high by sending a 1 bit to that address, it will output whatever voltage you have connected to the Vcc pin. When you set low it will output zero volts (Vss). When a pin is in a high impedance state, the shift register isnt actively set to either a high or low voltage. High impedance is meant to be a type of blank state so if you wanted to have the outputs attached to one register controlled by, for example, a second register attached in parallel to the original circuit you could do so without competition. Think of an LED array that might need to be controlled by different microcontrollers depending on a mode built into your project. Unlike the HIGH and LOW states, you cant set pins to their high impedance state individually, you can only set the whole chip together. Youd do this by setting the Output-Enable (pin 13) HIGH and the Master-Reclear (pin) LOW. Neither example takes advantage of this feature as it is a pretty specialized thing to do, so you dont need to spend a lot of time on it now.
3 states refers to the fact that you can set the output pins as either high, low or high impedance. Unlike the HIGH and LOW states, you cant set pins to their high impedance state individually. You can only set the whole chip together. This is a pretty specialized thing to do -- Think of an LED array that might need to be controlled by completely different microcontrollers depending on a specific mode setting built into your project. Niether example takes advantage of this feature and you wont usually need to worry about getting a chip that has it.
How this all works is through something called synchronous serial communication, i.e. you can pulse one pin up and down thereby communicating a data byte to the register bit by bit. It's by pulsing second pin, the clock pin, that you delineate between bits. This is in contrast using the asynchronous serial communication of the Serial.begin() function which relies on the sender and the receiver to be independently set to an agreed upon specified data rate. Once the whole byte gets to the register the HIGH or LOW messages held in each bit get parceled out to each of the individual output pins. This is the parallel output part, having all the pins do what you want them to do all at once.
How this all works is through something called synchronous serial communication, i.e. you can pulse one pin up and down thereby communicating a data byte to the register bit by bit. It's by pulsing second pin, the clock pin, that you delineate between bits. This is in contrast to using the asynchronous serial communication of the Serial.begin() function which relies on the sender and the receiver to be set independently to an agreed upon specified data rate. Once the whole byte is transmitted to the register the HIGH or LOW messages held in each bit get parceled out to each of the individual output pins. This is the parallel output part, having all the pins do what you want them to do all at once.
"3 states" refers to the fact that you can set the output pins as either high, low or high impedance. When you set a pin set high by sending a 1 bit to that address, it will output whatever voltage you have connected to the Vcc pin. When you set low it will output zero volts (Vss). When a pin is in a high impedance state, the shift register isnt actively set to either a high or low voltage. High impedance is meant to be a type of blank state so if you wanted to have the outputs attached to one register controlled by, for example, a second register attached in parallel to the original circuit you could do so without competition. Think of an LED array that might need to be controlled by different microcontrollers depending on a mode built into your project. Unlike the HIGH and LOW states, you cant set pins to their high impedance state individually, you can only set the whole chip together. Youd do this by setting the Output-Enable (pin 13) HIGH and the Master-Reclear (pin) LOW. Neither example takes advantage of this feature, and it is a pretty specialized thing to do, so you dont need to spend a lot of time on it now.
"3 states" refers to the fact that you can set the output pins as either high, low or high impedance. When you set a pin set high by sending a 1 bit to that address, it will output whatever voltage you have connected to the Vcc pin. When you set low it will output zero volts (Vss). When a pin is in a high impedance state, the shift register isnt actively set to either a high or low voltage. High impedance is meant to be a type of blank state so if you wanted to have the outputs attached to one register controlled by, for example, a second register attached in parallel to the original circuit you could do so without competition. Think of an LED array that might need to be controlled by different microcontrollers depending on a mode built into your project. Unlike the HIGH and LOW states, you cant set pins to their high impedance state individually, you can only set the whole chip together. Youd do this by setting the Output-Enable (pin 13) HIGH and the Master-Reclear (pin) LOW. Neither example takes advantage of this feature as it is a pretty specialized thing to do, so you dont need to spend a lot of time on it now.
This set up makes all of the output pins active and addressable all the time. The one flaw of this set up is that you might end up with the lights turning on to their last state or something arbitrary every time you first power up the circuit before the program starts to run. You can get around this by also controlling the MR and OE pins from your Arduino board, but this will work and leave you with more open pins.
This set up makes all of the output pins active and addressable all the time. The one flaw of this set up is that you end up with the lights turning on to their last state or something arbitrary every time you first power up the circuit before the program starts to run. You can get around this by controlling the MR and OE pins from your Arduino board too, but this way will work and leave you with more open pins.
From now on those will be refered to as the dataPin, the clockPin and the latchPin respectively. Notice the 0.1f capacitor on the latchPin, if you notice some flicker every time the latch pin pulses you can use a capacitor to even it out.
From now on those will be refered to as the dataPin, the clockPin and the latchPin respectively. Notice the 0.1f capacitor on the latchPin, if you have some flicker when the latch pin pulses you can use a capacitor to even it out.
In this case you should connect the cathode (short pin) of each LED to a common ground, and the anode (long pin) of each to its respective shift register output pin. Some shift registers won't supply power, they will only ground. You should check the your specific datasheet if you arent using a 595 series chip. Dont forget to add a 220-ohm resistor in series to protect the LEDs from being overloaded.
In this case you should connect the cathode (short pin) of each LED to a common ground, and the anode (long pin) of each LED to its respective shift register output pin. Some shift registers won't supply power, they will only ground. You should check the your specific datasheet if you arent using a 595 series chip. Dont forget to add a 220-ohm resistor in series to protect the LEDs from being overloaded.
The code is based on two pieces of information in the datasheet: the timing diagram and the logic table. The logic table is what tells you that basically everything important happens on an up beat When the clockPin goes from low to high, the shift register reads the state of the data pin. As the data gets shifted in it is saved in an internal memory register on the shift register. When the latchPin goes from low to high the sent data gets moved from the aforementioned memory register into the output pins, lighting the LEDs.
The code is based on two pieces of information in the datasheet: the timing diagram and the logic table. The logic table is what tells you that basically everything important happens on an up beat. When the clockPin goes from low to high, the shift register reads the state of the data pin. As the data gets shifted in it is saved in an internal memory register. When the latchPin goes from low to high the sent data gets moved from the shift registers aforementioned memory register into the output pins, lighting the LEDs.
How this all works is through something called synchronous serial communication, i.e. you can pulse one pin up and down thereby communicating a data byte to the register bit by bit. Its by pulsing second pin, the clock pin, that you delineate between bits. This is in contrast using the asynchronous serial communication of the Serial.begin() function which relies on the sender and the receiver to be independently set to an agreed upon specified data rate. Once the whole byte gets to the register the HIGH or LOW messages held in each bit get parceled out to each of the individual output pins. This is the parallel output part, having all the pins do what you want them to do all at once.
How this all works is through something called synchronous serial communication, i.e. you can pulse one pin up and down thereby communicating a data byte to the register bit by bit. It's by pulsing second pin, the clock pin, that you delineate between bits. This is in contrast using the asynchronous serial communication of the Serial.begin() function which relies on the sender and the receiver to be independently set to an agreed upon specified data rate. Once the whole byte gets to the register the HIGH or LOW messages held in each bit get parceled out to each of the individual output pins. This is the parallel output part, having all the pins do what you want them to do all at once.
The 3 states refers to the fact that you can set the output pins as either high, low or high impedance. When you set a pin set high by sending a 1 bit to that address, it will output whatever voltage you have connected to the Vcc pin. When you set low it will output zero volts (Vss). When a pin is in a high impedance state, the shift register isnt actively set to either a high or low voltage. High impedance is meant to be a type of blank state so if you wanted to have the outputs attached to one register controlled by, for example, a second register attached in parallel to the original circuit you could do so without competition. Think of an LED array that might need to be controlled by different microcontrollers depending on a mode built into your project. Unlike the HIGH and LOW states, you cant set pins to their high impedance state individually, you can only set the whole chip together. Youd do this by setting the Output-Enable (pin 13) HIGH and the Master-Reclear (pin) LOW. Neither example takes advantage of this feature, and it is a pretty specialized thing to do, so you dont need to spend a lot of time on it now.
"3 states" refers to the fact that you can set the output pins as either high, low or high impedance. When you set a pin set high by sending a 1 bit to that address, it will output whatever voltage you have connected to the Vcc pin. When you set low it will output zero volts (Vss). When a pin is in a high impedance state, the shift register isnt actively set to either a high or low voltage. High impedance is meant to be a type of blank state so if you wanted to have the outputs attached to one register controlled by, for example, a second register attached in parallel to the original circuit you could do so without competition. Think of an LED array that might need to be controlled by different microcontrollers depending on a mode built into your project. Unlike the HIGH and LOW states, you cant set pins to their high impedance state individually, you can only set the whole chip together. Youd do this by setting the Output-Enable (pin 13) HIGH and the Master-Reclear (pin) LOW. Neither example takes advantage of this feature, and it is a pretty specialized thing to do, so you dont need to spend a lot of time on it now.
2.3 also takes advantage of the new blinkAll_2bytes() function. Its big difference from 1.3 is only that instead of just a single variable called data and a single array called dataArray you have to have a dataRED, a dataGREEN, dataArrayRED, dataArrayGREEN defined up front. This means that later on line
Like sample 2.2, sample 2.3 also takes advantage of the new blinkAll_2bytes() function. 2.3's big difference from sample 1.3 is only that instead of just a single variable called data and a single array called dataArray you have to have a dataRED, a dataGREEN, dataArrayRED, dataArrayGREEN defined up front. This means that line
Carlyn Maw, Tom Igoe
Started by Carlyn Maw and Tom Igoe Nov, 06
Code Sample 2.2 2 Byte One By One
Comparing this code to the similar code from Example 1 you see that a little bit more has had to change. The blinkAll() function has been changed to the blinkAll_2Bytes() function to reflect the fact that now there are 16 LEDs to control. Also, in version 1 the pulsings of the latchPin were situated inside the subfunctions lightShiftPinA and lightShiftPinB(). Here they need to be moved back into the main loop to accommodate needing to run each subfunction twice in a row, once for the green LEDs and once for the red ones.
Code Sample 2.3 - Dual Defined Arrays 2.3 also takes advantage of the new blinkAll_2bytes() function. Its big difference from 1.3 is only that instead of just a single variable called data and a single array called dataArray you have to have a dataRED, a dataGREEN, dataArrayRED, dataArrayGREEN defined up front. This means that later on line
data = dataArray[j];
becomes
dataRED = dataArrayRED[j];
dataGREEN = dataArrayGREEN[j];
and
shiftOut(dataPin, clockPin, data);
becomes
shiftOut(dataPin, clockPin, dataGREEN);
shiftOut(dataPin, clockPin, dataRED);
Starting from the previous example, you should put a second shift register on the board. It should have the same leads to power and ground.
Two of these connections simply extend the same clock and latch signal from the Arduino to the second shift register (yellow and green wires). The blue wire is going from the serial out pin (pin 9) of the first shift register to the serial data input (pin 14) of the second register.
In this case I added green ones so when reading the code it is clear which byte is going to which set of LEDs
Here again are three code samples. If you are curious, you might want to try the samples from the first example with this circuit set up just to see what happens.
Code Sample 2.1 Dual Binary Counters There is only one extra line of code compared to the first code sample from Example 1. It sends out a second byte. This forces the first shift register, the one directly attached to the Arduino, to pass the first byte sent through to the second register, lighting the green LEDs. The second byte will then show up on the red LEDs.
Here are three code examples. The first is just some hello world code that simply outputs a byte value from 0 to 255. The second program lights one LED at a time. The third cycles through an array.
The code is based on two pieces of information in the datasheet: the timing diagram and the logic table. The logic table is what tells you that basically everything important happens on an up beat When the clockPin goes from low to high, the shift register reads the state of the data pin. As the data gets shifted in it is saved in an internal memory register on the shift register. When the latchPin goes from low to high the sent data gets moved from the aforementioned memory register into the output pins, lighting the LEDs.
From now on those will be refered to as the dataPin, the clockPin and the latchPin respectively. Notice the 0.1f capacitor on the latchPin. I was getting some flicker every time the latch pin pulsed so I used the capacitor to even it out.
From now on those will be refered to as the dataPin, the clockPin and the latchPin respectively. Notice the 0.1f capacitor on the latchPin, if you notice some flicker every time the latch pin pulses you can use a capacitor to even it out.
In this case you should connect the cathode (short pin) of each LED to a common ground, and the anode (long pin) of each to its respective shift register output pin. Some shift registers won't supply power, they will only ground. You should check the your specific datasheet if you arent using a 595 series chip. Dont forget to add a 220-ohm resistor in series to protect the LEDs from being overloaded.
by Carlyn Maw
Carlyn Maw, Tom Igoe
Im going to refer to them from now on as the dataPin, the clockPin and the latchPin respectively. Notice the 0.1f capacitor on the latchPin. I was getting some flicker every time the latch pin pulsed so I used the capacitor to even it out.
From now on those will be refered to as the dataPin, the clockPin and the latchPin respectively. Notice the 0.1f capacitor on the latchPin. I was getting some flicker every time the latch pin pulsed so I used the capacitor to even it out.
This set up makes all of the output pins active and addressable all the time. The one flaw of this set up is that you might end up with the lights turning on to their last state or something arbitrary every time you first power up the circuit before the program starts to run. ======= At sometime or another you may run out of pins on your Arduino board and need to extend it with shift registers. This example is based on the 74HC595. The datasheet refers to the 74HC595 as an 8-bit serial-in, serial or parallel-out shift register with output latches; 3-state. In other words, you can use it to control 8 outputs at a time while only taking up a few pins on your microcontroller. You can link multiple registers together to extend your output even more.
How this all works is through something called synchronous serial communication, i.e. you can pulse one pin up and down thereby communicating a data byte to the register bit by bit. Its by pulsing second pin, the clock pin, that you delineate between bits. This is in contrast using the asynchronous serial communication of the Serial.begin() function which relies on the sender and the receiver to be independently set to an agreed upon specified data rate. Once the whole byte gets to the register the HIGH or LOW messages held in each bit get parceled out to each of the individual output pins. This is the parallel output part, having all the pins do what you want them to do all at once.
The serial output part of this component comes from its extra pin which can pass the serial information received from the microcontroller out again unchanged. This means you can transmit 16 bits in a row (2 bytes) and the first 8 will flow through the first register into the second register and be expressed there. You can learn to do that from the second example.
The 3 states refers to the fact that you can set the output pins as either high, low or high impedance. When you set a pin set high by sending a 1 bit to that address, it will output whatever voltage you have connected to the Vcc pin. When you set low it will output zero volts (Vss). When a pin is in a high impedance state, the shift register isnt actively set to either a high or low voltage. High impedance is meant to be a type of blank state so if you wanted to have the outputs attached to one register controlled by, for example, a second register attached in parallel to the original circuit you could do so without competition. Think of an LED array that might need to be controlled by different microcontrollers depending on a mode built into your project. Unlike the HIGH and LOW states, you cant set pins to their high impedance state individually, you can only set the whole chip together. Youd do this by setting the Output-Enable (pin 13) HIGH and the Master-Reclear (pin) LOW. Neither example takes advantage of this feature, and it is a pretty specialized thing to do, so you dont need to spend a lot of time on it now.
The first step is to extend your Arduino with one shift register.
Make the following connections:
Im going to refer to them from now on as the dataPin, the clockPin and the latchPin respectively. Notice the 0.1f capacitor on the latchPin. I was getting some flicker every time the latch pin pulsed so I used the capacitor to even it out.
Im going to refer to them from now on as the dataPin, the clockPin and the latchPin respectively. Notice the 0.1f capacitor on the latchPin. I was getting some flicker every time the latch pin pulsed so I used the capacitor to even it out.
This set up makes all of the output pins active and addressable all the time. The one flaw of this set up is that you might end up with the lights turning on to their last state or something arbitrary every time you first power up the circuit before the program starts to run. >>>>>>>
This set up makes all of the output pins active and addressable all the time. The one flaw of this set up is that you might end up with the lights turning on to their last state or something arbitrary every time you first power up the circuit before the program starts to run. You can get around this by also controlling the MR and OE pins from your Arduino board, but this will work and leave you with more open pins.
Im going to refer to them from now on as the dataPin, the clockPin and the latchPin respectively. Notice the 0.1f capacitor on the latchPin. I was getting some flicker every time the latch pin pulsed so I used the capacitor to even it out.
by Carlyn Maw
<<<<<<<
<<<<<<<
This set up makes all of the output pins active and addressable all the time. The one flaw of this set up is that you might end up with the lights turning on to their last state or something arbitrary every time you first power up the circuit before the program starts to run.
This set up makes all of the output pins active and addressable all the time. The one flaw of this set up is that you might end up with the lights turning on to their last state or something arbitrary every time you first power up the circuit before the program starts to run. ======= At sometime or another you may run out of pins on your Arduino board and need to extend it with shift registers. This example is based on the 74HC595. The datasheet refers to the 74HC595 as an 8-bit serial-in, serial or parallel-out shift register with output latches; 3-state. In other words, you can use it to control 8 outputs at a time while only taking up a few pins on your microcontroller. You can link multiple registers together to extend your output even more.
How this all works is through something called synchronous serial communication, i.e. you can pulse one pin up and down thereby communicating a data byte to the register bit by bit. Its by pulsing second pin, the clock pin, that you delineate between bits. This is in contrast using the asynchronous serial communication of the Serial.begin() function which relies on the sender and the receiver to be independently set to an agreed upon specified data rate. Once the whole byte gets to the register the HIGH or LOW messages held in each bit get parceled out to each of the individual output pins. This is the parallel output part, having all the pins do what you want them to do all at once.
The serial output part of this component comes from its extra pin which can pass the serial information received from the microcontroller out again unchanged. This means you can transmit 16 bits in a row (2 bytes) and the first 8 will flow through the first register into the second register and be expressed there. You can learn to do that from the second example.
The 3 states refers to the fact that you can set the output pins as either high, low or high impedance. When you set a pin set high by sending a 1 bit to that address, it will output whatever voltage you have connected to the Vcc pin. When you set low it will output zero volts (Vss). When a pin is in a high impedance state, the shift register isnt actively set to either a high or low voltage. High impedance is meant to be a type of blank state so if you wanted to have the outputs attached to one register controlled by, for example, a second register attached in parallel to the original circuit you could do so without competition. Think of an LED array that might need to be controlled by different microcontrollers depending on a mode built into your project. Unlike the HIGH and LOW states, you cant set pins to their high impedance state individually, you can only set the whole chip together. Youd do this by setting the Output-Enable (pin 13) HIGH and the Master-Reclear (pin) LOW. Neither example takes advantage of this feature, and it is a pretty specialized thing to do, so you dont need to spend a lot of time on it now.
The first step is to extend your Arduino with one shift register.
Make the following connections:
This set up makes all of the output pins active and addressable all the time. The one flaw of this set up is that you might end up with the lights turning on to their last state or something arbitrary every time you first power up the circuit before the program starts to run. >>>>>>>
The first step is to extend your Arduino with one shift register.
Make the following connections:
This set up makes all of the output pins active and addressable all the time. The one flaw of this set up is that you might end up with the lights turning on to their last state or something arbitrary every time you first power up the circuit before the program starts to run.
At sometime or another you may run out of pins on your Arduino board and need to extend it with shift registers. This example is based on the 74HC595. The datasheet refers to the 74HC595 as an 8-bit serial-in, serial or parallel-out shift register with output latches; 3-state. In other words, you can use it to control 8 outputs at a time while only taking up a few pins on your microcontroller. You can link multiple registers together to extend your output even more.
How this all works is through something called synchronous serial communication, i.e. you can pulse one pin up and down thereby communicating a data byte to the register bit by bit. Its by pulsing second pin, the clock pin, that you delineate between bits. This is in contrast using the asynchronous serial communication of the Serial.begin() function which relies on the sender and the receiver to be independently set to an agreed upon specified data rate. Once the whole byte gets to the register the HIGH or LOW messages held in each bit get parceled out to each of the individual output pins. This is the parallel output part, having all the pins do what you want them to do all at once.
The serial output part of this component comes from its extra pin which can pass the serial information received from the microcontroller out again unchanged. This means you can transmit 16 bits in a row (2 bytes) and the first 8 will flow through the first register into the second register and be expressed there. You can learn to do that from the second example.
The 3 states refers to the fact that you can set the output pins as either high, low or high impedance. When you set a pin set high by sending a 1 bit to that address, it will output whatever voltage you have connected to the Vcc pin. When you set low it will output zero volts (Vss). When a pin is in a high impedance state, the shift register isnt actively set to either a high or low voltage. High impedance is meant to be a type of blank state so if you wanted to have the outputs attached to one register controlled by, for example, a second register attached in parallel to the original circuit you could do so without competition. Think of an LED array that might need to be controlled by different microcontrollers depending on a mode built into your project. Unlike the HIGH and LOW states, you cant set pins to their high impedance state individually, you can only set the whole chip together. Youd do this by setting the Output-Enable (pin 13) HIGH and the Master-Reclear (pin) LOW. Neither example takes advantage of this feature, and it is a pretty specialized thing to do, so you dont need to spend a lot of time on it now.