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.

how to do 4*4 keyboard serial comm. interfacing with in proteus acco. to mazidi code

Status
Not open for further replies.

ankushgondane

Newbie level 1
Newbie level 1
Joined
May 22, 2013
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,293
#include<reg52.h>
#define COL P2
#define ROW P1
unsigned char keypad[4][4]={'0','1','2','3',
'4','5','6','7',
'8','9','A','B',
'C','D','E','F'};
void msdelay(unsigned int);
void sertx(unsigned char);
void main()
{
unsigned char colloc,rowloc;
TMOD=0x20;
SCON=0x50;
TH1=0xFD;
TR1=1;
COL=0xFF;
while(1)
{
do
{
ROW=0x00;
colloc=COL;
colloc&=0x0F;
}while(colloc!=0x0F);
do
{
do
{
msdelay(20);
colloc=COL;
colloc&=0x0F;
}while(colloc==0x0F);
msdelay(20);
colloc=COL;
colloc&=0x0F;
}while(colloc==0x0F);
while(1)
{
ROW=0xFE;
colloc=COL;
colloc&=0x0F;
if(colloc!=0x0F)
{
rowloc=0;
break;
}
ROW=0xFD;
colloc=COL;
colloc&=0x0F;
if(colloc!=0x0F)
{
rowloc=1;
break;
}
ROW=0xFB;
colloc=COL;
colloc&=0x0F;
if(colloc!=0x0F)
{
rowloc=2;
break;
}
ROW=0xF7;
colloc=COL;
colloc&=0x0F;
rowloc=3;
break;
}


if(colloc==0x0E)
sertx(keypad[rowloc][0]);
else if(colloc==0x0D)
sertx(keypad[rowloc][1]);
else if(colloc==0x0B)
sertx(keypad[rowloc][2]);
else
sertx(keypad[rowloc][0]);
}
}
void sertx(unsigned char x)
{
SBUF=x;
while(TI==0);
TI=0;
}
void msdelay(unsigned int time)
{
unsigned char i,j;
for(i=0;i<time;i++)
for(j=0;j<1275;j++);
}
this is code.i hav tried in proteus but not get o/p.how to make keypad in proteus
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top