<< Read Previous Page
Read the beginning at previous page.
Various shiftout values and state of Qn pins in MSBFIRST order are given below. If any of the output (Q0 - Q7) is 1, corresponding LED will turn on. Similarly if any of the output (Q0 - Q7) is 0, corresponding LED will turn off.
ShiftOut Value ShiftOut Order Q0 Q1 Q2 Q3 Q4 Q5 Q6 Q7
0 MSBFIRST 0 0 0 0 0 0 0 0
1 MSBFIRST 1 0 0 0 0 0 0 0
2 MSBFIRST 0 1 0 0 0 0 0 0
3 MSBFIRST 1 1 0 0 0 0 0 0
4 MSBFIRST 0 0 1 0 0 0 0 0
5 MSBFIRST 1 0 1 0 0 0 0 0
6 MSBFIRST 0 1 1 0 0 0 0 0
7 MSBFIRST 1 1 1 0 0 0 0 0
8 MSBFIRST 0 0 0 1 0 0 0 0
9 MSBFIRST 1 0 0 1 0 0 0 0
253 MSBFIRST 1 0 1 1 1 1 1 1
ShiftOut Value ShiftOut Order Q0 Q1 Q2 Q3 Q4 Q5 Q6 Q7
0 LSBFIRST 0 0 0 0 0 0 0 0
1 LSBFIRST 0 0 0 0 0 0 0 1
2 LSBFIRST 0 0 0 0 0 0 1 0
3 LSBFIRST 0 0 0 0 0 0 1 1
4 LSBFIRST 0 0 0 0 0 1 0 0
5 LSBFIRST 0 0 0 0 0 1 0 1
6 LSBFIRST 0 0 0 0 0 1 1 0
7 LSBFIRST 0 0 0 0 0 1 1 1
8 LSBFIRST 0 0 0 0 1 0 0 0
9 LSBFIRST 0 0 0 0 1 0 0 1
From this we understand that, using shift registers, we can control any LEDs as single or as groups by shifting out proper values to the shift register. That is, using only three digital output pins of arduino , we can control eight LEDs individually or as groups.
Various shiftout values and state of Qn pins in MSBFIRST order are given below. If any of the output (Q0 - Q7) is 1, corresponding LED will turn on. Similarly if any of the output (Q0 - Q7) is 0, corresponding LED will turn off.
ShiftOut Value ShiftOut Order Q0 Q1 Q2 Q3 Q4 Q5 Q6 Q7
0 MSBFIRST 0 0 0 0 0 0 0 0
1 MSBFIRST 1 0 0 0 0 0 0 0
2 MSBFIRST 0 1 0 0 0 0 0 0
3 MSBFIRST 1 1 0 0 0 0 0 0
4 MSBFIRST 0 0 1 0 0 0 0 0
5 MSBFIRST 1 0 1 0 0 0 0 0
6 MSBFIRST 0 1 1 0 0 0 0 0
7 MSBFIRST 1 1 1 0 0 0 0 0
8 MSBFIRST 0 0 0 1 0 0 0 0
9 MSBFIRST 1 0 0 1 0 0 0 0
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .253 MSBFIRST 1 0 1 1 1 1 1 1
254 MSBFIRST 0 1 1 1 1 1 1 1
255 MSBFIRST 1 1 1 1 1 1 1 1
Program to shift out number 1 to 74595 in LSBFIRST order
Now upload the following program to your arduino board.
Output:
Q7 will turn on, all others will turn off.
Q0 Q1 Q2 Q3 Q4 Q5 Q6 Q7
0 0 0 0 0 0 0 1
Program to shift out number 2 to 74595 in LSBFIRST order
Now upload the following program to your arduino board.
Output:
Q6 will turn on, all others will turn off.
Q0 Q1 Q2 Q3 Q4 Q5 Q6 Q7
0 0 0 0 0 0 1 0
Program to shift out number 3 to 74595 in LSBFIRST order
Now upload the following program to your arduino board.
Output:
Q6 and Q7 will turn on, all others will turn off.
Q0 Q1 Q2 Q3 Q4 Q5 Q6 Q7
0 0 0 0 0 0 1 1
Various shiftout values and state of Qn pins in LSBFIRST order are given below. If any of the output (Q0 - Q7) is 1, corresponding LED will turn on. Similarly if any of the output (Q0 - Q7) is 0, corresponding LED will turn off.
Program to shift out number 1 to 74595 in LSBFIRST order
Now upload the following program to your arduino board.
//Pin connected to ST_CP of 74595 int latchPin = 12; //Pin connected to SH_CP of 74595 int clockPin = 13; ////Pin connected to DS of 74595 int dataPin = 11; void setup() { //set pins to output so you can control the shift register pinMode(latchPin, OUTPUT); pinMode(clockPin, OUTPUT); pinMode(dataPin, OUTPUT); } void loop() { int ShiftOut_value = 1; // take the latchPin low so // the LEDs don't change while you're sending in bits: digitalWrite(latchPin, LOW); // shift out the bits: shiftOut(dataPin, clockPin, LSBFIRST, ShiftOut_value); //take the latch pin high so the LEDs will light up: digitalWrite(latchPin, HIGH); }
Output:
Q7 will turn on, all others will turn off.
Q0 Q1 Q2 Q3 Q4 Q5 Q6 Q7
0 0 0 0 0 0 0 1
Program to shift out number 2 to 74595 in LSBFIRST order
Now upload the following program to your arduino board.
//Pin connected to ST_CP of 74595 int latchPin = 12; //Pin connected to SH_CP of 74595 int clockPin = 13; ////Pin connected to DS of 74595 int dataPin = 11; void setup() { //set pins to output so you can control the shift register pinMode(latchPin, OUTPUT); pinMode(clockPin, OUTPUT); pinMode(dataPin, OUTPUT); } void loop() { int ShiftOut_value = 1; // take the latchPin low so // the LEDs don't change while you're sending in bits: digitalWrite(latchPin, LOW); // shift out the bits: shiftOut(dataPin, clockPin, LSBFIRST, ShiftOut_value); //take the latch pin high so the LEDs will light up: digitalWrite(latchPin, HIGH); }
Output:
Q6 will turn on, all others will turn off.
Q0 Q1 Q2 Q3 Q4 Q5 Q6 Q7
0 0 0 0 0 0 1 0
Program to shift out number 3 to 74595 in LSBFIRST order
Now upload the following program to your arduino board.
//Pin connected to ST_CP of 74595 int latchPin = 12; //Pin connected to SH_CP of 74595 int clockPin = 13; ////Pin connected to DS of 74595 int dataPin = 11; void setup() { //set pins to output so you can control the shift register pinMode(latchPin, OUTPUT); pinMode(clockPin, OUTPUT); pinMode(dataPin, OUTPUT); } void loop() { int ShiftOut_value = 1; // take the latchPin low so // the LEDs don't change while you're sending in bits: digitalWrite(latchPin, LOW); // shift out the bits: shiftOut(dataPin, clockPin, LSBFIRST, ShiftOut_value); //take the latch pin high so the LEDs will light up: digitalWrite(latchPin, HIGH); }
Output:
Q6 and Q7 will turn on, all others will turn off.
Q0 Q1 Q2 Q3 Q4 Q5 Q6 Q7
0 0 0 0 0 0 1 1
Various shiftout values and state of Qn pins in LSBFIRST order are given below. If any of the output (Q0 - Q7) is 1, corresponding LED will turn on. Similarly if any of the output (Q0 - Q7) is 0, corresponding LED will turn off.
ShiftOut Value ShiftOut Order Q0 Q1 Q2 Q3 Q4 Q5 Q6 Q7
0 LSBFIRST 0 0 0 0 0 0 0 0
1 LSBFIRST 0 0 0 0 0 0 0 1
2 LSBFIRST 0 0 0 0 0 0 1 0
3 LSBFIRST 0 0 0 0 0 0 1 1
4 LSBFIRST 0 0 0 0 0 1 0 0
5 LSBFIRST 0 0 0 0 0 1 0 1
6 LSBFIRST 0 0 0 0 0 1 1 0
7 LSBFIRST 0 0 0 0 0 1 1 1
8 LSBFIRST 0 0 0 0 1 0 0 0
9 LSBFIRST 0 0 0 0 1 0 0 1
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
253 LSBFIRST 1 1 1 1 1 1 0 1
254 LSBFIRST 0 1 1 1 1 1 1 0
255 LSBFIRST 1 1 1 1 1 1 1 1
Next : Control LED Matrix using 74595 and Arduino |
0 comments: