Conversion from String to Number in Control Builder M Program with ST or IL or SFC or FBD or LD
I am a ABB 800xA user and I need to convert String to Number:
I have a weight measurement device that gives the weight of objects in string type (for example 357.125 but in string datatype). I wanted this to be readable for system as number. I dont know how to code this conversion or, is there any block or whatever, available in ABB system.
NOTE: weight of the object is continuously changing
In another software this is happening with the code below:
Start=Timer (*to start the timer as the weight is changing*)
DO WHILE Timer < Start + PauseTime
Buffer$ = MSComm1.Input
DecimalPoint = InStr (Buffer$, ".") (*to find the decimal point*)
IF DecimalPoint = 11 THEN
BeforePoint = Mid (Buffer$, 4, DecimalPoint - 4) (*catch 4 numbers before decimal*)
AfterPoint = Mid (Buffer$, DecimalPoint + 1, 1) (*catch 1 number after decimal*)
Buffer$ = BeforePoint & "." & AfterPoint (*building the number*)
Buffer$ = Trim(Buffer$)
Text1.Text = Buffer$ (*putting our numeric buffer to text space*)
Text1.Text = -100000
So the idea here is that find the decimal in the text (which is a number) then take 4 and 1 number before and after respectively and building the number around the dot
how can I have the similar code?
With appreciations in Advance.
Insert the URL that your highlighted text will link to.
Copy the video's "embed" tag into Embedded Video below.