X3:=X3+1; is part of your issue. a FOR loop automatically increments your loop variable. //====================Write Tool Numbers X3 ================= FOR X3:=42 TO 60 DO Base1Index := X3-41; IF DbAutomatic.PosX3.Index = 3 THEN // looks missplaced or missing array reference ? (I would put this ahead of for loop) IF DbAutomatic.PosX3.Status[Base1Index] THEN DbAutomatic.PosX3.ToolNumber[Base1Index]:=X3; DbAutomatic.AllTools[X3].Number:=X3; // This is weird (copying your own index ? I would expect Base1Index)...
Not really a 1:1 feature, but there are those 2 : AT keyword, used to "alias" an I/O or memory (I,Q and M) https://help.codesys.com/webapp/_cds_at_declaration;product=codesys;version=184.108.40.206 UNION datatype, allows you to interpret the same RAW data with different datatypes https://help.codesys.com/webapp/_cds_datatype_union;product=codesys;version=220.127.116.11
I don't know about general purpose variable writing, but you should have a look at the forums. Already saw a post trying to get values from a file (like JSON does) For specific purposes and few variables, you may do it in 2 steps. 1) Get the variable name and test if it match one expected 2) Convert the value to desired datatype https://help.codesys.com/webapp/_cds_operator_string_to;product=codesys;version=18.104.22.168
How about using a simple ROL on send buffer ? (* Assuming this is a word array buffer *) (* And that you only process it once *) FOR i:=0 TO LastWordIndexInBuffer DO SendBuffer[i] := ROL(SendBuffer[i],8); END_FOR;
How about using a simple ROL on send buffer ? // Assuming this is a word array buffer // And that you only process it once FOR i:=0 TO LastWordIndexInBuffer DO SendBuffer[i] := ROL(SendBuffer[i],8); END_FOR;
If you want to show a program window, you first have to check which is the user starting the program. Because the interface you see here, is for a user and only this one. Althougt that a user may not have an interface at all (system accounts for instance). So I would look at how to start your program with the proper user first.