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


Fri Dec 08 2017, 12:47 PM
can i get gsm a6 library? can anybody help? tia
Sat Nov 25 2017, 08:32 AM
Can i get the code of Monitering and controlling of green house effect? ... Can anyone help me ?
Wed Nov 08 2017, 01:35 PM
Anirudh jain
I want to burn code in atmel 89s51 24pc 0329 but cannot get the connection with the burner. Can somebody provide me with the circuit diagram for connecting controller to burner. I'm using usb burner
Thu Nov 02 2017, 11:44 AM
write a program to exchange the content of b register with external RAM address 02CFH help me
Wed Nov 01 2017, 05:47 PM
i am using the DHT11 but i'm getting some errors in the simulate the programe in proteus 8 professional,: 1)cannot find model file 'DHTXX.MDF'.2)simulation failed due to netlist linker error(s).
Fri Sep 29 2017, 02:45 AM
i am doing the same project on verilog please contact me [email protected]
Wed Sep 20 2017, 12:36 AM
In a missing pulse detector using a 555 timer connected as a monostable vibrator with a PNP transistor,how does the positve input pulse turn on the PNP transistor?
Sun Sep 03 2017, 02:29 PM
How do I connect an <NOKIA 1100 LCD > to an atmega328P ?
Sun Aug 20 2017, 10:23 AM
i am intending to interface sd card with STM32F4 and want to write a file in sd card using SPI protocol but using HAL only. Can anyone help me PLEASE!!!!
Sun Aug 20 2017, 10:22 AM



Wed Dec 13 2017, 07:11 AM
Mon Dec 11 2017, 01:05 PM
Mon Dec 11 2017, 08:33 AM
Fri Dec 08 2017, 12:34 PM
Tue Dec 05 2017, 06:14 AM
Sat Dec 02 2017, 03:42 PM
Fri Dec 01 2017, 12:05 PM
Sat Nov 25 2017, 01:13 PM


Guests: 48, Members: 0 ...

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

Members: 37928
Newest member: roopay
Forum Activity
fernanmonroy2 Avatar
Posted By fernanmonroy2
Mon Dec 11 2017, 08:40 AM
Que significa que el contador de programa abordar...
zhudao Avatar
Posted By zhudao
Wed Dec 06 2017, 03:08 AM
I think either your 120 - 5 volt adapter, or the L...
ExperimenterUK Avatar
Posted By ExperimenterUK
Tue Dec 05 2017, 08:12 PM
I think either your 120 - 5 volt adapter, or the L...
zhudao Avatar
Posted By zhudao
Tue Dec 05 2017, 06:41 AM
Hi to all, in the period time I'm doing an project...
ExperimenterUK Avatar
Posted By ExperimenterUK
Mon Nov 20 2017, 10:18 PM
Here is a version of the tutorial that reads a key...
Ansh12 Avatar
Posted By Ansh12
Mon Nov 20 2017, 02:15 AM
As a starting point, can you tell us how much of t...
ExperimenterUK Avatar
Posted By ExperimenterUK
Sun Nov 19 2017, 08:35 PM
As a starting point, can you tell us how much of t...
Ansh12 Avatar
Posted By Ansh12
Fri Nov 17 2017, 04:07 AM
I am looking keypad interfacing program. I was rea...
JardCrocker Avatar
Posted By JardCrocker
Wed Nov 08 2017, 05:29 PM
Hi...i am a new user here. I was also facing the s...
ExperimenterUK Avatar
Posted By ExperimenterUK
Tue Nov 07 2017, 07:13 PM
> It employs a fairly advanced technique to detect...