Reference.ShiftOut History

Hide minor edits - Show changes to markup

June 03, 2010, at 07:04 PM by Equipo Traduccion -
Changed line 55 from:

// : 74HC595 para contar de 0 a 255 //

to:

// : 74HC595 para contar de 0 a 255 //

Changed line 66 from:
  //set pins to output because they are addressed in the main loop
to:
  // Configura como salida los pines que se direccionan en el bucle principal (loop)
Changed line 73 from:
  //count up routine
to:
  //rutina de conteo
Changed line 75 from:
    //ground latchPin and hold low for as long as you are transmitting
to:
    //pone a nivel bajo el latchPin y lo mantienen a nivel bajo todo el tiempo que estés transmitindo
Changed lines 78-79 from:
    //return the latch pin high to signal chip that it 
    //no longer needs to listen for information
to:
    //vuelve a poner el latchPin a nivel alto para señalizar que
    //no sigue siendo necesario eschuchar más información
June 03, 2010, at 07:00 PM by Equipo Traduccion -
Changed lines 54-55 from:

// Notes : Código para utilizar un registro de desplazamiento // // : 74HC595 para contar de 0 a 255 //

to:

// Notes : Código para utilizar un registro de desplazamiento// // : 74HC595 para contar de 0 a 255 //

June 03, 2010, at 07:00 PM by Equipo Traduccion -
Changed lines 54-55 from:

// Notes : Código para utilizar un registro de desplazamiento 74HC595 // // : to count from 0 to 255 //

to:

// Notes : Código para utilizar un registro de desplazamiento // // : 74HC595 para contar de 0 a 255 //

June 03, 2010, at 06:59 PM by Equipo Traduccion -
Changed lines 4-5 from:

Rota un byte de datos bit a bit. Empieza desde el bit más significante (el de más a la izquierda) o el menos significante (el más a la derecha). Cada bit se escribe siguiendo su turno en un pin de datos, después de conmutar un pin de reloj (señal de reloj) para indicar que el bit está disponible.

to:

Desplaza un byte de datos bit a bit. Empieza desde el bit más significante (el de más a la izquierda) o el menos significante (el más a la derecha). Cada bit se escribe siguiendo su turno en un pin de datos, después de conmutar un pin de reloj (señal de reloj) para indicar que el bit está disponible.

Changed lines 17-18 from:

ordenBits: en qué orden rotar los bits; si hacia el MSBFIRST (bit más significante primero) o hacia el LSBFIRST (bit menos significante primero).

to:

ordenBits: en qué orden desplazar los bits; si hacia el MSBFIRST (bit más significante primero) o hacia el LSBFIRST (bit menos significante primero).

Changed lines 45-48 from:

Example

For accompanying circuit, see the tutorial on controlling a 74HC595 shift register.

to:

Ejemplo

Para ver el circuito asociado a este ejemplo, ver el tutorial para controlar un registro de desplazamiento 74HC595.

Changed line 54 from:

// Notes : Code for using a 74HC595 Shift Register //

to:

// Notes : Código para utilizar un registro de desplazamiento 74HC595 //

Changed line 58 from:

//Pin connected to ST_CP of 74HC595

to:

//Pin conectado al pin ST_CP del 74HC595

Changed line 60 from:

//Pin connected to SH_CP of 74HC595

to:

//Pin connectado al pin SH_CP del 74HC595

Changed line 62 from:

////Pin connected to DS of 74HC595

to:

////Pin conectado al pin DS del 74HC595

June 03, 2010, at 06:44 PM by Equipo Traduccion -
Changed lines 30-44 from:

// Haz esto para una comunicación serie MSBFIRST (primero los bits más significativos) int data = 500; // shift out highbyte shiftOut(dataPin, clock, MSBFIRST, (data >> 8)); // shift out lowbyte shiftOut(data, clock, MSBFIRST, data);

// Or do this for LSBFIRST serial data = 500; // shift out lowbyte shiftOut(dataPin, clock, LSBFIRST, data); // shift out highbyte shiftOut(dataPin, clock, LSBFIRST, (data >> 8)); @]

to:

