6 Digits LED 7-Segment Multiplexing using PIC16F627A




In the post ‘LED 7-Segment Multiplexing‘, I have explained about the concept and benefits of multiplexing. Multiplexing implementation is very similar to driving Led Dot Matrix. I use Timer0 interrupt for switching through each digit. Timer0 or TMR0 is an 8-bit timer which overflows every 256 (0xFF) counts.

6 Digits LED 7-Segment Multiplexing

It’s known that the refresh rate above 50Hz would be enough for human’s eyes to see the display without recognizing the flickering. If I set TMR0 with 1:8 Prescaler, the multiplexing frequency will be

4MHz(internal OSC.)/4(working OSC)/8(prescaler)/256(max counts of TMR0)/6(number of digits) = 81.3 Hz which is good for a display.

Just an example, I have implemented (in Proteus) a 999999-second counter by using 6 Digits LED 7-Segment Multiplexing technique. There are 2 main components in the project, PIC16F627A or PIC16F628 and 6 x LED7-segment display. The schematic shows below. The crystal is 32.768KHz as usual. There is a 10KOhm pull up resistor at RA4 pin as this pin is an open-drain pin as I described in “Open-Drain RA4 pin on PIC Microcontroller“.

The source code in MikroC is listed below: (.hex is also available, please feel free to contact me)

6 Digits LED 7-Segment Multiplexing schematic

//PIC16F627A
//4MHz Internal OSC
//MUX by the MUC itself with Interrupt
//TMR0 .. check the prescelar+delay in scan routine as they are related
[email protected]
unsigned short number [10] = {
0x5F0x060x9b0x8f0xC60xCd, 0xDD0x07,
0xDf, 0xCf
};
unsigned short digit [6];
unsigned short counter;
unsigned short shift_register;
unsigned short x1;
unsigned short x2;
unsigned short x3;
unsigned short x4;
unsigned short x5;
unsigned short x6;
unsigned short tick;
void interrupt ()

For more detail: 6 Digits LED 7-Segment Multiplexing using PIC16F627A




Current Project / Post can also be found using:

  • 4*7 segment digits multiplexing
  • Initialisation of seven segment display using RTOS microC OS
  • layout seven segment
  • 4 digit seven segment display pic 16f series projects

Comments (1)

  • naseer najibi

    Dear Sir,

    Thanks for providing detailed information about the counter.

    I have made a pcb and used your software for a project ,

    but the problem was that the segments did not have enough time to be on an give a bright display

    so i worked on software and modified it as following:

    1. I used a 1 msec interrupt timer.

    2.A pic16f887 with internal 8 mHz is used.

    3.modified the circuit so that it can be used for various counting needs.

    4.have added one more digit so that now it is 7 digits.

    and after all the display is very bright and very visible with a very low visible flicker.

    If any body needs the modified software and circuit diagram plus pcb

    Please feel free to contact me I will provide it free of cost.

    Reply

Leave a Comment

*
= 5 + 5

Read previous post:
Digital Clock using PIC16F887
Making your own Digital Clock using PIC16F887

Small LED dot matrix development board I was very busy for the past two months so this blog just didn't...

Close
Scroll to top