Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

multiplexing 7 segment

Status
Not open for further replies.

suga

Member level 2
Joined
Jan 23, 2012
Messages
49
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Location
chennai
Activity points
1,596
hi...
I have to write program counter for four 7 segment.In that program 1st segment has to display 0 t0 9.after that 2 segment and 1 segment both has to display 0 to 9 after that 1st,2nd,3rd segments has to display 1 to 9.like that.....4 segemnts should display.0001 to 9999 has to display.
 

Which micro controller you are using and what type of 7 segment you are using.. Have you tried to display 0-9 in 7 segment.
This Forum is to help Who is facing difficulty in middle not for ready made Programs..
First try and post the code then sure help you ..

All the best
 

ya...I had tried 7 segment 0 to 9.now output is coming from 0000 t0 0099.I have to get 0000 to 9999.and am using 8051 micro controller this is my code
Code:
#include<reg51.H>

#define p0 P0
#define p3 P3


 
 unsigned char dig_disp=0;  

sbit dig_ctrl_4=P0^7;        //Declaring control pins of the seven segments
 sbit dig_ctrl_3=P0^6;
 sbit dig_ctrl_2=P0^5;
 sbit dig_ctrl_1=P0^4;
int min2;
 int min1;
 int sec2;
 int sec1;
 char digi_val[10]={0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09};

void delay()        //Function to provide a time delay of approx. 1 second. using Timer 1.
{
    int i;
    for(i=0;i<20;i++)
    {
        TL1=0xFD;
         TH1=0x4B;
         TR1=1;
         while(TF1==0);
         TR1=0;
         TF1=0;
    }
}

void display() interrupt 1        //Function to display the number using seven segmnet multiplexing. For more details refer seven segment multiplexing.
{
    TL0=0x36;        //Reloading Timer0
    TH0=0xf6;
    P0=0xFF;
    dig_ctrl_1 = dig_ctrl_3 = dig_ctrl_2 = dig_ctrl_4 = 0;
    dig_disp++;
    dig_disp=dig_disp%4;
    switch(dig_disp)
    {
        case 0:
        P0=digi_val[sec1];
        dig_ctrl_1 = 1;
        break;
   
        case 1:
        P0=    digi_val[sec2];
       dig_ctrl_2 = 1;
        break;
   
        case 2:
        P0=    digi_val[min1];
        dig_ctrl_3 = 1;
        break;
   
        case 3:
        P0=    digi_val[min2];
        dig_ctrl_4 = 1;
        break;
    }
}

void main()
{
    TMOD=0x11;        //Intialize Timer 0
    TL0=0x36;
    TH0=0xF6;
    IE=0x82;        // Enable Timer 0 interrupt
    TR0=1;        //Start Timer 0
    while(1)        //Start clock
    {
          min2=min1=sec2=sec1=0;
		 for(min2=0;min2<=9;min2++)
	for(min1=0;min1<=9;min1++)

	

       for(sec2=0;sec2<=10;sec2++)
                   
				if(sec2==0)
                 	for(sec1=0;sec1<10;sec1++)
                     
                        delay();
						else if (sec2==1)
						
						for(sec1=1;sec1<=9;sec1++,sec2++)
						delay();


						
						

 						
}
}
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top