Crimson 3.1 TexttoInt

gimli

Member
Join Date
Nov 2014
Location
nowhere
Posts
34
Hello,


Looking for some help with the Crimson function TexttoInt.
It seems to be pretty straight up...but maybe im missing something.


Description: Returns the value of string,treating it as a number of base radix. This function is also used together with mid to extract values from strings received from raw serial ports. It can also be used to convert other string values to integers.



Ex: data = TextToInt("1234",10)


So just as a test I set up:


Code:
Data:=
TextToInt("A"),10);
This should return 65 as Ascii code for A but it returns a 0.
If you change the radix to 128 it returns a 10. So it seems
like its trying to do something...not sure what.



Any help would be greatly appreciated :)
 
I believe text to integer should only be used on ASCII numbers the radix is the key to what it does, try texttoint("1234",10), you will find it turns it to an integer, putting a alphabetical char will return 0 at a radix of 10, it is not possible to use a string to integer function to return a characters decimal equivalent. ASC function is the one to return it's decimal value but I do not think it is a function in Crimson.
 
I think you are getting a bit confused with this. In the example that RedLion give it would convert an ASCII Text "1234" to an Integer value of 1234. It doesn't return the ASCII code value of the input figure.
 
If you want to see the ASCII code rather than the Text character you don't need to do a conversion. I have some settings for a data logger and it helps to be able to see both the ASCII code and character. I define two Tags, one of type Integer and one of type String, both with the same memory address in the PLC. They both read the same data but display it differently.
 

Similar Topics

Hey guys, hoping someone here could give me a little advice. I'm working with a CR1000-04000 in Crimson 3.1 and I was interested in adding the...
Replies
4
Views
117
Hi, I'm having an issue in crimson 3.0 when I create a programme using a case statement referencing a fault word that each bit needs to change the...
Replies
4
Views
191
How do you install update on Red Lion Crimson ver 3.1. Do I just need to run the exe file on the host server?
Replies
1
Views
107
Has anyone found a way to convert/replace/update the firmware on old Parker TS80xx series HMIs (i.e. TS8010, TS8006, etc) to accept Crimson...
Replies
0
Views
91
Has anyone setup communications with Red Lion 3.0 MODBUS to Baker Hughes Centrilift GCS VFD? Thanks
Replies
0
Views
89
Back
Top Bottom