String Query

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

Moderators: Benj, Mods

Post Reply
cobra1
Posts: 175
Joined: Thu Feb 04, 2010 7:44 am
Has thanked: 3 times
Been thanked: 3 times
Contact:

String Query

Post by cobra1 »

Hi

Im having a problem with something im working on using strings.

Basically what im doing is receiving data using the RXINT, each character received is being put into an array. The upon receiving <CR> the string is processed.

So i have a string variable set like this STRING[20]

After processing the string i fill the array with 255 values (i think that makes it blank ????)

To process the string its a case of finding out what was sent, so lets say i send "SEND TEMP" Thats 9 characters out of 20.
I have another string called SEND_TEMP[9] which = "SEND TEMP"
Now heres where im a bit stumped, i try to compare these strings to see if what was received matches any of the commands, so i compare STRING, and SEND_TEMP but they dont show as a match.

The only way they show as a match is is STRING[20] is changed to STRING[9] in the variables list. As you can imagine this sort of limits the about of characters i can now receive, especially since one of the commands is "STCH" thus potentially limiting me down to 4 character arrays.

Is there something i am doing wrong here or is this just how it is?

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: String Query

Post by medelec35 »

Hi cobra1,
I used a different method than Compare string function for 232 comms.
Maybe this may help?
http://www.matrixmultimedia.com/mmforum ... 877#p21243

Martin
Martin

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

Re: String Query

Post by Steve »

cobra1 wrote:After processing the string i fill the array with 255 values (i think that makes it blank ????)
Try filling with zeros, or at least setting the final (i.e. 10th) character of the STRING variable to zero.

cobra1
Posts: 175
Joined: Thu Feb 04, 2010 7:44 am
Has thanked: 3 times
Been thanked: 3 times
Contact:

Re: String Query

Post by cobra1 »

How do I send 0 through hyperterminal?

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

Re: String Query

Post by Steve »

If I understand correctly, the CR character signifies the end of the string when you send it. In this case, Flowcode should add the NULL character to the end of the string when the CR is received.

cobra1
Posts: 175
Joined: Thu Feb 04, 2010 7:44 am
Has thanked: 3 times
Been thanked: 3 times
Contact:

Re: String Query

Post by cobra1 »

Ahh I get what you mean now. I will try it when I get home from work and let you know if it works

cobra1
Posts: 175
Joined: Thu Feb 04, 2010 7:44 am
Has thanked: 3 times
Been thanked: 3 times
Contact:

Re: String Query

Post by cobra1 »

Hi

Filling the rest of the array with zeros works a treat, i can carry on now lol

Post Reply