// Haz esto para una comunicación serie MSBFIRST (primero el bit más significativo) int datos = 500; // rota el byte más alto shiftOut(pinDatos, pinReloj, MSBFIRST, (datos >> 8)); // rota el byte más bajo shiftOut(datos, pinReloj, MSBFIRST, datos);

// O haz esto para una comunicación serie LSBFIRST (primero el bit menos significativo) datos = 500; // rota el byte más bajo shiftOut(pinDatos, pinReloj, LSBFIRST, datos); // rota el bit más alto shiftOut(pinDatos, pinReloj, LSBFIRST, (datos >> 8)); @]

June 03, 2010, at 06:36 PM by Equipo Traduccion -
Changed line 30 from:

// Do this for MSBFIRST serial

to:

// Haz esto para una comunicación serie MSBFIRST (primero los bits más significativos)

June 03, 2010, at 06:31 PM by Equipo Traduccion -
Changed lines 4-6 from:

Rota cada vez un bit de un byte de datos. Empieza desde el bit más significante (el de más a la izquierda) o el menos significante (el más a la derecha). Cada bit se escribe siguiendo su turno en un pin de datos, después de conmutar un pin de reloj (señal de reloj) para indicar que el bit está disponible.

to:

Rota un byte de datos bit a bit. Empieza desde el bit más significante (el de más a la izquierda) o el menos significante (el más a la derecha). Cada bit se escribe siguiendo su turno en un pin de datos, después de conmutar un pin de reloj (señal de reloj) para indicar que el bit está disponible.

Changed lines 26-28 from:

The dataPin and clockPin must already be configured as outputs by a call to pinMode().

shiftOut is currently written to output 1 byte (8 bits) so it requires a two step operation to output values larger than 255.

to:

El pinDatos y pinReloj deben estar ya configurados como salida con una llamada previa a pinMode().

shiftOut se encuentra actualmente configurada para extraer un byte (8 bits) por lo que necesita realizar una operación de dos pasos para extraer valores más grandes de 255.

June 03, 2010, at 06:20 PM by Equipo Traduccion -
Changed lines 11-27 from:

shiftOut(dataPin, clockPin, bitOrder, value)

Parameters

dataPin: the pin on which to output each bit (int)

clockPin: the pin to toggle once the dataPin has been set to the correct value (int)

bitOrder: which order to shift out the bits; either MSBFIRST or LSBFIRST.
(Most Significant Bit First, or, Least Significant Bit First)

value: the data to shift out. (byte)

Returns

None

Note

to:

shiftOut(pinDatos, pinReloj, ordenBits, valor)

Parametros

pinDatos: el pin en el cual extraer cada bit (int)

pinReloj: el pin que hay que conmutar cada vez que a un pinDatos le ha sido enviado el valor correcto (int)

ordenBits: en qué orden rotar los bits; si hacia el MSBFIRST (bit más significante primero) o hacia el LSBFIRST (bit menos significante primero).
valor: los datos que rotar. (byte)

Retorno

Ninguno

Nota

June 03, 2010, at 06:12 PM by Equipo Traduccion -
Changed lines 7-10 from:

This is known as synchronous serial protocol and is a common way that microcontrollers communicate with sensors, and with other microcontrollers. The two devices stay synchronized, and communicate at close to maximum speeds, since they both share the same clock line. This is often referred to in chip hardware documentation as Serial Peripheral Interface (SPI).

Syntax

to:

Esto es conocido como protocolo serie síncrono y es la forma común que utilizan los microcontroladores para comunicarse con sensores y con otros microcontroladores. Ambos dispositivos permanecen sincronizados, y se comunican a velocidades cercanas a las máximas, hasta que ambos compartan la misma linea de reloj. En la documentación del harware interno de los chips se hace referencia a menudo a esta característica como Serial Peripheral Interface (SPI).

Sintaxis

June 03, 2010, at 05:56 PM by Equipo Traduccion -
June 03, 2010, at 05:56 PM by Equipo Traduccion -
Changed lines 3-5 from:

Description

Shifts out a byte of data one bit at a time. Starts from either the most (i.e. the leftmost) or least (rightmost) significant bit. Each bit is written in turn to a data pin, after which a clock pin is toggled to indicate that the bit is available.

to:

Descripción

Rota cada vez un bit de un byte de datos. Empieza desde el bit más significante (el de más a la izquierda) o el menos significante (el más a la derecha). Cada bit se escribe siguiendo su turno en un pin de datos, después de conmutar un pin de reloj (señal de reloj) para indicar que el bit está disponible.

May 13, 2009, at 06:14 AM by Paul Badger -
Changed line 32 from:

data = 500;

to:

int data = 500;

May 12, 2009, at 06:20 PM by Paul Badger -
Changed line 29 from:

shiftOut is currently written to output 1 byte (8 bits) so it requires a two step operation to output values larger than 255.

to:

shiftOut is currently written to output 1 byte (8 bits) so it requires a two step operation to output values larger than 255.

May 12, 2009, at 06:20 PM by Paul Badger -
Deleted line 41:
May 12, 2009, at 06:19 PM by Paul Badger -
Changed line 30 from:
to:

[@

Changed lines 44-46 from:

shiftOut(dataPin, clock, LSBFIRST, (data >> 8));

to:

shiftOut(dataPin, clock, LSBFIRST, (data >> 8)); @]

May 12, 2009, at 06:18 PM by Paul Badger -
Added lines 29-46:

shiftOut is currently written to output 1 byte (8 bits) so it requires a two step operation to output values larger than 255.

// Do this for MSBFIRST serial data = 500; // shift out highbyte shiftOut(dataPin, clock, MSBFIRST, (data >> 8)); // shift out lowbyte shiftOut(data, clock, MSBFIRST, data);

// Or do this for LSBFIRST serial data = 500; // shift out lowbyte shiftOut(dataPin, clock, LSBFIRST, data);

// shift out highbyte shiftOut(dataPin, clock, LSBFIRST, (data >> 8));

November 02, 2008, at 10:56 AM by David A. Mellis -
Changed lines 1-2 from:

shiftOut(dataPin, clockPin, bitOrder, value)

to:

shiftOut()

Changed lines 4-7 from:

Shifts out a byte of data one bit at a time. Starts from either the most (i.e. the leftmost) or least (rightmost) significant bit. Each bit is written in turn to the dataPin, after which the clockPin is toggled to indicate that the bit is available.

This is known as synchronous serial protocol and is a common way that microcontrollers communicate with sensors, and with other microcontrollers. The two devices always stay synchronized, and communicate at close to maximum speeds, since they both share the same clock line. This is often referred to in chip hardware documentation as Serial Peripheral Interface (SPI)

to:

Shifts out a byte of data one bit at a time. Starts from either the most (i.e. the leftmost) or least (rightmost) significant bit. Each bit is written in turn to a data pin, after which a clock pin is toggled to indicate that the bit is available.

This is known as synchronous serial protocol and is a common way that microcontrollers communicate with sensors, and with other microcontrollers. The two devices stay synchronized, and communicate at close to maximum speeds, since they both share the same clock line. This is often referred to in chip hardware documentation as Serial Peripheral Interface (SPI).

Syntax

shiftOut(dataPin, clockPin, bitOrder, value)

Changed lines 27-28 from:

The dataPin and clockPin must already be configured as outputs by a call to pinMode.

to:

The dataPin and clockPin must already be configured as outputs by a call to pinMode().

Deleted lines 67-107:

Note

Note that this function, as it is currently written, is hard-wired to output 8 bits at a time. An int holds two bytes (16 bits), so outputting an int with shiftout requires a two-step operation:

Example:

int data;
int clock;
int cs;
...

digitalWrite(cs, LOW);
data = 500;
shiftOut(data, clock, MSBFIRST, data)
digitalWrite(cs, HIGH);

// this will actually only output 244 because 
// 500 % 256 = 244
// since only the low 8 bits are output

// Instead do this for MSBFIRST serial
data = 500;
// shift out highbyte
// " >> " is bitshift operator - moves top 8 bits (high byte) into low byte 
shiftOut(data, clock, MSBFIRST, (data >> 8));  

// shift out lowbyte
shiftOut(data, clock, MSBFIRST, data);



// And do this for LSBFIRST serial
data = 500;
// shift out lowbyte
shiftOut(data, clock, LSBFIRST, data);  

// shift out highbyte 
shiftOut(data, clock, LSBFIRST, (data >> 8));

See

