Joel Rainville
New Member
I am working on my first somewhat "elaborate" PIC project, a 7 segment display library on a PIC16F877A.
The display I am using is a 99¢ 9 digits 7 segments LED display (with small clear bubbles over the LEDs wich presumably act as lenses to magnify the tiny LEDs?)
The digits share a common anode, so that I need to select them one-by-one by connecting their cathode to ground, and applying a small +5V current to each segment needed to display digits.
9 digits, so that makes 9 pins for selecting digits, and 8 pins for the 7 segments and the dot. 17 pins total. Still following?
In order to avoid using 17 pins on the PIC, I use a 16 pin 4028 BCD decoder, so that I can choose digits using only 4 pins on the PIC. The BCD takes the decimal value from the 4 pins and outputs the binary value on 10 different pins. Got it?
I need to sink current (remember, to select a digit, I need to connect its cathode to ground), and while the PIC can do that, the 4028 cannot, so I take the 4028's output and feed it to 9 different 2SC2458 transistors, which in turn let current flow through ground when they get the signal from the 4028.
The segments on the other hand simply get their current from the PIC's PORTD pins (all 8 of them, 1 for each segment).
My code does the following :
1- turn all segments off
2- select active digit
3- turn segments on
4- loop for all digits
Now, my problem is : something in the circuit is not acting fast enough. If I let my code run at full speed, I get all 8s (with dots) on the display. I have to insert a sgnificant delay between steps 3 and 4 to get a proper display.
I think the 4028 is at fault here.
The PIC's oscillator is 8MHz, so it's running at 2MHz in "instruction cycles".
The 2SC2458 can switch at a rate of 80MHz.
The 4028, at 5V, 25 degrees Celsius has a "Max Propagation Delay Time" of 480ns and "Max Transition Time" of 350ns, which if I read this correctly translates to a total switching rate (off-on-off) of 1.2MHz.
So my theory is that the 4028, when the PIC's pin goes low, is still feeding the transistor for a few ns, which translates into 2 digits being lit at the same time for a few ns.
When I insert a delay time long enough to let the 4028 go low, everything's fine.
What do you think? Am I right or mistaken? Is there something else that could explain my "problem"?
Thanks for bearing with me, that's a seriously long *ss post!
The display I am using is a 99¢ 9 digits 7 segments LED display (with small clear bubbles over the LEDs wich presumably act as lenses to magnify the tiny LEDs?)
The digits share a common anode, so that I need to select them one-by-one by connecting their cathode to ground, and applying a small +5V current to each segment needed to display digits.
9 digits, so that makes 9 pins for selecting digits, and 8 pins for the 7 segments and the dot. 17 pins total. Still following?
In order to avoid using 17 pins on the PIC, I use a 16 pin 4028 BCD decoder, so that I can choose digits using only 4 pins on the PIC. The BCD takes the decimal value from the 4 pins and outputs the binary value on 10 different pins. Got it?
I need to sink current (remember, to select a digit, I need to connect its cathode to ground), and while the PIC can do that, the 4028 cannot, so I take the 4028's output and feed it to 9 different 2SC2458 transistors, which in turn let current flow through ground when they get the signal from the 4028.
The segments on the other hand simply get their current from the PIC's PORTD pins (all 8 of them, 1 for each segment).
My code does the following :
1- turn all segments off
2- select active digit
3- turn segments on
4- loop for all digits
Now, my problem is : something in the circuit is not acting fast enough. If I let my code run at full speed, I get all 8s (with dots) on the display. I have to insert a sgnificant delay between steps 3 and 4 to get a proper display.
I think the 4028 is at fault here.
The PIC's oscillator is 8MHz, so it's running at 2MHz in "instruction cycles".
The 2SC2458 can switch at a rate of 80MHz.
The 4028, at 5V, 25 degrees Celsius has a "Max Propagation Delay Time" of 480ns and "Max Transition Time" of 350ns, which if I read this correctly translates to a total switching rate (off-on-off) of 1.2MHz.
So my theory is that the 4028, when the PIC's pin goes low, is still feeding the transistor for a few ns, which translates into 2 digits being lit at the same time for a few ns.
When I insert a delay time long enough to let the 4028 go low, everything's fine.
What do you think? Am I right or mistaken? Is there something else that could explain my "problem"?
Thanks for bearing with me, that's a seriously long *ss post!