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.
Get keypadnum_to lcd.
Moderator: Benj
-
Sean
- Valued Contributor

- Posts: 548
- Joined: Tue Jun 26, 2007 11:23 am
- Has thanked: 6 times
- Been thanked: 44 times
Re: Get keypadnum_to lcd.
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
Using the GetKeypadAscii macro will return individual characters that can be displayed using PrintASCII
-
medelec35
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: Get keypadnum_to lcd.
Will this help you?
http://www.matrixmultimedia.com/mmforum ... 140#p17448
http://www.matrixmultimedia.com/mmforum ... 140#p17448
Martin
-
Spanish_dude
- Posts: 594
- Joined: Thu Sep 17, 2009 7:52 am
- Location: Belgium
- Has thanked: 63 times
- Been thanked: 102 times
Re: Get keypadnum_to lcd.
Hi,
If I remember well, the GetKeypadNumber returns 255 when no button is pressed, so what you could do is this :
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.
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
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.
-
nuwan5213
- Posts: 82
- Joined: Thu Jul 29, 2010 10:03 am
- Location: sri lanka
- Has thanked: 24 times
- Been thanked: 4 times
Re: Get keypadnum_to lcd.
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
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
Electronics for better world.
-
medelec35
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: Get keypadnum_to lcd.
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
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
- Attachments
-
- Tot num.fcf
- (8.5 KiB) Downloaded 345 times
Last edited by medelec35 on Tue Sep 13, 2011 2:17 pm, edited 1 time in total.
Martin
-
medelec35
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: Get keypadnum_to lcd.
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
Just press a single digit e.g 5, then Value Variable will be 55 and display will also show 55
Martin
- Attachments
-
- Tot num2.fcf
- (7.5 KiB) Downloaded 329 times
Martin
-
medelec35
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times