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 )
Problem to create a program
-
- Posts: 6
- Joined: Wed Jan 31, 2007 8:16 am
- Contact:
- 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:
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
}
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
}
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 6
- Joined: Wed Jan 31, 2007 8:16 am
- Contact:
-
- Posts: 6
- Joined: Wed Jan 31, 2007 8:16 am
- Contact:
i'm don't understand
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) ?
"Component Macro RS232 - read_byte - return value char_in "
Can you explain me: what is the parameter timeout(byte) ?
-
- Posts: 6
- Joined: Wed Jan 31, 2007 8:16 am
- Contact:
-
- Posts: 6
- Joined: Wed Jan 31, 2007 8:16 am
- Contact:
- Steve
- Matrix Staff
- Posts: 3418
- Joined: Tue Jan 03, 2006 3:59 pm
- Has thanked: 114 times
- Been thanked: 422 times
- Contact:
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).
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).
-
- Posts: 6
- Joined: Wed Jan 31, 2007 8:16 am
- Contact: