Seven segment with 595 Shift register

Thread Starter

liamneeson248

Joined Jan 11, 2016
36
i am using a 595 Shift register to display seven segments.
everything is good as i am using common cathode segment with 220ohm resistor on every led.
but its making problems like now its keep G of the Led always on, Sometimes it on some other unexpected LED on during counting
i am providing VCC from arduino 5v but i also use external 5v supply to it,it keeps making problem also then.

Is 220ohm is good enough ?
is it something to do with common anode or common cathode ?
What can be the problem ?

Really sorry for my bad english.
I hope anyone here can help me regarding my issue My advance Thanks to you guys
 

Thread Starter

liamneeson248

Joined Jan 11, 2016
36

Here is the schematics and first of all i did tried using 5v VCC from arduino regulator but then i use external power supply but it doesnt work on anything Sometimes it works like it show 0 to 9 but then it behaves like it forget to turn off G on segment or some other LED on segment.
is there any problem with my resistor here ?
and why is every one on internet is using common anode Segments it doesnt make sense to me can you please answer that too ?
and what do i have to to in order to use common anode because you know simply 595 cannot give ground to all 7 LEDs.

i am using : 220 OHM resistors will all LEDs,common cathode segment.74HC595 shift register,arduino uno

And Thank you all for your kind replies !


and here is a simple code that i am using with my arduino

int latchpin = 4;// connect to pin 12 on the '595
int clockpin = 3; // connect to pin 11 on the '595
int datapin = 2; // connect to pin 14 on the '595
// the array contains the binary value to make digits 0-9
// for the number '11' use code '31' for CC and '224' for CA
int segment[10] = {63,6,91,79,102,109,125,7,127,111 }; // for common cathode
//int segment[10] = {192,249,164,176,153,146,130,248,128,144 }; // for common anode

void setup()
{
pinMode(latchpin, OUTPUT);
pinMode(clockpin, OUTPUT);
pinMode(datapin, OUTPUT);
}
void loop()
{


digitalWrite(latchpin, LOW);
shiftOut(datapin, clockpin, MSBFIRST, 7); Shows the Number 7 on display
digitalWrite(latchpin, HIGH);
delay(1000);

}
 

absf

Joined Dec 29, 2010
1,968
and why is every one on internet is using common anode Segments it doesnt make sense to me can you please answer that too ?
and what do i have to to in order to use common anode because you know simply 595 cannot give ground to all 7 LEDs.
If your using 74xx or 74LSxx TTL family, then it is better to using common anode 7-segment LED. The 74 and 74LS chips can sink more current than sourcing the LED. But I checked the 74HC595 datasheet and it can source and sink maximum of 25mA, so either sourcing or sinking (CC or CA 7 segment LED) are OK with it.

I cant get the Arduino to work in proteus because it doesn't accept the Arduino sketch .ino file. It can only accept .hex or .obj type file. I couldn't find any 74HC595 or LS595 handy and my Arduino uno is not with me at the moment.

arduino with HC595.PNG
Allen
 

absf

Joined Dec 29, 2010
1,968
Sorry for the delay. I finally got the uno to work on proteus.

I modify the program to display 0-9 repeatedly.

liamneeson_0-9.PNG
oops, I forgot to tie /MR high....

Here's the code

C:
int latchpin = 4;// connect to pin 12 on the '595
int clockpin = 3; // connect to pin 11 on the '595
int datapin = 2; // connect to pin 14 on the '595
// the array contains the binary value to make digits 0-9
// for the number '11' use code '31' for CC and '224' for CA
int segment[10] = {63,6,91,79,102,109,125,7,127,111 }; // for common cathode
//int segment[10] = {192,249,164,176,153,146,130,248,128,144 }; // for common anode

void setup()
{
pinMode(latchpin, OUTPUT);
pinMode(clockpin, OUTPUT);
pinMode(datapin, OUTPUT);
}
void loop()
{

for (char x=0; x < 10; x++)
{
char data = segment[x];

digitalWrite(latchpin, LOW);
shiftOut(datapin, clockpin, MSBFIRST, data); //Shows the Number 7 on display
digitalWrite(latchpin, HIGH);
delay(1000);

}
}
Hope Elvis hasn't left the building YET....:D

Allen

p/s hex file for proteus is included..
 

Attachments

Last edited:

Thread Starter

liamneeson248

Joined Jan 11, 2016
36
Sorry for the delay. I finally got the uno to work on proteus.

I modify the program to display 0-9 repeatedly.

View attachment 100671
oops, I forgot to tie /MR high....

Here's the code

C:
int latchpin = 4;// connect to pin 12 on the '595
int clockpin = 3; // connect to pin 11 on the '595
int datapin = 2; // connect to pin 14 on the '595
// the array contains the binary value to make digits 0-9
// for the number '11' use code '31' for CC and '224' for CA
int segment[10] = {63,6,91,79,102,109,125,7,127,111 }; // for common cathode
//int segment[10] = {192,249,164,176,153,146,130,248,128,144 }; // for common anode

void setup()
{
pinMode(latchpin, OUTPUT);
pinMode(clockpin, OUTPUT);
pinMode(datapin, OUTPUT);
}
void loop()
{

for (char x=0; x < 10; x++)
{
char data = segment[x];

digitalWrite(latchpin, LOW);
shiftOut(datapin, clockpin, MSBFIRST, data); //Shows the Number 7 on display
digitalWrite(latchpin, HIGH);
delay(1000);

}
}
Hope Elvis hasn't left the building YET....:D

Allen

p/s hex file for proteus is included..

Thank you so much sir that's very nice of you !
Sir if you may answer some questions for me which are very confusing for me
1- Why people on internet tutorials are using common anode Segments mostly?
2-Even if i use common anode can 74HC595 provice ground voltages for it to work ? if then how ?
3-can a 74HC595 provide enough current to light a complete common cathode seven segment ?
 

Austin Clark

Joined Dec 28, 2011
412
Thank you so much sir that's very nice of you !
Sir if you may answer some questions for me which are very confusing for me
1- Why people on internet tutorials are using common anode Segments mostly?
2-Even if i use common anode can 74HC595 provice ground voltages for it to work ? if then how ?
3-can a 74HC595 provide enough current to light a complete common cathode seven segment ?
1) My guess is that those are easier to drive using NPN BJT's and 7400 series TTL logic ICs. Personally I've only ever used one application-specific LED matrix driver, and it requires a common cathode configuration.

2) With the display hooked up properly (Common Anode configuration), you will be required to turn ON leds with LOW outputs. Basically, 0/LOW output means "LED ON". It's just a matter of making the change in software.

3) For individual segments, yes, but keep in mind the total current consumption of the entire chip. That shouldn't exceed about 70mA. I'd limit individual segment currents to 5-10mA, which should be plenty bright.
 

shteii01

Joined Feb 19, 2010
4,644
1- Why people on internet tutorials are using common anode Segments mostly?
Because most chips are not designed to provide current to led. When you have 7 segment, you have 7 led, each led will need something like 10-15 mA, 7*15 mA=105 mA. So the chip has to provide around 70-100 mA just for led, that does not count all the other connections that the chip might have.

It is far safer to let chip receive current (sink). Your led are light up and you are not stressing the chip.
 
Top