Strings
-
- 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
Hi Brian,
There is a int to string function within the functions of String Manipulation macro See attached Flowchart.
There is a int to string function within the functions of String Manipulation macro See attached Flowchart.
- Attachments
-
- int_to_string.fcf
- (3 KiB) Downloaded 1285 times
Martin
- 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
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
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
- 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
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
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
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
-
- Posts: 594
- Joined: Thu Sep 17, 2009 7:52 am
- Location: Belgium
- Has thanked: 63 times
- Been thanked: 102 times
Re: Strings
This error happens when you go "outside the limits of the array". A little example will explain it all:
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 :
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.
Code: Select all
char some_string[10] = {0};
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';
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.
-
- 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
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
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
- 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
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
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
- Enamul
- Posts: 1772
- Joined: Mon Mar 05, 2012 11:34 pm
- Location: Nottingham, UK
- Has thanked: 271 times
- Been thanked: 814 times
Re: Strings
Hi Brian,
I have modified your code and remove TMR0 to avoid the problem...you can now check whether it works or not..
Enamul
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.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
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
- 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
Thanks EnamulEnamul wrote:Hi Brian,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.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
I have modified your code and remove TMR0 to avoid the problem...you can now check whether it works or not..
Enamul
This simple bit of code will help me tremendously as I have been battling for over a week to do this
Brian
- Enamul
- Posts: 1772
- Joined: Mon Mar 05, 2012 11:34 pm
- Location: Nottingham, UK
- Has thanked: 271 times
- Been thanked: 814 times
- 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
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
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