Discussion in "Project Help" started by    Deepakvaishu    Mar 20, 2017.
Mon Mar 20 2017, 08:24 AM
#1
hello,
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
#2
HI,
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.
Steve



Thu Mar 23 2017, 05:34 AM
#3
hello,
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.

Deepakvaishu
Thu Mar 23 2017, 09:14 PM
#4
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
#5
Hi,
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
#6
The best way is to use an interrupt to run the counter.
What software are you using ?
Sat Mar 25 2017, 07:59 AM
#7
I am using Keil and 8051 microcontroller
Sat Mar 25 2017, 09:49 PM
#8
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.


Attachment


[ Edited Sat Mar 25 2017, 09:53 PM ]
 Deepakvaishu like this.
Thu Apr 06 2017, 07:55 AM
#9
hello,
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
#10


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

Deepakvaishu


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
	{
		keyTime++; 
	}
}
 Deepakvaishu like this.

Get Social

Information

Powered by e107 Forum System

Conversation

rawat742
Fri Aug 18 2017, 11:37 AM
hi @ angel patel i will attach a file i hope it will be helpfull for you
ExperimenterUK
Mon Aug 14 2017, 09:57 PM
@ angel patel... just log in and post your problem
Mon Aug 14 2017, 01:45 PM
angel patel
hey any one help to make the led scrolling display
desuza6
Sat Jul 29 2017, 07:09 AM
I see the code for step motor h l 298 to rotate 45 degree, but all delay time, if I want to input sensor to h the pulses to stepmotor
rammichael
Thu Jul 27 2017, 12:05 PM
okay fine
ExperimenterUK
Wed Jul 26 2017, 07:51 PM
Please post questions in the forum, the chat box is for chat
msd007
Wed Jul 26 2017, 11:27 AM
i need code if any one have aduc706 interfacing lcd 16*2
msd007
Wed Jul 26 2017, 11:26 AM
pl help me how to write code of interfacing ADuc7026 controlleo lcd pl any one help me hoe to initializend configure the direction
rammichael
Wed Jul 26 2017, 06:04 AM
can you explain what is timer and how to use their modes ...
rammichael
Wed Jul 26 2017, 06:03 AM
ExperimenterUk thank you for your quick reply okay

Downloads

Comments

Pirateak
Thu Aug 17 2017, 02:02 PM
sathishksk71
Wed Aug 16 2017, 04:47 AM
rawat742
Sun Aug 13 2017, 05:49 PM
alparslanbagriyanik
Fri Aug 11 2017, 08:10 AM
Thanhquan
Sat Aug 05 2017, 05:17 PM
NAMRATHA
Thu Aug 03 2017, 08:32 AM
Kgj
Tue Aug 01 2017, 12:41 PM
Ingketech
Sun Jul 30 2017, 01:03 PM

Online

Guests: 52, Members: 0 ...

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

Members: 37878
Newest member: Pirateak
Forum Activity
rawat742 Avatar
Posted By rawat742
Fri Aug 18 2017, 02:58 PM
Dear Sir, I have a another program in which I am a...
rawat742 Avatar
Posted By rawat742
Fri Aug 18 2017, 11:45 AM
LCD SCROLLING MESSAGE PROGRAM CODE AND SIMULATION...
rawat742 Avatar
Posted By rawat742
Fri Aug 18 2017, 11:24 AM
Dear Sir , I am not able to increased value by pre...
rawat742 Avatar
Posted By rawat742
Fri Aug 18 2017, 11:19 AM
Dear Sir, as per your attachment I w...
ExperimenterUK Avatar
Posted By ExperimenterUK
Thu Aug 17 2017, 10:54 PM
Try this. Attachment ...
rawat742 Avatar
Posted By rawat742
Thu Aug 17 2017, 08:24 PM
Dear Sir , Please help me for stor...
sathishksk71 Avatar
Posted By sathishksk71
Wed Aug 16 2017, 04:53 AM
Hi.. Iam refreshing c language using this useful r...
ExperimenterUK Avatar
Posted By ExperimenterUK
Mon Aug 14 2017, 10:19 PM
The original 8051 is a primitive device.Over the ...
rawat742 Avatar
Posted By rawat742
Mon Aug 14 2017, 06:52 AM
Dear sir, First of all i want to thanks to you fo...
ExperimenterUK Avatar
Posted By ExperimenterUK
Sun Aug 13 2017, 11:25 PM
Reading page 11 of the data sheet, it is not clear...