# 7 sigment led multiplexed display problem

#### embedtechnology

Joined Dec 25, 2015
36
Hi
I have designed a digital led clock using 89s52 mic. and pcf 8583p rtc chip. I use a total of 6 digit for HH:MM :SS format. I use here normal multiplexed display technic in which only one digit is active at any instence. It is common cathode type display. and each sigment is made up with 12 leds(4x3led serese) . a uln 2003 driver is used as cathode driver and 7 anodes are being driven by 7 pnp transistors..The clock is running ok, brightness also ok.but some sigments are slightly lit
unexpectedly according to active sideby digit. I use some software as well as hardware tricks to solve it but all in vain.Please
help me.

#### shteii01

Joined Feb 19, 2010
4,644
Are the same segments light up unexpectedly?
Or do the random segments light up unexpectedly?

Have you tried placing a shield between the segments? A thin piece of metal or even some metal foil on a piece of cardboard? Just don't short anything.

Do you have current limiting resistors for each segment?

#### ScottWang

Joined Aug 23, 2012
6,982

#### JohnInTX

Joined Jun 26, 2012
4,360
Code and schematic would be helpful but it sounds like you are not turning off the digit drivers when changing the segment pattern from one digit to the next. It's called 'ghosting' and is a common error when writing mux'd displays. When going to the next digit, turn off the current digit driver, change the segment pattern then turn on the driver for the next digit.

If that doesn't work, post the schematic and code.
Good luck.

#### embedtechnology

Joined Dec 25, 2015
36
Hi
I have include my code here and also the sch diagram. I also made an animation in vb6 to
give u clear information about the problem but it cannot be uploaded I dont know why !!!
I am trying it.

C:
sbit count0 at p2_0_bit; // these are the digit selects
sbit count1 at p2_1_bit;
sbit count2 at p2_2_bit;
sbit count3 at p2_3_bit;
sbit count4 at p2_4_bit;
sbit count5 at p2_5_bit;
code unsigned short arry_digit[10]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F};
void short_delay()
{
delay_ms(1);
}
void display()
{
unsigned short i;

i=(second & 0x0F);
p0=arry_digit[I];
count0=1;
short_delay();
p0=0;
count0=0;

i=(second&0x70)>>4;
p0=arry_digit[I];
count1=1;
short_delay();
p0=0;
count1=0;

i=(minute & 0x0F);
p0=arry_digit[I];
count2=1;
short_delay();
p0=0;
count2=0;

i=(minute&0x70)>>4;
p0=arry_digit[I];
count3=1;
short_delay();
p0=0;
count3=0;

i=(hour & 0x0F);
p0=arry_digit[I];
count4=1;
short_delay();
p0=0;
count4=0;

i=(hour & 0x30)>>4;
if(i==1)
{
p0=arry_digit[I];
count5=1;
short_delay();
p0=0;
count5=0;
}
Mod edit: code tags w/some formatting. Converted Eagle schematic to PDF w/cleanup

#### Attachments

• 1.2 KB Views: 3
• 62.9 KB Views: 7
• 29.4 KB Views: 15
• 30.3 KB Views: 8
Last edited by a moderator:

#### JohnInTX

Joined Jun 26, 2012
4,360
The digit drivers in the code does not match the schematic - at least when looking at the real pinout of the uC. You overrode the pinout with manual text in Eagle. Don't do that.

Other observations:
You don't have to turn the segments off (e.g. p0=0), just turn the digit off before you change the pattern.
Try a longer delay 5-20ms.
Go to MicroC's option page and turn case-sensitivity ON then fix the array index. You should not use 'i' and 'I' interchangeably in C if you want to have any hope of existing in the rest of the C world.
Be sure that your hardware can turn the segments on and off. Pull the uC and use jumper wires to select one segment and one digit. Make sure it turns on and off cleanly. Then move to the next digit. Resolve any hardware problems there.

Good luck.

#### embedtechnology

Joined Dec 25, 2015
36
Thank you.I do not mix upper case and lower case in my real code indexing.I used only digit driver to on and
off before but after applying code p0=0, the problem became a bit of weaker than before. So I included it.
If i change the delay from 1 ms to 2 ms, display flicker occurs when 10th. digit of hour is active(10 h to 12:59 h).
when the clock is running normally, suppose it is the time 12:11:01 Now after one second when time will be
12:11:02, g segment of 10th. digit of second's field lit up unexpectedly with very little brightness because of g segment of it's right hand side digit which became active. This happens in case of every segment of every side by digit and it is my headache.I want power hungry non multiplexed display like pure vision.

#### ScottWang

Joined Aug 23, 2012
6,982
You can compress the vb6 to as vb6test.zip to upload.
Each digit total scan time as 20~40 mS, the best is 33~40 mS.
Each DB140 needs to in parallel with a Rbe resistor as 3.3K~4.7K to turn of BD140 when BC547 is turn off, otherwise when BC547 is turn off then the base of BD140 will be floating and it will causing the oscillation.

The Rbe resistor will be as below:

#### JohnInTX

Joined Jun 26, 2012
4,360
What @ScottWang said plus:

Make sure pin 8 of the ULN2003 is grounded and pin 9 is connected to Vdd.

If it still ghosts, here's what I would do to ensure that there are no hardware issues:
Pull the uC. Jumper all display pins, segments and digit selects, to 0. Make sure the display is completely dark.
Turn on segment 'g' in in the 10's digit of the seconds by jumpering to Vdd. Put a piece of black tape over that segment only then look so see if any other segments are glowing anywhere. Sometimes there can be internal light leakage in a display that is unrelated to the drivers. If you can cleanly turn on any segment in any digit with the jumpers, the problem lies in the code or as Scott indicated, your drivers.

The reason you are getting flickering when the last digit is on is because the scan time changes according to the number of digits. The best way to do one of these is to use a timer interrupt to scan the display and just poke the digit values into an array that gets accessed by the interrupt-driven multiplexer.

Good luck.

#### embedtechnology

Joined Dec 25, 2015
36
Thanks a lot ScottWang and JohninTX, but I uploaded animated zip. please see that. and suggest me.
good day.

#### Attachments

• 114.6 KB Views: 5

#### ScottWang

Joined Aug 23, 2012
6,982
What you trying to simulate with vb6, it looks like the numbers are messed up, if you could please upload the vb6 source code.

#### embedtechnology

Joined Dec 25, 2015
36
Many thanks to ScottWang. It was Rbe resistor. I inserted it to my hardware and the display is ok now. many thanks
to all again for your valuable support.
Good luck.

#### ScottWang

Joined Aug 23, 2012
6,982
Nice try and done.
Could you upload the vb6 source code, I want to know how you simulate the circuit, thanks.

#### embedtechnology

Joined Dec 25, 2015
36
Hi
Actually I make animation for you to clarify my problem. So after compiling I didn't save it except exe file.
but here is the detailed.
At first I created 4 frames with Inkscape and save them one by one as bmp image. In vb6 I used a timer
which's interval I wrote 1000 in properties window.I took 4 image box into form and imported those
bmp images to them with the help of properties window. Then I overlapped 2,3 and 4 images into image1
and here is the code.

Timer1.Enabled = True
x = 0
End Sub

Private Sub Timer1_Timer()
If image1.Visible = True Then
image1.Visible = False
image2.Visible = True
ElseIf image2.Visible = True Then
image2.Visible = False
image3.Visible = True
ElseIf image3.Visible = True Then
image3.Visible = False
image4.Visible = True
ElseIf image4.Visible = True Then
image4.Visible = False
image1.Visible = True
End If
End Sub

#### ScottWang

Joined Aug 23, 2012
6,982
Thanks.
VB program doesn't like others, so I can't rebuild the program, but it doesn't matter.

#### roger finder

Joined Nov 3, 2015
5

#### ScottWang

Joined Aug 23, 2012
6,982
Did you see all the posts?