Go Down

Topic: 74HC595 (Read 414 times) previous topic - next topic

pranoy

hi guys

         how can i output numbers in desending order, (say 20 - 00)  using 74HC595 shift register IC using an arduino uno???????

         this output is needed to run seven segment display

CrossRoads

Here's a couple of ways to connect one up.

To drive it, you will create an array of fonts, where each byte represents the on/off state of the segments
Code: [Select]

fontArray[] = {
B00111111, // 0
B00000110, // 1
B01011011, // 2
etc
};

Bit 0 is segment A
1 is B,
2 is C,
3 is D,
4 is E,
5 is F,
6 is G
    A
F       B
    G
E       C
    D
7 would be decimal point if used
Then when you select number you want to display, you pull the information from the array.
I prefer using SPI to transfer data out, nice & fast:
Code: [Select]

digitalWrite (SS, LOW);
SPI.transfer(fontArray[number_to_display]);
digitalWrite(SS, HIGH);

If you have 2 digits, then daisy chain OutH/ to SerialDataIn, with SCK & SS going to both chips in parallel
Then just send out 2 bytes:
Code: [Select]

digitalWrite (SS, LOW);
SPI.transfer(fontArray[Low_number_to_display]);
SPI.transfer(fontArray[High_number_to_display]);
digitalWrite(SS, HIGH);

Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

Go Up