Engineers Garage

  • Projects and Tutorials
    • Electronic Projects
      • 8051
      • Arduino
      • ARM
      • AVR
      • PIC
      • Raspberry pi
      • STM32
    • Tutorials
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Products News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • EE Resources
    • DesignFast
    • LEAP Awards
    • Oscilloscope Product Finder
    • White Papers
    • Webinars
  • EE Learning Center
    • Design Guides
      • WiFi & the IOT Design Guide
      • Microcontrollers Design Guide
      • State of the Art Inductors Design Guide
  • Women in Engineering

Seven Segment Multiplexing using PIC18F4550 Microcontroller- (Part 4/25)

By Amit Joshi

As explained earlier, a seven segment interfaced with PIC uses almost an entire port (minimum 7 pins) to display a value. But a real time application, like watch, calculator etc., usually requires at least 3-4 seven segments. In such a case it is not advisable to use a port of the controller for each seven segment. In these cases, multiplexing technique is used to work with more than one seven segment. Here multiplexing of four seven-segments has been explained with PIC18F4550 to display four-digit count from 0000 to 9999.


 

 

The data pins (a-g) of all the seven-segments are connected to a single port (Port D*) as shown in the circuit diagram. Transistors BC547 are connected to COM pins of seven-segment for switching. The switching of COM pins is controlled by four pins of PortA.

 
*Please note that the pins of PortD are not continuous and care has to be taken while making the connection.
 
The multiplexing concept is based on the principle of persistence of human vision. A human eye cannot detect a visual change if the frames change at a rate of 25 (or more) frames per sec. This means that if events occur continuously with a time difference of less than or equal to 0.04 sec (1/25 sec), then we cannot notice the transition between those events.
 
Considering this, the seven-segments are switched on one by one with a very small time delay. Thus, even though only one segment glows at a time, it appears that all the segments are glowing together. (See video) Thus the key factor in multiplexing is switching time of the segments.
 
Programming steps: 
·         The count value to be displayed is stored in a variable.
·         Extract the individual digits from the count value into different variables.
·         Turn on the seven-segments one by one with a small time delay.
·         Send the hexadecimal values corresponding to individual digits to PortD.
 

 

Project Source Code

###

// Program for Seven segment multiplexing using PIC18F4550 Microcontroller

// Configuration bits
/* _CPUDIV_OSC1_PLL2_1L,  // Divide clock by 2
   _FOSC_HS_1H,           // Select High Speed (HS) oscillator
   _WDT_OFF_2H,           // Watchdog Timer off
   MCLRE_ON_3H            // Master Clear on
*/

#define seg_port LATD
#define seg_unit LATA.F0
#define seg_decade LATA.F1
#define seg_hundred LATA.F2
#define seg_thousand LATA.F3
unsigned int i=0,j=0,k=0;

void main(void)
{
	unsigned int value[10]={0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x90};
	unsigned int count,num0,num1,num2,num3,num4;
	TRISA=0;		// Configure PortA as output port
	LATA=0;
	TRISD=0;		// Configure PortD as output port
	LATD=0;

	for(count=0;count<9999;count++)		// Counter from 0 to 9999
	{
		num0=count;

		num1=num0%10;			// Extract the value of unit digit
		num0=num0-num1;
		num0=num0/10;

		num2=num0%10;			// Extract the value of decade digit
		num0=num0-num2;
		num0=num0/10;
                  
		num3=num0%10;			// Extract the value of hundred digit
		num0=num0-num3;
		num0=num0/10;
                  
		num4=num0%10;			// Extract the value of thousand digit
		num0=num0-num4;
		num0=num0/10;
                  
		for(i=0;i<10;i++)		// Delay= ((5msx4)x10) = 200ms between two consecutive counts
		{
			
			seg_unit=1;seg_decade=0;seg_hundred=0;seg_thousand=0;		// Display unit digit
                        seg_port=value[num1];
                        Delay_ms(5);
                        
                        seg_unit=0;seg_decade=1;seg_hundred=0;seg_thousand=0;		// Display decade digit
                        seg_port=value[num2];
                        Delay_ms(5);
                        
                        seg_unit=0;seg_decade=0;seg_hundred=1;seg_thousand=0;		// Display hundred digit
                        seg_port=value[num3];
                        Delay_ms(5);
                        
                        seg_unit=0;seg_decade=0;seg_hundred=0;seg_thousand=1		// Display thousand digit
                        seg_port=value[num4];
                        Delay_ms(5);
		}
	}
}

