Keypad use in Flowcode

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

Keypad use in Flowcode

Postby Walbeek » Wed Dec 17, 2008 3:08 pm

Hi there,

I would like to read 3 numbers from the keyboard using the "GetKeypadNumber" macro.
I copy these 3 numbers into 3 variables at the moment, called digit1, digit2 and digit3.
I also copy the value of these digits into Eprom.

For my current project I need the 3 digits into one variable.
For example, 1, 3, 5 gives digit1 = 1, digit2 = 3, digit3 = 5.
I want to copy this into a variable, called total.
This should give total = 135. (or anything else between 0 and 255)
Is this possible, and how can I do this?
Please give me some tips on this subject.
Best regards, Rinie
Greetings, Rinie
Flowcode V6 user
Flowcode v5 User
Posts: 61
Joined: Thu Mar 01, 2007 10:48 am
Location: Netherlands
Has thanked: 0 time
Have thanks: 3 times


Re: Keypad use in Flowcode

Postby Benj » Wed Dec 17, 2008 5:33 pm

Hello Rinie

Yes this should be quite simple to do. First you will have to convert the numbers from ASCII to plain numeric data (only do this step if you are using the ReadAsAscii function)

digit1 = digit1 - '0'
digit2 = digit2 - '0'
digit3 = digit3 - '0'

Once you have done this you will need to create a variable to hold the result. You will have to use a INT variable here for any numbers over 255.

total = digit3
total = total + (digit2 * 10)
total = total + (digit1 * 100)

Hope this helps. 8)
User avatar
Matrix Staff
Posts: 11144
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 2959 times
Have thanks: 3191 times

Return to Flowcode V2 & V3

Who is online

Users browsing this forum: No registered users and 1 guest