Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*This program is created by Shubham */
- /*This program is for appin project */
- #include <stdio.h>
- #include <reg51.h>
- sbit col1 = P0^0;
- sbit col2 = P0^1;
- sbit col3 = P0^2;
- sbit row1 = P0^3;
- sbit row2 = P0^4;
- sbit row3 = P0^5;
- sbit row4 = P0^6;
- void delay(unsigned int msec) // Function to provide time delay in msec.
- {
- int i,j ;
- for(i=0;i<msec;i++)
- for(j=0;j<1275;j++);
- }
- void check_col1() //Function for checking column one
- {
- row1=row2=row3=row4=1;
- row1=0;
- if(col1==0)
- {
- P1 = 0xf9;
- delay(100);
- }
- row1=1;
- row2=0;
- if(col1==0)
- {P1 = 0x99;
- delay(100);}
- row2=1;
- row3=0;
- if(col1==0)
- {
- P1 = 0xf8;
- delay(100);
- }
- row3=1;
- row4=0;
- if(col1==0)
- {
- P1 = 0x00;
- delay(100);
- }
- row4=1;
- }
- void main()
- {
- col1=col2=col3=1; //Input Port
- while(1)
- {
- row1=row2=row3=row4=0;
- if(col1==0)
- check_col1();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement