7 sigment led multiplexed display problem

Discussion in 'Embedded Systems and Microcontrollers' started by embedtechnology, Mar 26, 2016.

  1. embedtechnology

    Thread Starter New Member

    Dec 25, 2015
    25
    1
    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.
     
  2. shteii01

    AAC Fanatic!

    Feb 19, 2010
    3,394
    497
    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?
     
  3. ScottWang

    Moderator

    Aug 23, 2012
    4,855
    767
    Please attach your schematic and c or asm code .
     
  4. JohnInTX

    Moderator

    Jun 26, 2012
    2,347
    1,029
    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.
     
  5. embedtechnology

    Thread Starter New Member

    Dec 25, 2015
    25
    1
    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.

    Code (C):
    1. sbit count0 at p2_0_bit; // these are the digit selects
    2. sbit count1 at p2_1_bit;
    3. sbit count2 at p2_2_bit;
    4. sbit count3 at p2_3_bit;
    5. sbit count4 at p2_4_bit;
    6. sbit count5 at p2_5_bit;
    7. code unsigned short arry_digit[10]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F};
    8. void short_delay()
    9.   {
    10.    delay_ms(1);
    11.   }
    12. void display()
    13.       {
    14.         unsigned short i;
    15.  
    16.         i=(second & 0x0F);
    17.         p0=arry_digit[I];
    18.         count0=1;
    19.         short_delay();
    20.         p0=0;
    21.         count0=0;
    22.  
    23.         i=(second&0x70)>>4;
    24.         p0=arry_digit[I];
    25.         count1=1;
    26.         short_delay();
    27.         p0=0;
    28.         count1=0;
    29.  
    30.         i=(minute & 0x0F);
    31.         p0=arry_digit[I];
    32.         count2=1;
    33.         short_delay();
    34.         p0=0;
    35.         count2=0;
    36.  
    37.         i=(minute&0x70)>>4;
    38.         p0=arry_digit[I];
    39.         count3=1;
    40.         short_delay();
    41.         p0=0;
    42.         count3=0;
    43.  
    44.         i=(hour & 0x0F);
    45.         p0=arry_digit[I];
    46.         count4=1;
    47.         short_delay();
    48.         p0=0;
    49.         count4=0;
    50.  
    51.         i=(hour & 0x30)>>4;
    52.         if(i==1)
    53.       {
    54.         p0=arry_digit[I];
    55.         count5=1;
    56.         short_delay();
    57.         p0=0;
    58.         count5=0;
    59.        }
    60.  
    Mod edit: code tags w/some formatting. Converted Eagle schematic to PDF w/cleanup
     
    Last edited by a moderator: Mar 27, 2016
  6. JohnInTX

    Moderator

    Jun 26, 2012
    2,347
    1,029
    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.
     
  7. embedtechnology

    Thread Starter New Member

    Dec 25, 2015
    25
    1
    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.
     
  8. ScottWang

    Moderator

    Aug 23, 2012
    4,855
    767
    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:
    [​IMG]
     
  9. JohnInTX

    Moderator

    Jun 26, 2012
    2,347
    1,029
    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.
     
  10. embedtechnology

    Thread Starter New Member

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

    Moderator

    Aug 23, 2012
    4,855
    767
    What you trying to simulate with vb6, it looks like the numbers are messed up, if you could please upload the vb6 source code.
     
  12. embedtechnology

    Thread Starter New Member

    Dec 25, 2015
    25
    1
    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.
     
  13. ScottWang

    Moderator

    Aug 23, 2012
    4,855
    767
    Nice try and done.
    Could you upload the vb6 source code, I want to know how you simulate the circuit, thanks.
     
  14. embedtechnology

    Thread Starter New Member

    Dec 25, 2015
    25
    1
    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.

    Private Sub Form_Load()
    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 likes this.
  15. ScottWang

    Moderator

    Aug 23, 2012
    4,855
    767
    Thanks.
    VB program doesn't like others, so I can't rebuild the program, but it doesn't matter.
     
  16. roger finder

    New Member

    Nov 3, 2015
    5
    0
  17. ScottWang

    Moderator

    Aug 23, 2012
    4,855
    767
Loading...