Menu

4 seven-segment displays, how to implement?

Pete Ross
2021-03-14
2021-03-18
  • Pete Ross

    Pete Ross - 2021-03-14

    Hello all.

    I intend to build a voltmeter that displays using four seven-segment displays.
    I need this to fit in a small space so I want to use a small PIC say 16f84 and because of the pin requirements (Considering ADC and other areas) I may not be able to have enough pins from the microcontroller.

    I checked out options and I saw that I could either multiplex, use a shift register like the IC 595 (not chip full name) or use a complete solution like the Max 7219 display driver. My best best would be using the Max chip.

    My question is this.
    Does GCB support these options?
    I checked and saw that the Max chip is used in GCB but only for matrix LED solutions.

     
  • Geoffrey Younger

    Hi Peter, If you open up the gcb IDE, there is an icon called 'view demos' (just to the right of the cow with a ? ' if you press this icon it will show a sub-window with 7segment solutions and many more ! There might be something there that will help you.
    cheers.

     
    • Pete Ross

      Pete Ross - 2021-03-18

      Thank you Geoffrey. I already went through that but the demos I saw using the MAX7219 were for LED solutions. For the seven segment, it used them directly thus requiring many pins

       
  • mmotte

    mmotte - 2021-03-15

    I have just been working on a driver for the Max7219 for 7 segment disps. This isn't quite all cleaned up but the files are attached. This was an eight digit display module from china. It does bytes, words, int, longs and strings with the 'print'. It also has a built in segment decoder but those routines are not quite working.You don't need them unless you would want the code to be small.

    Another module you could consider is the TM1637 which is also on the china market as a 4 digit diplay and the driver is in the includes already.

    Another board that includes pushbuttons and 7seg leds is the TM1638. I threw that into the contributors form a while back.

    Each of these communicate with spi (data,clk,cs) but each uses a different layout and protocol.

    GL
    Mike

     
    • Pete Ross

      Pete Ross - 2021-03-18

      Thanks Mmotte. Sorry for responding to this late also.
      I went through demos (Is that what you meant by includes?) but I did not see anything about the TM1637. Using these header and demo files for the Max you sent, I ran a Proteus simulation but there was no output to be seen. Could you take a look for me?

       
      • mmotte

        mmotte - 2021-03-18

        Pete,
        The "include"s is the library directory under the greatcowbasic directory . In the 'include' directory you will find TM1637. h file . Near the top of that file , you will find"public Commands" which are how to uses it.
        also in your program you will need "#include <tm1637.h>" to attach the library.</tm1637.h>

        I don't see a demo in the demo directory but could send you one when i am at the my other PC.

        I don't have proteus ??

         
      • mmotte

        mmotte - 2021-03-18

        Here is a simple demo of TM1637.

        #chip 16F1705,8
        
        '#include <DS18B20.h>
        #include <TM1637.h>
        #define TM1637_CLK portC.5             'CLK pin TM1637
        #define TM1637_DIO portC.4            'DIO pin TM1637
        '#define DQ PortC.3              'Data pin DS18B20
        
        ; ----- Variables
          'TempC_100 required to support temp sensor
          Dim TempC_100,TempF_100, DSdata as word
          Dim Whole , Fract as word
          Dim CCOUNT, SIGNBIT, WHOLE, FRACT, DIG as Byte
        
         #startup InitPPS, 85
        DIM xx,Thou,Hund,Tens,Ones as word
        dir PortC.3 out
        PortC.3 =1
        Write4Dig (17, 16, 17, 16, 0) 'clear display
        wait 3 s
        
        WriteChar (0 , "g")
        WriteChar (1 , "c")
        WriteChar (2 , "b")
        WriteChar (3 , " ")
        wait 3 s
        
        TMhex(255)
        wait 3 s
        
        TMdec(8095)
        wait 3 s
        
        Write4Dig(16,7,0,7,8,1)  ' clock disp , no leading zero, minimum brightness, Colon On
        wait 3 s
        
        main:
        
        Dim Message As String
            Message = " ABCDEFGHIJKLMNOPQRSTUVWXYZ  "
            Do
            For Counter = 1 to len(Message)-2
              WriteChar (0 , Message(Counter))
              WriteChar (1 , Message(Counter+1))
              WriteChar (2 , Message(Counter+2))
              WriteChar (3 , Message(Counter+3))
              wait 1 s
            Next
            Loop
        
        wait 2 s
        
        'next xx
        
        goto main
        
        Sub InitPPS
                UNLOCKPPS
        
                    'Module: EUSART
                    RXPPS = 0x0011    'RC1 > RX
                    RC0PPS = 0x0014    'TX > RC0
        
                LOCKPPS
            End Sub
        

        And here is another attached

         
  • mkstevo

    mkstevo - 2021-03-15

    If you want an example using the 74HC595, I could let you have some. Needless to say, my preferred option is the '595!

    The '595 can be driven with a 12F1840 (or 12F675) minimising the pin count of the processor. The '595 chips can be mounted behind (or even underneath) each of the seven segment displays.

     
  • William Roth

    William Roth - 2021-03-16

    I think a 16F84 might be be a rather poor choice given today's more modern options.

    CHIP: 16F84A (16F84 is "deprecated" and no longer Active)
    1.75KB Program memory
    68 Bytes RAM
    64 Bytes EEPROM
    No Internal OSC (needs crystal)
    No CCP/PWM
    1 Timer
    No ADC
    No SPI/I2C
    No USART
    Cost ~$4 US

    Maybe Consider a PIC 16F1847

    CHIP: 16F1847
    18 Pins
    14Kb Program Memory
    1024 Bytes RAM
    256 Bytes EEPROM
    Internal OSC up to 32Mhz
    (4) 8-Bit Timers
    (1) 16-Bit Timer
    12 ADC Channels
    (4) CCP/PWM Modules
    1 USART
    1 SPI/I2C Module
    Cost ~ $1.81 US

    The 16F1847 is much more flexible and is just a better chip all around and costs 1/2 as much as a 16F84A

     

    Last edit: William Roth 2021-03-16

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.