Create Array and Get Array in 800xA Control Builder Programming
I am trying to create an array of String. "new" is a structured datatype of strings. Also using Get array I am trying to read the value one at a time and use this string value as a message for my Alarm Cond Block.
Please let me know where might be the errors. I am getting Status = -1 for CreateArray and Status = -6 for GetArray.
Answers
Try to create array in first scan, either place CreateArray code in '_start' code or in follwoing if else statement.
Where FirstScan has initial value as True.
If FirstScan then
FirstScan: = false;
CreateArray(MyArray, 1, 20, InputElement, Status);
end_if;
Try to follow online help
The "CreateArray" call should only execute ONCE, at Warm Start.
On a general note ... Arrays of strings are likely to be a terrible waste of memory. And string handling in an AC800M is quite inefficient. Try to hold messages like this in Project Constants and reuse them as much as possible (Project Constants are only held in one single location in memory and are much more efficient when sharing common values). Avoid doing calulations and parsing on String values if at all possible.
Add new comment