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.

Keypad and 89c51- sending by UART

Status
Not open for further replies.

harshita

Member level 2
Joined
Dec 28, 2006
Messages
51
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Location
chennai
Activity points
1,629
89c51 port 0 circuit

Hello guys...

I have some doubts in 89c51 for small application...

Please can you guys help me...

fine..my doubt is I want to send data from keypad 4*3 (Transmitter) to Hyperterminal (Uart Receiver)....


Please give idea to get data from Transmitter to receiver.....

Thank u ..


With Regards,

Harshita
 

keypad at port 0

Hi All,


Your Keypad 4x3 Will be interfaced to an 89C51 preferable with PORT0 (P0)
with Pull Ups you can read a key and send a Character to HT using UART of your
controller.
 

89c51 port 0 description

Hi...

Am connecting keypad in port2.... is it ok?
and also LCD in Port0 & port1....
 

use of port0 of 89c51

if you are using keypad then you need some circuit to competence key de-bounce.
Atmel AT89C51 has built in key bounce decode logic on PORT0. if you are not using the Built in De-bounce logic then you will have to implement it in software. you can also use some IC which also dose the JOB. you will have to convert the keypad code to actual valuse using some look-up table. this data can be then sent to PC via RS232 function.

hock
 
89c51 switch debounce

@hock
It's pretty strange to know about the built-in debounce decode logic on port 0. I have been familar with 89C51 and it's derivate for years, I haven't seen any of these things likely, even the newer precision mixed signal 8051 that I'm using these days, doesn't have this ability.
Are you sure about this? I read the datasheet of AT89C51, there is no such thing mention about it. Secondly, I wonder what debounce decoder had to do with Port 0. There are no registers to turn them ON/OFF and I didn't come across any literature regarding it.
 

89c51与lcd

sorry buddy it is there in Atmel 89C51RD2

hock
 

Re: Keypad and 89c51

Hello guys.. this my coding for Transmitter side... but i didnt get output in both LCD and Keyapad for Serial communication....

Please check the coding.... wheather problem in coding or hardware...

I gave coonection according to this coding only...

If you have any doubts regarding this... please check perivous posts....


================================================
#include<stdio.h>
#include<reg52.h>

sfr col =0x0A0; // KEYPAD ROW & COLUMN PORT2

sbit R1 = P2^1;
sbit R2 = P2^6;
sbit R3 = P2^5;
sbit R4 = P2^3;
sbit C1 = P2^2;
sbit C2 = P2^0;
sbit C3 = P2^4;

sfr ldata=0x90; // lcd data D0 to D7 = port 1 respetively
sbit rs = P0^1; // Regsiter Select RS=Port2.0
sbit rw = P0^2; // Read/Write R/W=Port2.1
sbit en = P0^0; // Enable E= Port2.2


void msdelay(unsigned int value);
void sertx(unsigned char x);
void lcdcmd(unsigned char value);
void lcddata(unsigned char value);

unsigned char keypad[4][3]={'1', '2', '3',
'4', '5', '6',
'7', '8', '9',
'*', '0', '#'};


void main()
{
unsigned char i;
unsigned char colloc, rowloc;
unsigned char cdata[5]={0x38, 0x0e, 0x01, 0x06, 0x86};
TMOD=0x20;
TH1=0xFD;
SCON=0x50;
TR1=1;

/*LCD command*/

for(i=0;i<5;i++)
{
lcdcmd(cdata);
msdelay(250);
}

/*keypad routine*/

col=0xff; //make all coloumns input
while(1)
{
do
{
R1=0; //make all row ground
R2=0;
R3=0;
R4=0;
colloc=col;
colloc&=0x15;
//mask used bit
}
while(colloc!=0x15);
do
{
do
{
msdelay(20);
colloc=col;
colloc&=0x15;
}
while(colloc==0x15);
msdelay(20);
colloc=col;
colloc&=0x15;
}
while(colloc==0x15);
while(1)
{
R1=0;
colloc=col;
colloc&=0x15;
if(colloc!=0x15)
{
rowloc=1;
break;
}
R2=0;
colloc=col;
colloc&=0x15;
if(colloc!=0x15)
{
rowloc=2;
break;
}
R3=0;
colloc=col;
colloc&=0x15;
if(colloc!=0x15)
{
rowloc=3;
break;
}
R4=0;
colloc=col;
colloc&=0x15;
rowloc=4;
break;
}

/*check column and send result to serial port and to LCD Display*/

if(C1==0)
{
sertx(keypad[rowloc][1]);
lcddata(keypad[rowloc][1]);
}
else if(C2==0)
{
sertx(keypad[rowloc][2]);
lcddata(keypad[rowloc][2]);
}
else
{
sertx(keypad[rowloc][3]);
lcddata(keypad[rowloc][3]);
}
}
}


void sertx(unsigned char x)
{
SBUF=x;
while(TI==0);
TI=0;
}

void msdelay(unsigned int value)
{
unsigned int x,y;
for(x=0;x<1275;x++)
for(y=0;y<value;y++);
}

void lcdcmd(unsigned char value)
{
ldata=value;
rs=0;
rw=0;
en=1;
msdelay(1);
en=0;
return;
}
void lcddata(unsigned char value)
{
ldata=value;
rs=1;
rw=0;
en=1;
msdelay(1);
en=0;
return;
}

==================================================

Waiting for your Reply guys...

Give me the suggestion.. what should i do....
 

Re: Keypad and 89c51

Hello guys,

Now am using AT89c52 Microcontroller...
Shall i connect my LCD(16*2) and Keypad (4*3) to PORT 0 AND PORT 2 respectively....

LCD Enable pin---------- Port0.2
LCD R/W pin ------------ Port0.1
LCD RS pin -------------- Port0.0
LCD D0-D7 -------------- Port1.0 - Port1.7

and about Keypad.... am connecting all the seven pin in PORT2.0-PORT2.6

My doubt in this Hardware connection is... shall i connect this or not....

If yes means i didnt get the Output Properly....

What shall i do...

please help me soon...

Thank you in advance,

With Regards,

Harshita
 

Re: Keypad and 89c51

As far as 8051's pins are concerned, any selection is OK ..
Just remember, if you use pins P0.0-P0.7 connect 10kΩ pullups ..

If you don't want to add external resistors (pullups) switch to pins from P3 ..

Rgds,
IanP
 

Re: Keypad and 89c51

Hi IanP,

Am using 89c52.... is it ok... shall i coonect those pullup in Port0....

If you are not able to catch my point... i will the circuit... please suggest me one solution....

With regards,
Harshita
 

Re: Keypad and 89c51

some of the keyboard does not show Short Circuit on key Press but they behave as a some ohm resistance.
If we have Pull Up then it will function better. so you better use PORT0
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top