Strings

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

Moderators: Benj, Mods

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

Re: Strings

Post by medelec35 »

Hi Brian,
There is a int to string function within the functions of String Manipulation macro
int to string.png
(57.23 KiB) Downloaded 14466 times
See attached Flowchart.
Attachments
int_to_string.fcf
(3 KiB) Downloaded 1285 times
Martin

User avatar
jollybv
Flowcode v5 User
Posts: 376
Joined: Thu Feb 12, 2009 5:20 am
Location: Cape Town
Has thanked: 81 times
Been thanked: 25 times

Re: Strings

Post by jollybv »

Hey guys

Dont worry found out how to do it :P

User avatar
jollybv
Flowcode v5 User
Posts: 376
Joined: Thu Feb 12, 2009 5:20 am
Location: Cape Town
Has thanked: 81 times
Been thanked: 25 times

Re: Strings

Post by jollybv »

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: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Strings

Post by Benj »

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

Re: Strings

Post by Spanish_dude »

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: 376
Joined: Thu Feb 12, 2009 5:20 am
Location: Cape Town
Has thanked: 81 times
Been thanked: 25 times

Re: Strings

Post by jollybv »

jollybv wrote:Hi Guys

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

Brian

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

Re: Strings

Post by medelec35 »

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

User avatar
jollybv
Flowcode v5 User
Posts: 376
Joined: Thu Feb 12, 2009 5:20 am
Location: Cape Town
Has thanked: 81 times
Been thanked: 25 times

Re: Strings

Post by jollybv »

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 1197 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

Re: Strings

Post by Enamul »

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 1222 times
Enamul
University of Nottingham
enamul4mm@gmail.com

User avatar
jollybv
Flowcode v5 User
Posts: 376
Joined: Thu Feb 12, 2009 5:20 am
Location: Cape Town
Has thanked: 81 times
Been thanked: 25 times

Re: Strings

Post by jollybv »

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

Re: Strings

Post by Enamul »

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

User avatar
jollybv
Flowcode v5 User
Posts: 376
Joined: Thu Feb 12, 2009 5:20 am
Location: Cape Town
Has thanked: 81 times
Been thanked: 25 times

Re: Strings

Post by jollybv »

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

Post Reply