A Free Template From Joomlashack

A Free Template From Joomlashack

Sign in with a social network::

Powered by OneAll Social Login

Who is online

We have 19 guests online

Chat with us

7-segment LED display PDF Print E-mail
Written by Vladimir Mitrović   

Figure 1 shows a schematic diagram of the 4-character 7-segment display module. The drive method is a multiplexed one: connecting pins of all segments of the same name (on each of the four digits) are connected together, to minimize the number of connecting wires as well as the number of microcontroller I/O pins needed. In such a design, the digits are activated sequentially, in quick succession. This process is known as multiplexing.

The 7-segment display module from Figure 1 can be connected to any two I/O ports on MPIN development systems. Which ports are used depends on the microcontroller

being used, as well as what other peripherals (switches, 1-wire components etc.) are already connected to the available I/O pins. Henceforth, we will assume that the display’s CON1 connector is connected to PORTB on the MPIN board, while CON2 is connected to PORTD on the MPIN board. Only four lines are needed on the latter port. Note that you can use other I/O ports equally well. You can even connect two or three 7-segment display modules to one MPIN, as long as you have enough free ports.

A serious drawback of a multiplexed display is that it can keep the microcontroller pretty busy while the display is active. In order to avoid flickering, the whole message should be repeated at least 20 times per second, preferably even more often. To ensure a stable and flicker-free display, we chose a refresh rate of 50 times per second, which requires the microcontroller’s attention every 5 ms. (50 Hz = 20 ms period, divided by 4 digits = 5 ms) Every 5 milliseconds the microcontroller must:

  • switch-off the currently active digit position,
  • activate the appropriate segments corresponding to the pattern needed for the digit in the next position and
  • switch-on the following digit.


The above process takes no more than 20-40 µs. But if the program performs the above actions in a loop, and waits 5 ms before each loop iteration, the program will not be able to do anything else while the message is being displayed. This is not practical, so we will choose a different approach. For this approach, we will use a timer, configured to activate an interrupt every 5 milliseconds. When the interrupt occurs, an interrupt service routine is executed, that prepares the data needed for the following display position. As soon as the next digit is successfully switched on, the program control returns to the main program. During the time between interrupts, the microcontroller can do any other task.

7-segment LED display


Continue reading

Shop area

Last Updated on Wednesday, 01 August 2012 14:38
Joomla Templates: by JoomlaShack