<<<< Read previous part (Part 11)
We had already seen the frames needed to generate "HE" display. In the last blog, we created the seventh frame for "HE" display. In this blog, we will create the eighth frame. Complete the circuit given in this page. Upload the following program to your arduino board. This program will create the eighth frame for "HE" display.
Output of the above program can be seen in 16*8 LED display. Output is given below.
Arduino will shift out number 254 to the first 74595. Then, 254 will be stored in first 74595. After that, arduino will shift out number 195 to the first 74595. Then, 254 will be shifted to the second 74595 from first 74595 and 195 will be stored in first 74595. After that, arduino will shift out 127 to the third 74595. This can be pictorially represented as shown below. 195 stored in first 74595 will appear across the anode terminals of first 8*8 LED matrix. 254 stored in second 74595 will appear across the anode terminals of second 8*8 LED matrix. 127 stored in third 74595 will appear across the cathode terminals of both 8*8 LED matrices which will give the expected output.
After that, turn off all LEDs by shifting out 255 to the third 74595. 255 will send HIGH to the cathode terminals of LED matrices which will turn off all LEDs.
int latchPin = 11; //Pin connected to ST_CP of 1st 74595 int clockPin = 12; //Pin connected to SH_CP of 1st 74595 int dataPin = 13; //Pin connected to DS of 1st 74595 int latchPin2 = 8; //Pin connected to ST_CP of 2nd 74595 int clockPin2 = 9; //Pin connected to SH_CP of 2nd 74595 int dataPin2 = 10; //Pin connected to DS of 2nd 74595 void setup() { //set pins to output so you can control the shift register pinMode(latchPin, OUTPUT); pinMode(clockPin, OUTPUT); pinMode(dataPin, OUTPUT); pinMode(latchPin2, OUTPUT); pinMode(clockPin2, OUTPUT); pinMode(dataPin2, OUTPUT); } void loop() { // take the latchPin low so the LEDs don't change while you're sending in bits: digitalWrite(latchPin, LOW); //Send 1 1 1 1 1 1 1 0 (254) to Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0 of 2nd 74595 shiftOut(dataPin, clockPin, MSBFIRST, 254); //Send 1 1 0 0 0 0 1 1 (195) to Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0 of 1st 74595 shiftOut(dataPin, clockPin, MSBFIRST, 195); // shift out the bits: digitalWrite(latchPin, HIGH); // take the latchPin low so the LEDs don't change while you're sending in bits: digitalWrite(latchPin2, LOW); //Send 0 1 1 1 1 1 1 1 (127) to Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0 of 3rd 74595 shiftOut(dataPin2, clockPin2, MSBFIRST, 127); // shift out the bits: digitalWrite(latchPin2, HIGH); /********* Turn off all the LEDs *********/ // take the latchPin low so the LEDs don't change while you're sending in bits: digitalWrite(latchPin2, LOW); //Send 1 1 1 1 1 1 1 1 (255) to Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0 of 3rd 74595 shiftOut(dataPin2, clockPin2, MSBFIRST, 255); // shift out the bits: digitalWrite(latchPin2, HIGH); }
Output of the above program can be seen in 16*8 LED display. Output is given below.
Arduino will shift out number 254 to the first 74595. Then, 254 will be stored in first 74595. After that, arduino will shift out number 195 to the first 74595. Then, 254 will be shifted to the second 74595 from first 74595 and 195 will be stored in first 74595. After that, arduino will shift out 127 to the third 74595. This can be pictorially represented as shown below. 195 stored in first 74595 will appear across the anode terminals of first 8*8 LED matrix. 254 stored in second 74595 will appear across the anode terminals of second 8*8 LED matrix. 127 stored in third 74595 will appear across the cathode terminals of both 8*8 LED matrices which will give the expected output.
After that, turn off all LEDs by shifting out 255 to the third 74595. 255 will send HIGH to the cathode terminals of LED matrices which will turn off all LEDs.
Continue reading in next page (part 13) |
Great Article
ReplyDeleteIoT Projects
Python Training in Chennai
Project Center in Chennai
Python Training in Chennai