Problem to create a program

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

Moderators: Benj, Mods

Post Reply
Fisher Benjamin
Posts: 6
Joined: Wed Jan 31, 2007 8:16 am
Contact:

Problem to create a program

Post by Fisher Benjamin »

i will create a program to control a brake to powder with Flowcode. i've create an algorigramm but i 've to Convert a string of characters in a variable whole because I receives figure 1 by 1 avec the RS232.
Can you help me please because it's hard (it's my first use of flowcode )

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:

Post by Benj »

Hello

I will try to break the problem down into blocks compatible with Flowcode.

Variables Window
byte index
byte max_index
byte char_in
Strinr word_in

Flowcode Main Program
Calculation
index = 0
max_index = 10

Loop(index < max_index)
{
Component Macro RS232 - read_byte - return value char_in
String Manipulation - word_in = word_in + char_in
Calculation index = index + 1
}

Fisher Benjamin
Posts: 6
Joined: Wed Jan 31, 2007 8:16 am
Contact:

Post by Fisher Benjamin »

Thanks

Fisher Benjamin
Posts: 6
Joined: Wed Jan 31, 2007 8:16 am
Contact:

i'm don't understand

Post by Fisher Benjamin »

I'm sorry but I don't understand the line :
"Component Macro RS232 - read_byte - return value char_in "
Can you explain me: what is the parameter timeout(byte) ?

Fisher Benjamin
Posts: 6
Joined: Wed Jan 31, 2007 8:16 am
Contact:

problem with string of caracters

Post by Fisher Benjamin »

Why i can use a number enregistred in a strinc of caracters :?:

Fisher Benjamin
Posts: 6
Joined: Wed Jan 31, 2007 8:16 am
Contact:

Post by Fisher Benjamin »

How i can use a number enregistred in a string of caracters

User avatar
Steve
Matrix Staff
Posts: 3418
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Post by Steve »

If I understand your question correctly, you want to use a number that is received via RS232 as a string of numerals, e.g. "173".

To convert this to an actual number, you would need to perform the mathematics yourself.

The numbers "0" to "9" are ascii codes 0x30 to 0x39, or 48 to 57.

If you received the string "173", then the codes would be 0x31, 0x37 and 0x33. You would subtract 0x30 from each number, leaving you 1, 7, and 3.

You would then multiply each number by the appropriate power of 10 and add them up, i.e. 1x100 + 7x10 + 3 = 173.

Of course, you will need to ensure that the characters received are valid numbers (i.e. between 0x30 and 0x39).

Fisher Benjamin
Posts: 6
Joined: Wed Jan 31, 2007 8:16 am
Contact:

Post by Fisher Benjamin »

Thanks I think i've succeed

Post Reply