Write a program for 2*2 matrix using switches


Program for 2*2 matrix using switches

#include<8051.h>
void main()
{
P0=0xff;
P1=0x00;
while(1)
{
if(P0_0==0 && P0_4==0)
{
P1=0x01;
}
if(P0_0==0 && P0_5==0)
{
P1=0x02;
}
if(P0_1==0 && P0_4==0)
{
P1=0x03;
}
if(P0_1==0 && P0_5==0)
{
P1=0x04;
}
}
}

Add Comment