Sending strings

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

Moderators: Benj, Mods

Post Reply
User avatar
goldwingers
Posts: 118
Joined: Wed Sep 06, 2006 1:22 pm
Location: London
Been thanked: 1 time
Contact:

Sending strings

Post by goldwingers »

How do i send data as a string to the com port. The string would be something like "1,0,1,13,10" equating to

sw1 =1
sw2 = 0
sw3 = 1
cr
lf

I need to send the string as seen (including the inverted commas). The program I am using needs to take this as a string and it is then decoded

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

Post by Steve »

Here's one way...

Code: Select all

//decision
if (sw1 = 1)

  //Component Macro
  SendRS232Char("1")

//else

  //Component Macro
  SendRS232Char("0")

//end if

//Component Macro
SendRS232Char(",")

...etc...

User avatar
goldwingers
Posts: 118
Joined: Wed Sep 06, 2006 1:22 pm
Location: London
Been thanked: 1 time
Contact:

Post by goldwingers »

Steve do i need to put that in a C code block?

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

Post by Steve »

No - that's my shorthand for Flowcode icons.

User avatar
goldwingers
Posts: 118
Joined: Wed Sep 06, 2006 1:22 pm
Location: London
Been thanked: 1 time
Contact:

Errrr

Post by goldwingers »

Hi Steve

I have tried to insert "SendRS232Char("1") " into a send box but it does not accept ("1") or do i need to type in char("1")?

cheers

Ian

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 Ian

Try using '1' instead of "1"

User avatar
goldwingers
Posts: 118
Joined: Wed Sep 06, 2006 1:22 pm
Location: London
Been thanked: 1 time
Contact:

Post by goldwingers »

Hi Beng,

The program for my Gui needs the data to be in inverted commas ie
data sent = "1" This is a down fall of the gui program not flowcode.

I have assumed that char (20) is the number for the " so I have tried sending as follows

send rs232 - char20

send rs232 = 43

send rs232 - char20

send rs232 - char 13

send rs232 - char 10

this should give me a string of "43,13,10" but the program im using dont see the inv commas

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

Post by Steve »

char 34 is the inverted commas.

Also, sending the number "43" will not send the text "43" - it will send the ASCII character that is 43 (it's "+").

Post Reply