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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
07/17/09 12:28
Read: times


 
#167481 - re
Responding to: ???'s previous message

# include <reg51.h>
# include <stdio.h>

# define ROW 		P1
# define COL		P2
# define SEVEN_SEG 	P3

char keypad [4][4] = { 0, 1, 2, 3,
					   4, 5, 6, 7,
					   8, 9, 10, 11,
					   12, 13, 14, 15 };

char seven_seg [ ] = { 0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f, 0x69, 0x6f, 0x79, 0x63, 0xc7, 0x77, 0x63 };


void main ( ) {
	char temp, row, col, count;
	ROW = 0x0F;
	COL = 0x00;
	SEVEN_SEG = 0x00;
	
	TMOD = 0x20;
	SCON = 0x52;
	TH1 = 0xf3;
	TR1 = 1;


	while ( 1 ) { 
		COL = 0x0F;
		ROW = 0x00;
		while ( !( ROW & 0x0F ) );
		for ( temp = 0x01, count = 0; temp <= 0x08; temp <<= 1, count++ ) 
			if ( temp & ROW ) {
				row = count ;
				break;
			}
		
		for ( COL = 0x01, temp = 0x01, col = count = 0; temp <= 0x08; COL = (temp <<= 1), count++ )
			if ( row & ROW ) {
				col = count;
				break;
			} 

		temp = keypad [row][col];
		SEVEN_SEG = seven_seg [temp];
	}
}


 



List of 14 messages in thread
TopicAuthorDate
Yathish Kumar.n.s problem            01/01/70 00:00      
   i got solution for lcd prob            01/01/70 00:00      
      re            01/01/70 00:00      
         One thread            01/01/70 00:00      
            valid excuse            01/01/70 00:00      
               Different thread            01/01/70 00:00      
         RE:comments no need            01/01/70 00:00      
            Nonsense!            01/01/70 00:00      
            Translation            01/01/70 00:00      
            replies            01/01/70 00:00      
               Actually...            01/01/70 00:00      
                  Still taught :(            01/01/70 00:00      
                  Manchester?!            01/01/70 00:00      
                     UN believeable            01/01/70 00:00      

Back to Subject List