B&R – PLC – Structured Text – AsString – atof()

AsString – atof()

Converts a character string into a REAL (FLOAT) value


Call syntax (Automation Basic)

z = atof(adr(Str))


I/OParameterData typeDescription
IN pStringUDINT (given as a pointer to STRING)Address of character string to be converted
OUT zREALNumerical 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

NameData typeScope