Hi. I'm new to Arduino and would like to understand better the shifting process with a 74HC595. I started a project with 2 shift registers, one quad led display and a couple of led's (the links are below) .One shift register is reserved for lighting 8 leds and the other for lighting the display with which led is pinned High in the exact moment : LED1, LED2 etc. ... but here is my problem: i can't make it work, the display part at least. I'm trying to display different numbers on my digits in the same time, like on digit one i want L, digit 2 E, digit 3 d, and digit 4 to change from 1 to 8. I can only get a single character display on all digits. My situation is similar to this guy here, the difference is i'm using a shift register:
http://forum.arduino.cc/index.php?topic=13442.0
My hardware connections for my quad display is the following:
-four digit pins i connect them to my Arduino board (4 slots-4 digits);
-my seven segments pins i connect them with the shift register, the last having also 3 wires connected to my arduino board (data, latch, clock);
Here's what i've got so far (only the display code for 2 digits, not with the leds for the moment):
int dataPin = A0;
int clockPin = A2;
int latchPin = A1;
int DigitPins[] = {3, 4, 5, 6};
int SegFolosite[]={56,121,94,6,91,79,102,109,125,7,127}; // in ordine: L,E,d,1,2,3,4,5,6,7,8
void setup() {
pinMode(dataPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(latchPin, OUTPUT);
for (int digit=0;digit<4;digit++) // daca nu e declarat, nu merg digitii !!!
pinMode(DigitPins[digit], OUTPUT);
}
void loop() {
/* for(int i=0;i<11;i++){
digitalWrite(latchPin, LOW); // take the latchPin low so the LEDs don't change while you're sending in bits;
shiftOut(dataPin, clockPin, MSBFIRST, SegFolosite[i]); // shift out the bits;
digitalWrite(latchPin, HIGH); //take the latch pin high so the LEDs will light up;
delay(1000); //freeze to view for a time what you've displayed
}
*/
digitalWrite(DigitPins[0],LOW);
digitalWrite(DigitPins[1],HIGH);
digitalWrite(DigitPins[2],HIGH);
digitalWrite(DigitPins[3],HIGH);
digitalWrite(latchPin, LOW); // take the latchPin low so the LEDs don't change while you're sending in bits;
shiftOut(dataPin, clockPin, MSBFIRST, SegFolosite[0]); // shift out the bits;
digitalWrite(latchPin, HIGH); //take the latch pin high so the LEDs will light up;
delayMicroseconds(7000);
digitalWrite(DigitPins[0],HIGH);
digitalWrite(DigitPins[1],LOW);
digitalWrite(DigitPins[2],HIGH);
digitalWrite(DigitPins[3],HIGH);
digitalWrite(latchPin, LOW); // take the latchPin low so the LEDs don't change while you're sending in bits;
shiftOut(dataPin, clockPin, MSBFIRST, SegFolosite[1]); // shift out the bits;
digitalWrite(latchPin, HIGH); //take the latch pin high so the LEDs will light up;
delayMicroseconds(7000);
}
Led Display x4, common cathode : http://www.conexelectronic.ro/produs.php?id=135534
Shift Register: http://www.conexelectronic.ro/produs.php?id=42388
Arduino programming board: Intel® Galileo Gen 2 - DEV-13096 - SparkFun Electronics
Any code to understand a 4 digit display led connected to a shift register would be hepful.