Keypad use in Flowcode

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

Moderators: Benj, Mods

Post Reply
Walbeek
Flowcode v5 User
Posts: 68
Joined: Thu Mar 01, 2007 10:48 am
Location: Netherlands
Been thanked: 3 times
Contact:

Keypad use in Flowcode

Post by Walbeek »

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 V7 user

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Keypad use in Flowcode

Post by Benj »

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)

Calculation
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.

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

Hope this helps. 8)

Post Reply