Strings

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

Moderators: Benj, Mods

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8440
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2412 times
Been thanked: 3451 times
Contact:

Re: Strings

Postby medelec35 » Wed Feb 23, 2011 5:47 pm

Hi Brian,
There is a int to string function within the functions of String Manipulation macro
int to string.png
int to string.png (57.23 KiB) Viewed 13205 times

See attached Flowchart.
Attachments
int_to_string.fcf
(3 KiB) Downloaded 973 times
These users thanked the author medelec35 for the post:
jollybv (Fri Feb 25, 2011 5:55 am)
Rating: 5.26%
 
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

User avatar
jollybv
Flowcode v5 User
Posts: 342
Joined: Thu Feb 12, 2009 5:20 am
Has thanked: 77 times
Been thanked: 24 times
Contact:

Re: Strings

Postby jollybv » Wed Feb 23, 2011 6:37 pm

Hey guys

Dont worry found out how to do it :P

User avatar
jollybv
Flowcode v5 User
Posts: 342
Joined: Thu Feb 12, 2009 5:20 am
Has thanked: 77 times
Been thanked: 24 times
Contact:

Re: Strings

Postby jollybv » Fri Feb 25, 2011 5:37 am

Hi Guys

One quick thing i am trying to use the (receive string) component and it keeps giving me an error "The index you entered is outside the limits of the array"
nTimeout(BYTE),NumBytes(BYTE) = 50,4 and string Var= string[4] what am i typing in wrong??? Could you also please explain what I'm doing wrong as i go into properties in FlowCode 4 click on the RS232 component then click on help and nothing comes up. maybe i to new to flowcod 4 or just being stupid

Brian

User avatar
Benj
Matrix Staff
Posts: 14371
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4447 times
Been thanked: 4150 times
Contact:

Re: Strings

Postby Benj » Fri Feb 25, 2011 9:52 am

Hello Brian,

Please can you post our Flowcode program and I will have a look for you.

To get help working on Windows 7 or Vista you need to follow this FAQ topic.
http://www.matrixmultimedia.com/support ... f=31&t=606

Spanish_dude
Posts: 594
Joined: Thu Sep 17, 2009 7:52 am
Location: Belgium
Has thanked: 63 times
Been thanked: 102 times
Contact:

Re: Strings

Postby Spanish_dude » Fri Feb 25, 2011 3:39 pm

This error happens when you go "outside the limits of the array". A little example will explain it all:

Code: Select all

char some_string[10] = {0};

Okay, so I declared a string/array of 10 characters.
The index of the array starts at 0 and goes up to 9, so if you do something like :

Code: Select all

some_string[10] = 'A';

This will give you an error "outside the limits of the array", as 10 (and higher) isn't a right index to write into the array.
You are trying to access some memory that isn't initialized (so the value of it is a random number from 0 to 255) and this could give you some weird behaviors, if executed.

User avatar
jollybv
Flowcode v5 User
Posts: 342
Joined: Thu Feb 12, 2009 5:20 am
Has thanked: 77 times
Been thanked: 24 times
Contact:

Re: Strings

Postby jollybv » Tue Mar 22, 2011 5:45 am

jollybv wrote:Hi Guys

Is there anyone out there who can show me how turn an "Int" back into a "string"

Brian

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8440
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2412 times
Been thanked: 3451 times
Contact:

Re: Strings

Postby medelec35 » Tue Mar 22, 2011 8:06 am

Hi Brian,
With Flowcode V3 or Flowcode V4, the 6th post up shows you how to convert a int to a string.
Did that not work for you?

Martin
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

User avatar
jollybv
Flowcode v5 User
Posts: 342
Joined: Thu Feb 12, 2009 5:20 am
Has thanked: 77 times
Been thanked: 24 times
Contact:

Re: Strings

Postby jollybv » Thu Jul 12, 2012 5:55 pm

Hi guys

I am having a small problem with Interrupts and strings i have attached a small demo to show, in the main program i enable the interrupt THR0 and tell it to call a Macro that has a receive char in it it is looking for Char ^ (94) so when it sees this char it must jump in and out of setup which all works, now my problem is if I send a string say for example 001 the receive char in the interrupt gets the first 0 and the receive string gets 01 could you please tell me if there is a better way of doing this or how to sole this problem

Brian
Attachments
Test Interupts.fcf
(10 KiB) Downloaded 856 times

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: Strings

Postby Enamul » Sat Jul 14, 2012 3:24 am

Hi Brian,
in the main program i enable the interrupt TMR0 and tell it to call a Macro that has a receive char in it it is looking for Char ^ (94) so when it sees this char it must jump in and out of setup which all works, now my problem is if I send a string say for example 001 the receive char in the interrupt gets the first 0 and the receive string gets 01

This is happening because you are using TMR0 for interrupt which triggers very fast so when you are trying to read "^", then it works fine but when you try to read "001", reading this three strings takes time by this time TMR0 triggers as well that's why you are getting the result.

I have modified your code and remove TMR0 to avoid the problem...you can now check whether it works or not..

Enamul
Attachments
Test Interupts.fcf
(9 KiB) Downloaded 884 times
These users thanked the author Enamul for the post:
jollybv (Sat Jul 14, 2012 8:14 am)
Rating: 5.26%
 
Enamul
University of Nottingham
enamul4mm@gmail.com

User avatar
jollybv
Flowcode v5 User
Posts: 342
Joined: Thu Feb 12, 2009 5:20 am
Has thanked: 77 times
Been thanked: 24 times
Contact:

Re: Strings

Postby jollybv » Sat Jul 14, 2012 7:58 am

Enamul wrote:Hi Brian,
in the main program i enable the interrupt TMR0 and tell it to call a Macro that has a receive char in it it is looking for Char ^ (94) so when it sees this char it must jump in and out of setup which all works, now my problem is if I send a string say for example 001 the receive char in the interrupt gets the first 0 and the receive string gets 01

This is happening because you are using TMR0 for interrupt which triggers very fast so when you are trying to read "^", then it works fine but when you try to read "001", reading this three strings takes time by this time TMR0 triggers as well that's why you are getting the result.

I have modified your code and remove TMR0 to avoid the problem...you can now check whether it works or not..

Enamul


Thanks Enamul

This simple bit of code will help me tremendously as I have been battling for over a week to do this

Brian

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: Strings

Postby Enamul » Sat Jul 14, 2012 10:47 am

It's nice to hear that the code helped you. :)
Enamul
University of Nottingham
enamul4mm@gmail.com

User avatar
jollybv
Flowcode v5 User
Posts: 342
Joined: Thu Feb 12, 2009 5:20 am
Has thanked: 77 times
Been thanked: 24 times
Contact:

Re: Strings

Postby jollybv » Fri Oct 30, 2015 11:32 am

Hi Guys

I was wondering would like to work out the length of a certain value in a string e.g. I have a long string and in side is this value Airtime balance is R0.00. " 15 and then lots of nonsense after it. This can change to Airtime balance is R1999.00 or anything inbetween. I would like to no if i can work out the length of the R0.00 or R1999.00 in the string so that i can do string manipulation on it