October 18, 2008, at 04:36 PM by Paul Badger -
Changed line 104 from:
to:

See

October 18, 2008, at 04:33 PM by Paul Badger -
Changed lines 6-7 from:

This is known as synchronous serial protocol and is a common way that microcontrollers communicate with sensors, and with other microcontrollers. The two devices always stay synchronized, and communicate at close to maximum speeds, since they both share the same clock line. This is often referred to in chip hardware documentation as Synchronous Peripheral Interface (SPI)

to:

This is known as synchronous serial protocol and is a common way that microcontrollers communicate with sensors, and with other microcontrollers. The two devices always stay synchronized, and communicate at close to maximum speeds, since they both share the same clock line. This is often referred to in chip hardware documentation as Serial Peripheral Interface (SPI)

October 18, 2008, at 04:32 PM by Paul Badger -
Changed lines 6-7 from:

This is known as synchronous serial protocol and is a common way that microcontrollers communicate with sensors, and with other microcontrollers. The two devices always stay synchronized, and communicate at close to maximum speeds, since they both share the same clock line. This is often referred to in hardware documentation as Synchronous Peripheral Interface (SPI)

to:

This is known as synchronous serial protocol and is a common way that microcontrollers communicate with sensors, and with other microcontrollers. The two devices always stay synchronized, and communicate at close to maximum speeds, since they both share the same clock line. This is often referred to in chip hardware documentation as Synchronous Peripheral Interface (SPI)

October 18, 2008, at 04:30 PM by Paul Badger -
Changed lines 6-7 from:

This is known as synchronous serial protocol and is a common way that microcontrollers communicate with sensors, and with other microcontrollers. The two devices always stay synchronized, and communicate at close to maximum speeds, since they both share the same clock line.

to:

This is known as synchronous serial protocol and is a common way that microcontrollers communicate with sensors, and with other microcontrollers. The two devices always stay synchronized, and communicate at close to maximum speeds, since they both share the same clock line. This is often referred to in hardware documentation as Synchronous Peripheral Interface (SPI)

July 22, 2008, at 04:05 AM by David A. Mellis -
Changed lines 6-7 from:

This is known as synchronous serial protocol and is a common way that microcontrollers communicate with sensors, and with other microcontrollers. The two devices always stay synchronized, and communicate at close to maximum speeds, since they both share the same clock line. Often referred to as SPI (synchronous protocol interface) in hardware documentation.

to:

This is known as synchronous serial protocol and is a common way that microcontrollers communicate with sensors, and with other microcontrollers. The two devices always stay synchronized, and communicate at close to maximum speeds, since they both share the same clock line.

Deleted lines 24-64:

Common Programming Errors

Note also that this function, as it is currently written, is hard-wired to output 8 bits at a time. An int holds two bytes (16 bits), so outputting an int with shiftout requires a two-step operation:

Example:

int data;
int clock;
int cs;
...

digitalWrite(cs, LOW);
data = 500;
shiftOut(data, clock, MSBFIRST, data)
digitalWrite(cs, HIGH);

// this will actually only output 244 because 
// 500 % 256 = 244
// since only the low 8 bits are output

// Instead do this for MSBFIRST serial
data = 500;
// shift out highbyte
// " >> " is bitshift operator - moves top 8 bits (high byte) into low byte 
shiftOut(data, clock, MSBFIRST, (data >> 8));  

// shift out lowbyte
shiftOut(data, clock, MSBFIRST, data);



// And do this for LSBFIRST serial
data = 500;
// shift out lowbyte
shiftOut(data, clock, LSBFIRST, data);  

// shift out highbyte 
shiftOut(data, clock, LSBFIRST, (data >> 8));

Changed lines 65-103 from:
to:

Note

Note that this function, as it is currently written, is hard-wired to output 8 bits at a time. An int holds two bytes (16 bits), so outputting an int with shiftout requires a two-step operation:

Example:

int data;
int clock;
int cs;
...

digitalWrite(cs, LOW);
data = 500;
shiftOut(data, clock, MSBFIRST, data)
digitalWrite(cs, HIGH);

// this will actually only output 244 because 
// 500 % 256 = 244
// since only the low 8 bits are output

