hi every one, i m new in keil compiler. i connect LCD16x2 and keypad (4x4). my problem is that , in LCD, it can show from 0-15 on pressing from first till last key, while i want to print what is exactly written in keypad. like 1-9, 0, A to D.? my second problem is that i can see the number only while pressing, i want that pressed no. to show untill i press new no.? and third problem is that,i want to save the pressed digits from key pad , to send them wirelessly too, but thats a later task, first i need to save the digits in any variables. many thinks and regards to all, plz waiting for the reply my code is in c:\projects\hamash\keilcpp\55
and you think we all have access to your local hard drive to be able to see that, do you?!
marauf hamash,
Find the answer on my hard drive:
c:\PlaceForMorons\AndIdiots\WhoseLegIsPulled.c
Oops Tamir. You totally forgot that you need to write that reference as an URL - Universal Resource Locator: file://HappyLappy/c/PlaceForMorons/AndIdiots/WhoseLegIsPulled.c
In your main loop, after read a key , you should compare to an old key. If NEW key != OLD key then you have new key pressed. Otherwise, either same key pressed or no new key pressed.
Let have a variable called OldVar1. Then your main loop looks something like this:
main() { var1 = INKEY(); // IS function INKEY returns 0-15 if (var1 != OldVar1) // CHECK THE SYNTAX FOR C // Print on LCD only have a new key pressed { Key = LOOKUP[255,1,2,3,"A",4,5,6,"B",7,8,9,"C","*",0,"#","D"][var1]; PrintAt(2,1,var1,"grate coder"); OldVar1 = var1 // Save the key value for later } delayms(100); goto main } I write program in hyfan-basic, but the logic is same as c Tom
PrintAt(2,1,var1,"grate coder");
Oh, yeah.
I write program in hyfan-basic, but the logic is same as c
delayms(100);
goto main
Oh, yeah !
Where on your hard drive can we find this brilliant code, Tom?
what is ur problem????? i give help and a good idea. u give what??????
No!
Let's have a variable with a proper, meaningful name - like "previousKeyCode"
var1 = INKEY();
Again, why not have a variable with a proper, meaningful name - like "newKeyCode"
Then the test becomes directly obvious - instead of having to look around for the meanings of var1 and OldVar1:
if( newKeyCode != previousKeyCode )