Menu

LED 7-segment display clarification

Help
H2TECH
2011-07-22
2013-05-30
  • H2TECH

    H2TECH - 2011-07-22

    As of today, I finally got a hold of a few 7-segment displays for use in future projects. Instinctively, all the data sheets I could to learn how to hook one up to a pic and then checked GCBasic on how to incorporate the display features. I successfully got a single display to count from 0-9, which is a step, but how would you count from 0-9999 on a 4 digit display? (This of course may evolve into displaying a random, large value of a frequency or perhaps another calculated number from a ADC.) Is there some method to treat 4 displays as simply 1 number or just as 4 separate digits?

     
  • mmotte

    mmotte - 2011-07-23

    You have to do a lot of the leg work.  both break your number into decades and scan each digit often to make the display light up and look good. 

    It works  but with different number of segments lit up at different times, some look bright and some are dimmer. here is  a code snippet  of breaking up min and secs   and waiting on each digit to light it up

     'min disp
        tens=mins/10
        DisplayValue 4,tens
        ones=mins-tens*10
        Wait 8 ms
        DisplayValue 3,ones
        Wait 8 ms
        'sec disp
        tens=secs/10
        DisplayValue 2,tens
        Wait 8 ms
        ones=secs-tens*10
        DisplayValue 1,ones
    

    The help is not real clear on using multiple digits. There is some good stuff in the forum on inverting stuff so you can use either CA or CC displays

    Here is another snippet on selecting the digit.  Port B is driving the segments   PortA is selecting the digits

    #define DisplayPortA PORTB 
    #define DisplayPortB PORTB 
    #define DisplayPortC PORTB 
    #define DisplayPortD PORTB 
    #define DispSelectA Set PORTA.0 off: Set PORTA.1 on: Set PORTA.2 on: Set PORTA.3 on
    #define DispSelectB Set PORTA.0 on: Set PORTA.1 off: Set PORTA.2 on: Set PORTA.3 on
    #define DispSelectC Set PORTA.0 on: Set PORTA.1 on: Set PORTA.2 off: Set PORTA.3 on
    #define DispSelectD Set PORTA.0 on: Set PORTA.1 on: Set PORTA.2 on: Set PORTA.3 off
    

    My favorite display driver is a separate chip  MC14489B, even brightness, up to 5 digits, two PIC I/O :data and clock

    GL
    Mike

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.