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.

Serial Communication with PC using keypad and 8051

Status
Not open for further replies.

abdullahkhan5

Newbie level 5
Joined
Dec 25, 2006
Messages
10
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,361
We are trying to interface a 4x3 keypad with PC using ATMEL 8051 and objective is that we send a password through keypad and it is checked in PC and if correct certain LED is turned on. We have written code for it and in assembly and if someone can check and please tell if there are any errors or suggestions because all our pins work the way we want them to, only our data does not get transmitted to when we press certain key and look for corresponding data in hyperterminal on PC. please help! below is the code
the clock we are using is 11.0592MHz

MOV TMOD,#20H
MOV SCON,#50H
MOV TH1,#0E8H

start:
SETB P1.1
SETB P1.2
CLR P1.3;column 1
SETB P1.4
CLR P1.5;column 2
CLR P1.6;column 3
SETB P1.7
JNB P1.7,L1
JNB P1.1,L2
JNB P1.2,L3
JNB P1.4,L4

ljmp start



L1:
CLR P1.1
CLR P1.2
SETB P1.3;column 1
CLR P1.4
SETB P1.5;column 2
SETB P1.6;column 3
CLR P1.7

MOV A,#1
JNB P1.3,ONE
MOV A,#2
JNB P1.5,ONE
MOV A,#3
JNB P1.6,ONE
jmp L1

L2:
CLR P1.1
CLR P1.2
SETB P1.3;column 1
CLR P1.4
SETB P1.5;column 2
SETB P1.6;column 3
CLR P1.7

MOV A,#4
JNB P1.3,ONE
MOV A,#5
JNB P1.5,ONE
MOV A,#6
JNB P1.6,ONE
jmp L2
L3:
CLR P1.1
CLR P1.2
SETB P1.3;column 1
CLR P1.4
SETB P1.5;column 2
SETB P1.6;column 3
CLR P1.7

MOV A,#7
JNB P1.3,ONE
MOV A,#8
JNB P1.5,ONE
MOV A,#9
JNB P1.6,ONE
jmp L3
L4:
CLR P1.1
CLR P1.2
SETB P1.3;column 1
CLR P1.4
SETB P1.5;column 2
SETB P1.6;column 3
CLR P1.7

MOV A,#'*'
JNB P1.3,ONE
MOV A,0
JNB P1.5,ONE
MOV A,#'#'
JNB P1.6,ONE
jmp L4

ONE:
MOV sbuf,A
SETB TI
CLR TI
HERE: JNB P1.3,HERE
JNB P1.5,HERE
JNB P1.6,HERE
ljmp start

END
 

Send your keypad circuit diagram please, without that it is hard to analyze your program.
 

I think ur setting TI bit while transmitting on serial port, but TI flag gets set automatically...infact you have to check the TI flag to know if the previous data in SBUF is transmitted,once it is transmitted TI is set, then transmit data and clr TI

something like this....

here:
jnb ti,here ;waiting until previous data is sent
mov sbuf,a ;puts new data in sbuf
clr ti ;this has to be done in s/w
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top