Pages: [1]   Go Down
Author Topic: 74HC595  (Read 341 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Jr. Member
**
Karma: 0
Posts: 76
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 513
Posts: 26247
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
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:
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:
digitalWrite (SS, LOW);
SPI.transfer(fontArray[Low_number_to_display]);
SPI.transfer(fontArray[High_number_to_display]);
digitalWrite(SS, HIGH);
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Pages: [1]   Go Up
Jump to: