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

AsString – atoi()

Converts a character string into a DINT value

Call syntax (Automation Basic)

z = atoi(adr(Str))

 

Parameters

I/OParameterData typeDescription
IN pStringUDINT (given as a pointer to STRING)Address of character string to be converted
OUT zDINTNumerical value of character string

 


Code example (Init-Sp)

(* init program *)

strcpy(ADR(str), ADR(‘123’));

int_read_value := atoi(ADR(str));   (*get int_value from the string*)

 

Variable declaration

NameData typeScope
int_read_valueUDINTLocal
strSTRING[4]Local