Codesys Split String Guide

PROGRAM Main VAR sInput : STRING := "Temperature;Humidity;Pressure"; aOutput : ARRAY[1..3] OF STRING(25); iCount : DINT; iResult : DINT; END_VAR // Split the string using semicolon as delimiter iResult := StrSplit(sInput, ';', aOutput, SIZE_OF(aOutput), iCount); // iCount now equals 3 // aOutput[1] = "Temperature"

xDone := TRUE; END_IF

Extract the temperature from "TEMP:23.5 C" . codesys split string

LEAVE A REPLY

Please enter your comment!
Please enter your name here