plctwincatcodesysst

How can define enumerator in Methods?


There is a problem when u define an enum in a method.

I was trying to do this:

VAR
    enumA:(A,B,C);
END_VAR

and there is the compiler reaction when I used this in TwinCAT3 Shell (TcXaeShell). enter image description here

any help would be appreciated.


Solution

  • You can only use global enumerations in methods. It's one of the limitations with local enumerations.

    https://alltwincat.com/2021/11/16/local-enumerations/