###

 


Circuit Diagrams

Circuit-Diagram-of-Seven-Segment-Multiplexing-using-PIC18F4550-Microcontroller

Project Components

  • PIC18F4550
  • Seven Segment Display
  • Transistor BC547

Project Video


Filed Under: PIC Microcontroller
Tagged With: display, led, microcontroller, pic18f4550, seven segment
 

Questions related to this article?
👉Ask and discuss on Electro-Tech-Online.com and EDAboard.com forums.



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


Featured Tutorials

  • PS2 Keyboard To Store Text In SD Card Using Arduino Circuit Setup On Breadboard
    How To Use PS2 Keyboard To Store Text In SD Card Using Arduino- (Part 42/49)
  • Wireless Path Tracking System Using Mouse, XBee And Arduino Circuit Setup On Breadboard
    How To Make A Wireless Path Tracking System Using Mouse, XBee And Arduino- (Part 43/49)
  • How to Make a Wireless Keyboard Using Xbee with Arduino- (Part 44/49)
  • Making Phone Call From GSM Module Using Arduino Circuit Setup On Breadboard
    How to Make Phonecall From GSM Module Using Arduino- (Part 45/49)
  • How to Make a Call using Keyboard, GSM Module and Arduino
    How To Make A Call Using Keyboard, GSM Module And Arduino- (Part 46/49)
  • Receiving SMS Using GSM Module With Arduino Prototype
    How to Receive SMS Using GSM Module with Arduino- (Part 47/49)

Stay Up To Date

Newsletter Signup

Sign up and receive our weekly newsletter for latest Tech articles, Electronics Projects, Tutorial series and other insightful tech content.

EE Training Center Classrooms

EE Classrooms

Recent Articles

  • Renesas delivers intelligent sensor solutions for IoT applications
  • Microchip Technology releases AVR-IoT Cellular Mini Development Board
  • Qualcomm acquires Cellwize to accelerate 5G adoption and spur infrastructure innovation
  • MediaTek’s chipset offers high-performance option for 5G smartphones
  • Nexperia’s new level translators support legacy and future mobile SIM cards

Most Popular

5G 555 timer circuit 8051 ai Arduino atmega16 automotive avr bluetooth dc motor display Electronic Part Electronic Parts Fujitsu ic infineontechnologies integratedcircuit Intel IoT ir lcd led maximintegratedproducts microchip microchiptechnology Microchip Technology microcontroller microcontrollers mosfet motor powermanagement Raspberry Pi remote renesaselectronics renesaselectronicscorporation Research samsung semiconductor sensor software STMicroelectronics switch Technology vishayintertechnology wireless

RSS EDABOARD.com Discussions

  • Netlist physical name update
  • nt1065_USB3 gnss receiver
  • LLC HB with synchronous rectifiers can be very dodgy?
  • VHDL using a stimulus for one clock cycle
  • PSS fail to converge when internal clock was using

RSS Electro-Tech-Online.com Discussions

  • Decapped Chip On Board
  • Capacitor to eliminate speaker hum
  • undefined reference header file in proteus
  • Sony KV-A2913E (chassis AE1C) auto shuts off after one minute
  • CRT TV repair
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • About Us
  • Contact Us
  • Advertise

Copyright © 2022 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Projects and Tutorials
    • Electronic Projects
      • 8051
      • Arduino
      • ARM
      • AVR
      • PIC
      • Raspberry pi
      • STM32
    • Tutorials
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Products News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • EE Resources
    • DesignFast
    • LEAP Awards
    • Oscilloscope Product Finder
    • White Papers
    • Webinars
  • EE Learning Center
    • Design Guides
      • WiFi & the IOT Design Guide
      • Microcontrollers Design Guide
      • State of the Art Inductors Design Guide
  • Women in Engineering