AsString – atof()
Converts a character string into a REAL (FLOAT) value
Call syntax (Automation Basic)
z = atof(adr(Str))
I/O | Parameter | Data type | Description |
---|---|---|---|
IN | pString | UDINT (given as a pointer to STRING) | Address of character string to be converted |
OUT | z | REAL | Numerical value of character string |
Code example (Init-Sp)
(* init program *)
strcpy(ADR(str), ADR(‘123’));
float_read_value := atof(ADR(str)); (*get float_value from the string*)
Variable declaration
Name | Data type | Scope |
---|---|---|
float_read_value | REAL | Local |
str | STRING[4] | Local |