// Instead do this for MSBFIRST serial
data = 500;
// shift out highbyte
// " >> " is bitshift operator - moves top 8 bits (high byte) into low byte 
shiftOut(data, clock, MSBFIRST, (data >> 8));  

// shift out lowbyte
shiftOut(data, clock, MSBFIRST, data);



// And do this for LSBFIRST serial
data = 500;
// shift out lowbyte
shiftOut(data, clock, LSBFIRST, data);  

// shift out highbyte 
shiftOut(data, clock, LSBFIRST, (data >> 8));

December 22, 2007, at 02:47 PM by Paul Badger -
Changed lines 59-60 from:

shiftOut(data, clock, MSBFIRST, data);

to:

shiftOut(data, clock, LSBFIRST, data);

Changed line 62 from:

shiftOut(data, clock, MSBFIRST, (data >> 8));

to:

shiftOut(data, clock, LSBFIRST, (data >> 8));

December 22, 2007, at 02:46 PM by Paul Badger -
Changed line 48 from:

// " >> " is bitshift operator - moves top 8 bit (high byte) into low byte

to:

// " >> " is bitshift operator - moves top 8 bits (high byte) into low byte

December 22, 2007, at 02:45 PM by Paul Badger -
Changed lines 27-28 from:

Note also that this function, as it is currently written, is hard-wired to output 8 bits at a time. An int holds two bytes (16 bits), so if one tries to outputing an int with shiftout requires a two-step operation:

to:

Note also that this function, as it is currently written, is hard-wired to output 8 bits at a time. An int holds two bytes (16 bits), so outputting an int with shiftout requires a two-step operation:

December 05, 2007, at 07:56 PM by Paul Badger -
Changed lines 13-16 from:

bitOrder: which order to shift out the bits; either MSBFIRST or LSBFIRST.

(Most Significant Bit First, or, Least Significant Bit First)
to:

bitOrder: which order to shift out the bits; either MSBFIRST or LSBFIRST.
(Most Significant Bit First, or, Least Significant Bit First)

December 05, 2007, at 07:56 PM by Paul Badger -
Changed lines 13-14 from:

bitOrder: which order to shift out the bits; either MSBFIRST or LSBFIRST.\\

to:

bitOrder: which order to shift out the bits; either MSBFIRST or LSBFIRST.

December 05, 2007, at 07:55 PM by Paul Badger -
Changed lines 14-15 from:
(Most Significant Bit First, or, Least Significant Bit First)
to:
(Most Significant Bit First, or, Least Significant Bit First)
December 05, 2007, at 07:55 PM by Paul Badger -
December 05, 2007, at 07:53 PM by Paul Badger -
Changed lines 14-15 from:

(Most Significant Bit First, or, Least Significant Bit First)

to:
(Most Significant Bit First, or, Least Significant Bit First)
December 05, 2007, at 07:52 PM by Paul Badger -
Changed line 13 from:

bitOrder: which order to shift out the bits; either MSBFIRST or LSBFIRST.

to:

bitOrder: which order to shift out the bits; either MSBFIRST or LSBFIRST.\\

December 05, 2007, at 07:52 PM by Paul Badger -
Changed lines 13-14 from:

bitOrder: which order to shift out the bits (either MSBFIRST or LSBFIRST).

to:

bitOrder: which order to shift out the bits; either MSBFIRST or LSBFIRST. (Most Significant Bit First, or, Least Significant Bit First)

December 05, 2007, at 07:50 PM by Paul Badger -
Changed lines 26-27 from:

Note also that this function, as it is currently written, is hard-wired to output 8 bits at a time. An int holds two bytes (16 bits), so if one tries to do something like this:

to:

Note also that this function, as it is currently written, is hard-wired to output 8 bits at a time. An int holds two bytes (16 bits), so if one tries to outputing an int with shiftout requires a two-step operation:

Example:

November 04, 2007, at 05:35 AM by Paul Badger -
Changed lines 4-5 from:

Shifts out a byte of data one bit at a time. Starts from either the most (i.e. the leftmost) or least (rightmost) significant bit. Each bit is written in turn to a pin, after which another pin is toggled to indicate that the bit is available.

to:

Shifts out a byte of data one bit at a time. Starts from either the most (i.e. the leftmost) or least (rightmost) significant bit. Each bit is written in turn to the dataPin, after which the clockPin is toggled to indicate that the bit is available.

July 15, 2007, at 01:10 AM by Paul Badger -
Added line 47:
Added line 55:

// shift out lowbyte

Changed lines 57-58 from:

// shift out lowbyte

to:

// shift out highbyte

Changed lines 60-62 from:

// shift out highbyte @]

to:

@]

July 15, 2007, at 01:09 AM by Paul Badger -
Changed lines 45-46 from:

shiftOut(data, clock, MSBFIRST, (data >> 8)); // >> is bitshift operator - moves highbyte into lowbyte

to:

// " >> " is bitshift operator - moves top 8 bit (high byte) into low byte shiftOut(data, clock, MSBFIRST, (data >> 8));

July 15, 2007, at 01:08 AM by Paul Badger -
Deleted line 43:

shiftOut(data, clock, MSBFIRST, (data >> 8));

Added lines 45-46:

shiftOut(data, clock, MSBFIRST, (data >> 8)); // >> is bitshift operator - moves highbyte into lowbyte // shift out lowbyte

Added lines 48-53:

// And do this for LSBFIRST serial data = 500; shiftOut(data, clock, MSBFIRST, data);

Deleted lines 54-59:

// And do this for LSBFIRST serial data = 500; shiftOut(data, clock, MSBFIRST, data); // shift out lowbyte

April 14, 2007, at 06:30 AM by Paul Badger -
Changed lines 6-7 from:

This is known as synchronous serial protocol and is a common way that microcontrollers communicate with sensors, and with other microcontrollers. The two devices always stay synchronized, and communicate at close to maximum speeds, since they both share the same clock line. Often referred to in hardware documentation as SPI.

to:

This is known as synchronous serial protocol and is a common way that microcontrollers communicate with sensors, and with other microcontrollers. The two devices always stay synchronized, and communicate at close to maximum speeds, since they both share the same clock line. Often referred to as SPI (synchronous protocol interface) in hardware documentation.

April 14, 2007, at 04:44 AM by Paul Badger -
April 14, 2007, at 04:43 AM by Paul Badger -
Changed line 25 from:

Common Errors

to:

Common Programming Errors

April 14, 2007, at 04:42 AM by Paul Badger -
Changed lines 25-27 from:

Warning

Note also that this function, as it is currently written, only outputs 8 bits at a time. An int holds two bytes (16 bits), so if one tries to do something like this:

to:

Common Errors

Note also that this function, as it is currently written, is hard-wired to output 8 bits at a time. An int holds two bytes (16 bits), so if one tries to do something like this:

April 14, 2007, at 04:27 AM by Paul Badger -
Changed lines 26-27 from:

Note also that this function, as it is currently written, only outputs 8 bits at a time. An int holds two bytes, so if one tries to do something like this:

to:

Note also that this function, as it is currently written, only outputs 8 bits at a time. An int holds two bytes (16 bits), so if one tries to do something like this:

April 14, 2007, at 04:26 AM by Paul Badger -
Changed lines 26-27 from:

Note also that this function, as it is currently written, only outputs 8 bits at a time. An int holds two bytes so if one tries to do something like this:

to:

Note also that this function, as it is currently written, only outputs 8 bits at a time. An int holds two bytes, so if one tries to do something like this:

April 14, 2007, at 04:25 AM by Paul Badger -
Changed lines 4-5 from:

Shifts out a byte of data one bit at a time. Starts from either the most (i.e. the leftmost) or least (rightmost) significant bit. Each bit is written in turn to a pin, after which another pin is toggled to indicate that the bit is available.

to:

Shifts out a byte of data one bit at a time. Starts from either the most (i.e. the leftmost) or least (rightmost) significant bit. Each bit is written in turn to a pin, after which another pin is toggled to indicate that the bit is available.

This is known as synchronous serial protocol and is a common way that microcontrollers communicate with sensors, and with other microcontrollers. The two devices always stay synchronized, and communicate at close to maximum speeds, since they both share the same clock line. Often referred to in hardware documentation as SPI.

Added lines 24-57:

Warning

Note also that this function, as it is currently written, only outputs 8 bits at a time. An int holds two bytes so if one tries to do something like this:

int data;
int clock;
int cs;
...

digitalWrite(cs, LOW);
data = 500;
shiftOut(data, clock, MSBFIRST, data)
digitalWrite(cs, HIGH);

// this will actually only output 244 because 
// 500 % 256 = 244
// since only the low 8 bits are output

// Instead do this for MSBFIRST serial
data = 500;
shiftOut(data, clock, MSBFIRST, (data >> 8));  
// shift out highbyte
shiftOut(data, clock, MSBFIRST, data);
// shift out lowbyte


// And do this for LSBFIRST serial
data = 500;
shiftOut(data, clock, MSBFIRST, data);  
// shift out lowbyte
shiftOut(data, clock, MSBFIRST, (data >> 8));
// shift out highbyte 

December 02, 2006, at 04:42 PM by David A. Mellis -
Changed lines 25-26 from:
 [@//**************************************************************//
to:

[@//**************************************************************//

December 02, 2006, at 04:42 PM by David A. Mellis -
Changed line 25 from:
 [@ //**************************************************************//
to:
 [@//**************************************************************//
December 02, 2006, at 04:42 PM by David A. Mellis -
Changed lines 25-27 from:
 [@

//**************************************************************//

to:
 [@ //**************************************************************//
Deleted lines 40-41:
December 02, 2006, at 04:41 PM by David A. Mellis -
Added lines 23-25:

For accompanying circuit, see the tutorial on controlling a 74HC595 shift register.

Changed lines 65-66 from:

For accompanying circuit, see the tutorial on controlling a 74HC595 shift register.

to:
December 02, 2006, at 04:41 PM by David A. Mellis -
Changed lines 60-62 from:

} @]

to:

} @]

December 02, 2006, at 04:41 PM by David A. Mellis -
Added lines 18-21:

Note

The dataPin and clockPin must already be configured as outputs by a call to pinMode.

Deleted line 60:
Changed lines 63-66 from:

Note

The dataPin and clockPin must already be configured as outputs by a call to pinMode.

to:

For accompanying circuit, see the tutorial on controlling a 74HC595 shift register.

December 02, 2006, at 04:39 PM by David A. Mellis -
Changed lines 21-22 from:

// Name : shiftOutCode, Hello World // // Author : Carlyn Maw,Tom Igoe //

to:

// Name : shiftOutCode, Hello World // // Author : Carlyn Maw,Tom Igoe //

Added line 57:
December 02, 2006, at 04:38 PM by David A. Mellis -
Added lines 1-63:

shiftOut(dataPin, clockPin, bitOrder, value)

Description

Shifts out a byte of data one bit at a time. Starts from either the most (i.e. the leftmost) or least (rightmost) significant bit. Each bit is written in turn to a pin, after which another pin is toggled to indicate that the bit is available.

Parameters

dataPin: the pin on which to output each bit (int)

clockPin: the pin to toggle once the dataPin has been set to the correct value (int)

bitOrder: which order to shift out the bits (either MSBFIRST or LSBFIRST).

value: the data to shift out. (byte)

Returns

None

Example

 
//**************************************************************//
//  Name    : shiftOutCode, Hello World                                 //
//  Author  : Carlyn Maw,Tom Igoe                           //
//  Date    : 25 Oct, 2006                                      //
//  Version : 1.0                                               //
//  Notes   : Code for using a 74HC595 Shift Register           //
//          : to count from 0 to 255                            //
//****************************************************************

//Pin connected to ST_CP of 74HC595
int latchPin = 8;
//Pin connected to SH_CP of 74HC595
int clockPin = 12;
////Pin connected to DS of 74HC595
int dataPin = 11;



void setup() {
  //set pins to output because they are addressed in the main loop
  pinMode(latchPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
  pinMode(dataPin, OUTPUT);
}

void loop() {
  //count up routine
  for (int j = 0; j < 256; j++) {
    //ground latchPin and hold low for as long as you are transmitting
    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, LSBFIRST, j);   
    //return the latch pin high to signal chip that it 
    //no longer needs to listen for information
    digitalWrite(latchPin, HIGH);
    delay(1000);
  }
}

Note

The dataPin and clockPin must already be configured as outputs by a call to pinMode.

Reference Home

Share