Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
01/12/12 22:50
Read: 550 times


 
#185456 - switch interfacing
Responding to: ???'s previous message
sir
actually i cant understand what and how i write coad for it.sir i am posting my coad here.
and i want to make application only that displaying digites on the seven segment and store it in 93c66 eeprom.
i am working it in steps.my first step is switch interfacing after it eeprom interfacing. so i am posting here cond only for switch interfacing.
plz check thic coed and help me plz

/*****************************************/
/*			 0000 to 9999 Display		 */
/*			 with 4094					 */
/*           12:36 PM 1/10/2012          */
/*****************************************/
#include <reg52.h> 

unsigned char buffer[5];
unsigned int num1,num2,num3,num4,num5,test=0;
unsigned int num=0;

sbit CLK    = P2^1;
sbit DIN    = P2^0;
sbit strobe = P2^2;
											
sbit up    = P1^0;
sbit down  = P1^1;
sbit reset = P1^2;
sbit set   = P1^3;

char code segment[11]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x39};

void delay(int num)   // timer 							
{ 
	int i;
	for(i=0;i<num;i++)
	{	
		TH0=0xfc;
		TL0=0x67;
	}	 
}


void write_led()
{
     char i,j;

	 for(j=0; j<5; j++)
	 {
	 for(i=0;i<8; i++)
    	 {
           if(buffer[j]&0x80) DIN = 1; 
           else DIN=0; 
           CLK= 1; 
           buffer[j] <<=1; 
           CLK = 0;
	     }
	 }
	strobe = 1;
    ;
    strobe = 0;
}	    

void move_Buffer()
{
    buffer[0] = segment[num1%10];
    buffer[1] = segment[num2%10];
    buffer[2] = segment[num3%10];
    buffer[3] = segment[num4%10];
    buffer[4] = segment[num5%10];
}
								
void updatedisplay()
{
       move_Buffer();
       write_led();
}

void counter()
   {
  if(up==0&&down==1)                                 //check if up pin is pressed
     {
   test++;
        num=test;
	    num1=num%10;
      num=num/10;
        num2=num%10;
      num=num/10;
        num3=num%10;
      num=num/10;
        num4=num%10;
      num5=num/10;
      if(test==99999)
     test=0;
    }
    if(up==1&&down==0)                         //check if down pin is pressed
    {
   test--;
        num=test;
		num1=num%10;
      num=num/10;
        num2=num%10;
      num=num/10;
        num3=num%10;
      num=num/10;
        num4=num%10;
      num5=num/10;
     if(test==0)
     test=99999;
  }
}
  
void re()                                             // reset display
{
  if (reset==0)
  num1=num2=num3=num4=num5=0;
 }

void timer_isr(void) interrupt 1 using 1
{
    counter();
	re();
	delay(10000);
    updatedisplay();
}

void main()
{
  TMOD = 0x01;
  EA   = 1;
  ET0  = 1;
  TR0  = 1;
  up   = 1;
  down = 1;
  reset= 1;
  set  = 1;

}




List of 44 messages in thread
TopicAuthorDate
switch interfacing      Anil Kumar      01/11/12 00:38      
   What?      Per Westermark      01/11/12 00:58      
      switch interfacing      Anil Kumar      01/11/12 01:39      
         The 7-segment digits will not handle switches      Per Westermark      01/11/12 02:57      
   Perhaps this may be useful to you      Maunik Choksi      01/11/12 03:53      
      4 buttons - not full keypad      Per Westermark      01/11/12 04:39      
         switch interfacing      Anil Kumar      01/12/12 00:06      
            That is called edit mode      Maunik Choksi      01/12/12 01:55      
               switch interfacing      Anil Kumar      01/12/12 22:50      
                  You need to study some examples      Maunik Choksi      01/12/12 23:51      
                     switch interfacing      Anil Kumar      01/13/12 00:10      
                  Details details - and where is debounce/repeat handling?      Per Westermark      01/13/12 01:20      
                     switch interfacing      Anil Kumar      01/14/12 00:59      
            Why should this be a problem??      Kai Klaas      01/12/12 07:53      
            interfacing your switches has nothing to do with LED's      Richard Erlacher      01/12/12 22:02      
   MUX LED AS O/P PIN      Satish S Munot      01/14/12 19:47      
      Switch interfacing      Anil Kumar      01/19/12 23:19      
         divide and conquer      Mahmood Elnasser      01/20/12 01:35      
         simplified step-by-step way to post your schematic        KONSTANTINOS L. ANGELIS      01/20/12 02:12      
            remember      Erik Malund      01/20/12 07:31      
               ? Not Muxing ?      Michael Karas      01/20/12 08:17      
   switch interfacing      Anil Kumar      01/21/12 01:57      
      You need lots of resistors      David Prentice      01/21/12 04:34      
         (Back to) Basics      Andy Neil      01/21/12 05:17      
            multiplex 5 digits      David Prentice      01/21/12 05:43      
               Don't think anyone would want 1:35 degenerate "multiplexing"      Per Westermark      01/21/12 05:52      
                  Have I done the sums wrong?      David Prentice      01/21/12 06:06      
                     No but multiplexing requires few driver lines      Per Westermark      01/21/12 06:17      
                        You MUST have digit drvers      David Prentice      01/21/12 07:00      
                           You missed '4094 OE+PWM for luminocity      KONSTANTINOS L. ANGELIS      01/21/12 09:47      
               No multiplexing needed...      Kai Klaas      01/21/12 07:33      
                  switch interfacing      Anil Kumar      01/21/12 07:46      
                     What help?      Andy Neil      01/21/12 08:33      
                     how?      Erik Malund      01/21/12 08:34      
                     Ah, a homework, right?      Kai Klaas      01/21/12 09:21      
                        switch interfacing      Anil Kumar      01/21/12 09:55      
                           language?      Erik Malund      01/21/12 10:37      
                           i have no logical idea how i write code      Andy Neil      01/21/12 10:40      
                           You need...      Kai Klaas      01/22/12 07:07      
                              Making a seven segment display blink      Andy Neil      01/22/12 07:19      
                                 The 4094 chip has an OE pin      David Prentice      01/22/12 07:48      
                              switch interfacing      Anil Kumar      01/22/12 10:57      
   switch interfacing      Anil Kumar      01/31/12 22:07      
      would you provide some feedback ?      KONSTANTINOS L. ANGELIS      02/01/12 03:35      

Back to Subject List