7 Segment 3 Digit Display Problem

stahta01

Joined Jun 9, 2011
133
What is the purpose of the switch connected to /MCLR?
Edit: All my prior posts, I was guessing a reset switch.

Tim S.
 
Last edited:

stahta01

Joined Jun 9, 2011
133
Question, do you have AC input going into a 5V regulator without have an rectifier in the circuit?
(I ask this because that is how I read it in your schematic diagram.)

If yes, shutdown your hardware till you get a DC power source!!

Tim S.
 
Last edited:

SgtWookie

Joined Jul 17, 2007
22,230
The 2N3904 transistors are rated for up to 200mA current, but that's absolute maximum. A more practical limit is 100mA.

With 7 segments then, you have 100mA/7 = 14mA available per segment (rounded off).
So, calculate your segment current limiting resistors for 14mA current.

To saturate the 2N3904 transistors with 100mA collector current, you'll need 10mA base current.
Rbase = (Vcc - Vce) / 10mA
Use 0.8v for Vce.
Rbase must be at least 220 Ohms, or you risk exceeding the I/O current limits.
Make certain that you don't exceed the total IC I/O current limit.
 

SgtWookie

Joined Jul 17, 2007
22,230
I don't know how you came up with your base resistor or segment resistor values, but they're way off.

Rbase = (Vcc-0.8)/10mA = 4.2/0.01 = 420 Ohms.
A table of standard decade resistance values is here:
http://www.logwell.com/tech/components/resistor_values.html (bookmark this page!)
Looking at the E24 columns, 430 Ohms is close enough; 430/420*100 = 102.4%; within 3%.

For your 7 segment display resistors, use:
Rlimit >= (Vcc-Vf_LED) / DesiredCurrent
You want 14mA current or less.
Vcc=5v.
Typical Vf is 2.1v @ 20mA; max continuous current is 15mA.
So:
Rlimit >= (5v-2.1v) / 14mA = 2.9/0.014 = 207 Ohms.
Referring back to the E24 columns from the link above, 220 Ohms is the closest value >= 207 Ohms.
2.9v / 220 Ohms = 13.18mA, which is fine.


On to your source code...

You're not getting the idea of multiplexing.

For incrementing the time, you're going to have to use the timer interrupt and an interrupt service routine. You don't have a whole second to waste with the pause(1000) function; as you have to keep updating the display constantly in the main routine.

In the main routine, you'll need to start with all displays turned off by setting port A to zero.

Get a digit, convert it to display bits, move that to port B, then turn the individual display on via port A, and wait for a short period of time.
Then turn the display off, get the next digit, convert it to display bits, move that to port B, and turn that display on via port A, and wait for a short period of time.
Repeat ad nauseum.

Meanwhile, if you have your interrupt set up properly, you'll increment the 1's digit; if it overflowed to zero then increment the 10's digit, if that overflowed then increment the 100's digit. Then return from the interrupt service.
 

Thread Starter

beeson76

Joined Apr 19, 2010
211
Thanks for the replies guys. I appreciate it very much.

I have messed around with it the last of days and still nothing. I would just like to know if it is wired correctly.

To answer the question asked by stahta01--I have a AC adapter that the output is 7.5 VDC at 300ma. Without anything plugged in, the voltage is around 12 volts. I just use it because it is the only thing I have access to right now. I hope this works.

Thanks SgtWookie for this input too. I have changed the resistors to the values listed, but I would like to figure out how you got those values, so I am doing some calculations too to help me learn. I appreciate the input and the help and the formulas too.

Sometimes...well actually most of the time I get overwhelmed by all the information provided so it usually takes time to get stuff sorted out. I really know nothing about electronics and its more of a hobby. I really enjoy the learning aspect of it. So I may seem completely clueless for a while until something clicks.

But again I certainly do appreciate all the help provided and if you have other suggestions, I would love to hear them. I love this forum!!:)
 
Top