Pages: 1 [2]   Go Down
Author Topic: HELP: 2 7 segment display (0-F) using 74LS595 shift register with 8 bit inputs  (Read 2711 times)
0 Members and 1 Guest are viewing this topic.
Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 524
Posts: 26449
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

I see now - I had misread what the bitWrite was doing. The array only holds the pin numbers, not the actual result.
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.

philippines
Offline Offline
Jr. Member
**
Karma: 0
Posts: 68
I love God
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Well you didn't read the sticky or your code would be in code tags. Yes, it's a big thing. A really big thing.

Thanks sir Nick. I was talking about the 5-hour thing and about my "UP" reply. noted.

If you have 4 switches, one option is to convert those 4 inputs into a number:
Code:
BCD_number = 0; // clear the variable to start
BCD_number = digitalRead(Din);  // result is 0 or 1
BCD_number = BCD_Number <<1 + digitalRead(Cin); // shift over 1 bit, and add in next bit
BCD_number = BCD_Number <<1 + digitalRead(Bin); // shift over 1 bit, and add in next bit
BCD_number = BCD_Number <<1 + digitalRead(Ain); // shift over 1 bit, and add in next bit
Serial.println (BCD_Number, DEC); // check the result

// Now use your display mapping:
shiftout(dataPin, clockPin, MSBFIRST, numbers[BCD_number] ); // lookup the mapping in the array and send it to the shift register
 



Thank you so much sir! By the way, I just have to
add this:
BCD_number = BCD_Number <<1 + digitalRead(Din); // shift over 1 bit, and add in next bit

and then copy-paste all these lines to the loop function, right?

Also, is there anything else I need to modify in the codes to display two hex digits in two 7 segment display? How am I suppose to connect the second shift register to the first one?
Logged

Never argue with stupid people, they will drag you down to their level and then beat you with experience.
-mt

Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 524
Posts: 26449
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

Yes, read the switches, make the result into a number.
Use the number to look up the character you want to send out.
Shift registers connect like this.
I don't know if your mapping has 1 = on for a segment, or if your display uses common cathode or common anode parts.
With common cathode, 1 = on for a segment. WIth common anode, 0 = on for a segment.
Don't forget the caps on the +5V pin for reliable operation.


* daisychain_shift_registers.jpg (62.81 KB, 960x720 - viewed 47 times.)
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 [2]   Go Up
Jump to: