Arduino Playground is read-only starting December 31st, 2018. For more info please look at this Forum Post

ShiftRegister595 Library for Arduino
Author:  Alexander Brevig
Contact: alexanderbrevig@gmail.com


Navigation


Current version

1.0 2009-04-13: Initial Release


History

1.0 2009-04-13: Initial Release


Description

ShiftRegister595 is an interface for ShiftRegister595s on the Arduino.

It is created to help Hardware Abstraction, and readability of code. It declres the functionalities a ShiftRegister595 has to provide for complete abstraction of the bit shifting.

ShiftRegister595 library is part of the Hardware Abstraction libraries.


Download, install and import

Download here: ShiftRegister595.zip


Creation

ShiftRegister595(byte* userPins, byte numberOfUserPins)

byte latchPin = 8;  //Pin connected to ST_CP of 74HC595
byte clockPin = 12; //Pin connected to SH_CP of 74HC595
byte dataPin = 11;  //Pin connected to DS    of 74HC595
ShiftRegister595 shiftRegister595 = ShiftRegister595( latchPin , clockPin , dataPin );

Initiates a ShiftRegister595 object that uses pins 8, 11 and 12.


Functions

void buffer(byte out)

A way to buffer a byte and prepare it to get shifted.

void write()

A way to write the contents of the current buffer to the ShiftRegister595

void write(byte out)

A way to write the byte 'out' to the ShiftRegister595


Example

  1. #include "ShiftRegister595.h"
  2.  
  3. byte latchPin = 8;  //Pin connected to ST_CP of 74HC595
  4. byte clockPin = 12; //Pin connected to SH_CP of 74HC595
  5. byte dataPin = 11;  //Pin connected to DS    of 74HC595
  6.  
  7. ShiftRegister595 shiftRegister595 = ShiftRegister595( latchPin , clockPin , dataPin );
  8.  
  9.  
  10. void setup() {
  11. }
  12.  
  13. void loop() {
  14.   //count up routine
  15.   for (int j = 0; j < 256; j++) {
  16.     shiftRegister595.write(j);
  17.     delay(1000);
  18.   }
  19. }


FAQ

How can I use multiple ShiftRegister595s?


Information about this page

Part of AlphaBeta Libraries.
Last Modified: October 20, 2015, at 06:53 PM
By: pert