Page 1 of 1
Get keypadnum_to lcd.
Posted: Mon Sep 12, 2011 12:47 pm
by nuwan5213
Hi all,
i want to 3digit number display using keypad and lcd.
i tryed hours to create flow code and no results,my tric was get number and disply,time delay,moove curaer then get another number so on.
is it simiulator problem or any trick with kepad number gettig?
please help.
Re: Get keypadnum_to lcd.
Posted: Mon Sep 12, 2011 1:01 pm
by Sean
If you are using the GetKeypadNumber keypad macro, the value returned can not be displayed directly using the PrintASCII macro, you will need to use the PrintNumber macro.
Using the GetKeypadAscii macro will return individual characters that can be displayed using PrintASCII
Re: Get keypadnum_to lcd.
Posted: Mon Sep 12, 2011 1:32 pm
by medelec35
Re: Get keypadnum_to lcd.
Posted: Mon Sep 12, 2011 3:13 pm
by Spanish_dude
Hi,
If I remember well, the GetKeypadNumber returns 255 when no button is pressed, so what you could do is this :
Code: Select all
char counter, number;
int value = 0;
// some code
counter = 0;
value = 0;
while (counter < 2)
{
number = GetKeypadNumber();
if (number != 255 && number < 10)
{
value = value* 10 + number;
counter = counter + 1;
}
}
// print value on LCD
I haven't added comments to the program like I usually do when I write one, because I think this is easy to understand. (I'll explain if needed)
Nicolas
EDIT:
I added "&& number < 10" because in the simulation, the * and # is read as a 10 and 11 so we don't want that.
Re: Get keypadnum_to lcd.
Posted: Tue Sep 13, 2011 12:36 pm
by nuwan5213
Hi medelec,
thanks for link. Ok now the problem is cannot get number 11,22,33...like that.what are the modifications to get same digit repeated number.?,
sorry for spell mistake .im posting with my mobile devise.
regards,
nuwan
Re: Get keypadnum_to lcd.
Posted: Tue Sep 13, 2011 2:03 pm
by medelec35
Hi. nuwan5213
I have put a basic flowchart together for Flowcode V4.
You can enter one or two numbers (can easily expand to accommodate more numbers)
Total is stored in a variable called Value.
Press # to reset.
If you want to do something different them please let me know so I can alter flowchart for you.
With This one you need to enter the two digits seperatly e.g 33, 16 etc.
I can change it if you just want to press a sinlge 3 and value would be asigned with 33
Note: In both cases, you will need alter the target device, osc speed and configuation settings to suit your application.
Martin
Re: Get keypadnum_to lcd.
Posted: Tue Sep 13, 2011 2:14 pm
by medelec35
More basic version. Rather than change it , I decided to post it any way.
Just press a single digit e.g 5, then Value Variable will be 55 and display will also show 55
Martin
Re: Get keypadnum_to lcd.
Posted: Wed Sep 14, 2011 6:55 am
by nuwan5213
Hi,
medelec thanks.problem solved.
Re: Get keypadnum_to lcd.
Posted: Wed Sep 14, 2011 7:44 am
by medelec35
That's great. Thanks for letting us know.
Martin