Discussion in "Project Help" started by    Deepakvaishu    Mar 20, 2017.
Mon Mar 20 2017, 08:24 AM
I am using a keypad to type the text message,I am using a 8051 microcontroller and a 4X4 matrix keypad . I tried too much,But not getting the exact logic to use a single key to type 3 different alphabets ,eg key 1 is used to type a, b, c depending upon the number of times the key is pressed.
I have used a variable 'count ' to check the number of times key pressed, again I have to display the letter on the lcd .....plz give me the idea how actually the multiple letters are identified depending upon the key pressed.
Since the Col are input(1) and Row are output(0).
Is the key released() before it is pressed second time to print the 'b' letter,
Plz help for the coding of this program.

Tue Mar 21 2017, 02:55 PM
There are two ways I'd tackle thiss.

Key down only - Use a timer and have 3 consecutive time slots - read 1=character, If read 2 = read 1 then use second character on the key, If read 3 also= reads 1 and 2 use third character associated with that key, read 4 resets read counter and goes back to character 1.

Key up then down - Read matrix, use character, start a timer on key up, if timer not run out and read 2=read 1 then use second character on that key. etc.

Hope that helps.

Thu Mar 23 2017, 05:34 AM
I can type the letters now when the particular key is pressed.But the problem now I am facing is that when the same key is pressed twice after a long delay I want the second letter to be printed to the adjacent position, How to recognise that the delay is more and the key should be printed at the next position on lcd.
How should recognise the delaybetween two keys pressed..If the delay is more than I want to increament the position on my lcd...
Plz help.

Thu Mar 23 2017, 09:14 PM
You have largely answered your own question.
Use one of the timers to track time, say in 10mS counts.
Note the count each time a key is pressed.
Calculate the interval.
A short interval is to select values for the same key.
A long interval is a new selection.

[ Edited Fri Mar 24 2017, 01:34 AM ]
 Deepakvaishu like this.
Fri Mar 24 2017, 05:22 AM
I got that we should use timer......But I am a little bit confused that we can use timer to create the delay of particular time interval....But I really dont know , how to track the time ?
I am new in this field...should I use a timer as a counter to count the delay?
plz help.
Fri Mar 24 2017, 06:05 PM
The best way is to use an interrupt to run the counter.
What software are you using ?
Sat Mar 25 2017, 07:59 AM
I am using Keil and 8051 microcontroller
Sat Mar 25 2017, 09:49 PM
I have attached code showing one method you could use.
It deals with timing, you will have to add the code to
scan a matrix to read a key.


[ Edited Sat Mar 25 2017, 09:53 PM ]
 Deepakvaishu like this.
Thu Apr 06 2017, 07:55 AM
Thanks for the attachment.
I have gone through your code . I did not got how the variable Keytime is updated.
Is it initially assigned as '0', and then when the timer interrupt occurs then it is incremented ??
plz help.

Thu Apr 06 2017, 05:38 PM

Is it initially assigned as '0', and then when the timer interrupt occurs then it is incremented ??


Yes, the timer interrupt is called about 50 times a second
and increments keyTime.
The main program continuously monitors and resets keyTime.

This bit of code starts Timer 0 and enables its Interrupt.

ET0 = 1;                      /* Enable Timer 0 Interrupts */
TR0 = 1;                      /* Start Timer 0 Running */
EA = 1;                       /* Global Interrupt Enable */

This is the Timer 0 Interrupt handler.
It reloads the timer counters then increments keyTime
up to KEY_REPEAT_TIME (200).
void timer0_ISR (void) interrupt 1
	 TL0=0;  //reload timer
	// TH0=0xdc;  //values give 10mS period
	 TH0=0xbc;  //longer time for Proteus simulation
	if (keyTime < KEY_REPEAT_TIME)   //hold at limit
 Deepakvaishu like this.

Get Social


Powered by e107 Forum System


Mon Mar 19 2018, 07:33 PM
sorry bedo.. maybe next time
Sun Mar 18 2018, 07:48 AM
Mourya Manojkumar
Please send me circuit diagram and PCB diagram
Thu Mar 01 2018, 05:49 AM
May you please help me with a code for programmable load shedding controlling 4 loads
Sun Feb 25 2018, 08:29 PM
i need of it
Sat Feb 24 2018, 03:35 AM
I want help for digital ic tester
Tue Feb 20 2018, 04:01 PM
Join up.. and post your problem
Mon Feb 19 2018, 11:17 AM
i needs help for my project
Mon Feb 19 2018, 11:16 AM
can i join you guys
Sun Feb 04 2018, 09:38 PM
Hi Dave. Good to see you.
Tue Jan 09 2018, 07:55 PM
It's been a few years since I poked around here - Hi all...



Tue Mar 20 2018, 09:51 AM
Mon Mar 19 2018, 07:48 AM
Fri Mar 16 2018, 10:12 AM
Tue Mar 13 2018, 02:21 PM
Sat Mar 10 2018, 12:09 PM
Fri Mar 09 2018, 06:00 AM
Thu Mar 08 2018, 07:56 AM
Thu Mar 08 2018, 02:57 AM


Guests: 59, Members: 0 ...

most ever online: 182184
(Members: , Guests: 182184) on 06 Aug 2010: 05:37 AM

Members: 37987
Newest member: LAMBO
Forum Activity
bedo123 Avatar
Posted By bedo123
Mon Mar 19 2018, 07:51 AM
guys right now I m in a lab, is there anyone to he...
ExperimenterUK Avatar
Posted By ExperimenterUK
Sat Mar 17 2018, 09:26 PM
Khadka_Bishal Avatar
Posted By Khadka_Bishal
Fri Mar 16 2018, 11:34 AM
I want to have a delay of 15 microsecond in 8051 u...
ExperimenterUK Avatar
Posted By ExperimenterUK
Wed Mar 14 2018, 10:46 PM
Thanks a lot for all your help. It's really hard ...
kks Avatar
Posted By kks
Mon Mar 12 2018, 06:54 PM
As i said, it just needed it's own resistor. It's ...
ExperimenterUK Avatar
Posted By ExperimenterUK
Mon Mar 12 2018, 05:07 AM
It isn't faulty, but very dim. I tried it both way...
kks Avatar
Posted By kks
Mon Mar 12 2018, 01:11 AM
It isn't faulty, but very dim. I tried it both way...
ExperimenterUK Avatar
Posted By ExperimenterUK
Sun Mar 11 2018, 10:47 PM
kks Avatar
Posted By kks
Sun Mar 11 2018, 08:10 PM
It's Society car access system, where only the car...
ExperimenterUK Avatar
Posted By ExperimenterUK
Sun Mar 11 2018, 07:53 PM
>As for the door locking again, you just have to s...