I want to send a String variable via the RS232 Component,
Sending "Hello" as a predefined string works OK, but
trying to send the variable String where string = "Hello" is not accepted by the component.
I can hive off individiual characters from the string using
characterstring = mid$(string,X,1) and incrementing X.
However, I can find no way of changing characterstring into a byte variable so as to provide something that the RS232 component will accept.
Please advise.
Thanks in advance,
Mark
ps a string appears to recieve fine, as in string = string + RS232byteinput to build up a string.
How can a String variable be sent using the RS232 Component?
- Steve
- Matrix Staff
- Posts: 3433
- Joined: Tue Jan 03, 2006 3:59 pm
- Has thanked: 114 times
- Been thanked: 422 times
Hello Mark,
The RS232 component "send" macro accepts a single character. To get the single character out of the string, you can access it as an array of characters. Here's a simple prog with variables len (byte), i (byte) and s (string):
Not ideal, but should work ok.
The RS232 component "send" macro accepts a single character. To get the single character out of the string, you can access it as an array of characters. Here's a simple prog with variables len (byte), i (byte) and s (string):
Code: Select all
String manipulation:
s = "Hello Mark!"
len = Length$(s)
Calculation:
i = 0
Loop:
While i < len
Call Component Macro:
RS232:SendRS232Char( s[i] )
Calculation:
i = i + 1
End Loop:
- 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 Mark
Also you can use a string manipulation icon to do the following
Also you can use a string manipulation icon to do the following
Code: Select all
Calculation
i = 0
String Manipulation
STR = "Hello"
CHR = Char$(STR, i)
Component Macro
RS232:SendRS232Char(CHR)
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