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

AsString – ftoa()

Converts a REAL value into a character string

 

Call syntax (Automation Basic)

z = atof(adr(Str))

 

Parameters

I/OParameterData typeDescription
IN valueREALREAL (FLOAT) value to be converted into a character string
IN pStringUDINT (given as a pointer to STRING)Address of destination character string
OUT lengthUINTLength of character string produced

Code example (Init-Sp)

(* init program *)

float_value := 10.0; (*initialize write – value*)

float_len := ftoa(float_value,ADR(str)); (*write float value to the string*)

Variable declaration

NameData typeScope
float_lenUINTLocal
float_valueREALLocal
strSTRING[4]Local