Friday, July 6, 2012

an AVR Atmega 7-segment commond anode / cathode display library

Updated to version 0x03

A seven-segment display (SSD), or seven-segment indicator, is a form of electronic display device for displaying decimal numerals that is an alternative to the more complex dot matrix displays.

This is a simple seven segment library that let you display char / numbers, or any sequance you need to multiple display.
It runs both on common anode, and common cathode display.
I've used a lookup table to convert ascii table. Also a function to display any sequence you want is available.

Below you can find sample schematics to run multiple diasplay.
The full transistor version let you run disaply at your desired voltage.

7 segment common cathode schematics example

7 segment common anode schematics example

7 segment common cathode with full transistor schematics example

7 segment common anode with full transistor schematics example


  • read risk disclaimer
  • excuse my bad english


  1. Replies
    1. Happy to ear that this project helps someone :)

    2. Dear Davide,

      Can we use for displaying float values on 7-segment.

    3. yes, you just have to use the dot of the 7-segment.

    4. This comment has been removed by the author.

  2. Hi Davide,

    I would like to use your library in a project of mine, where need show 3-digi-long numbers.

    However, I encountered some difficulties understanding even how to simply put a character on a particular display. I extended SEVSEG_PINDISPA array with SEVSEG_PINDISP3 assigned to according pin, but I can't seem to get consistent behavior anyway.
    sevseg_putc(char character, char dot) - this is clear, but how I select the display?
    Also, I assume, to be able to show characters on multiple displays, it has to run in cycle?

    Would you care to explain a bit deeper, how the library is intended to use?

    Best regards,

    1. Hello,
      at first, i suggest to use code, as is, then, when it works, to extend the number of display involved, i.e. to extend the array.
      sevseg_putc just put a character on the selected display.
      sevseg_selnextdisplay switch to next display.
      To display character on multiple display you need to loop, it is correct.
      Take a look at the sample in the main.c file.
      If you do not want to loop, due to resource usage, you can use the MAX7219 IC. Here you can find my implementation on that IC: