7 segment display


Closed Thread
Results 1 to 7 of 7
  1. #1
    Join Date
    Sep 2006
    Posts
    747

    Default 7 segment display

    Hello,

    I have a 4x 7 segment display, with each segments displaying what I need.
    BUT.... yes.. but. When I have a 1 second pause between the display of each unit , I have full brightness of the led module (LDS-AD16RI) but I of course I can see the number going off and on, Reducing the pause time does eliminate a lot of that roughness, but I can hardly see the numbers, they hardly light at all.
    Anybody had this issue ?
    Here is the code, I could also post a video if needed.
    Code:
    Mainloop
    
                I2CRead SDApin,SCLpin,$D0,$00,[RTCSec,RTCMin,RTCHour,RTCWDay,RTCDay,RTCMonth,RTCYear,RTCCtrl]  
                Pause 20
                
            TempVal=RTCSec                    'Seconds  , with temp1 on the left and temp 2 on the right
            gosub bcd_to_bin                    
            
            temp1_sec = temp1  
            n = temp1_sec
            PortA.0 =1
            gosub display 
            PortA.0 =0
            
            temp2_sec = temp2  
            n = temp2_sec
            PortA.1 =1
            gosub display 
            'PortA.1 =0
            
            PortA.2 =0
            PortA.4 =0
            PortC.0 =0
            PortC.1 =0
    
        goto Mainloop
        end
    
        bcd_to_bin:
         temp2 = $0F & TempVal                     ' Clear off the top four bits
         temp1= TempVal >> 4                       ' Shift down four to read 2 BCD value
    
        return
    
        display:
                Lookup n, [$3F, $06, $5B, $4F, $66, $6D, $7D, $07, $7F, $67], Segments
                PORTB = Segments
                pauseus 10
        return

  2. #2
    Join Date
    May 2013
    Location
    australia
    Posts
    2,383


    Did you find this post helpful? Yes | No

    Default Re: 7 segment display

    basically your perceived led brightness is proportional to display pause / (loop time+ display pause*2) (for 2 digits)

    you have not set a OSC define so I'm assuming 4mhz clock and that your loop time is some mS lets say 5 so each digit led is on for 10uS and off for 4990 uS . its going to be dull.

    if you make the delay pause too big the led will blink , it a compromise between brightness and blinking
    try 500uS , its a trial and error thing I think and may take a few tries

  3. #3
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,588


    Did you find this post helpful? Yes | No

    Default Re: 7 segment display

    Richard is right, and there's also the resistor. Let's assume the common 330ohm resistor, that works fine for constant ON. But when you start blinking leds, you can get away with weaker resistors.

    I was using 100ohm resistors when blinking 56 leds in charlieplex.

    Robert

  4. #4
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default Re: 7 segment display

    I think both of you where right. I did play with the pause last night without much success, I replace the resistors with 50 ohms one, now it works better (still not perfect) but at pauseus 50, I still get flickering and a lot of ghosting, many segments of the display that should be off, fades on and off which do not occur at slower speed ( pause 10 lets say).
    I raise the voltage to get light emission, but that problem seems worst !
    any ideas how to eliminate this?

  5. #5
    Join Date
    May 2013
    Location
    australia
    Posts
    2,383


    Did you find this post helpful? Yes | No

    Default Re: 7 segment display

    your mainloop is unnecessarily long

    firstly
    I2CRead SDApin,SCLpin,$D0,$00,[RTCSec,RTCMin,RTCHour,RTCWDay,RTCDay,RTCMonth,RTCYear,RT CCtrl]
    why read these when they are never used


    second
    Pause 20 why ????

    third
    all these never change why are they in the loop
    PortA.2 =0
    PortA.4 =0
    PortC.0 =0
    PortC.1 =0

    and finally
    you are reading the time hundreds of times a second when it can only change once a second


    why not
    count var word

    count=1000

    mainloop:
    if count = 1000 then
    I2CRead SDApin,SCLpin,$D0,$00,[RTCSec]
    count =0
    gosub bcd_to_bin
    endif

    count=count+1

    temp1_sec = temp1
    n = temp1_sec
    PortA.0 =1
    gosub display
    PortA.0 =0

    temp2_sec = temp2
    n = temp2_sec
    PortA.1 =1
    gosub display

    goto Mainloop
    end

  6. #6
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default Re: 7 segment display

    Thank you for the help,
    the pause after the I2Cread was screwing me up badly.
    I get clear segments now.
    I now have a different issue !!
    Some of the segments not being used oare still being lit lighty !! I found that the dimm display on one display module was a pale mirror image of the display module next to it. I posted a picture to help understand what i'm talking about.
    Basically i have a 1 and 6 I can see (barely) on the 1 module all the segments of the 6 in the 1 module. I guess thats what is called ghosting..

    UPDATE: solved the problem by adding : PORTB = $00
    Lookup n, [$3F, $06, $5B, $4F, $66, $6D, $7D, $07, $7F, $67], Segments
    PORTB = $00
    PORTB = Segments
    pause 1
    PORTB = $00

    thanks for the really, very much appreciated
    Attached Images Attached Images  
    Last edited by lerameur; - 13th January 2015 at 00:24.

  7. #7
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    575


    Did you find this post helpful? Yes | No

    Default Re: 7 segment display

    Nice job !
    Please, can you post full code ? Maybe I try to build this clock.
    Thanks !

Similar Threads

  1. 1 Pin 7-Segment Display
    By Mike, K8LH in forum Schematics
    Replies: 0
    Last Post: - 23rd November 2009, 13:35
  2. 7-segment display with P16F84
    By spitfire in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 3rd March 2009, 20:22
  3. 7-segment display driver
    By Klaus in forum General
    Replies: 3
    Last Post: - 15th April 2008, 14:37
  4. 7 segment display with hex
    By g@l@s in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 12th January 2007, 16:28
  5. Multiplex two 7 segment display
    By Fernando Santos in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 20th July 2003, 14:26

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts