Declare enumerations outside Object Organizer?

astrand
2013-02-01
2020-09-13
  • astrand

    astrand - 2013-02-01

    The Codesys manual states: "Enumeration values are recognized in all areas of the project even if they were declared within a
    POU. It is best to create your enumerations as objects in the Object Organizer under the register card Data types."

    But how would you do if you want to create the enumerations outside the Object Organizer? What kind of POU can hold TYPE/Enumerations? And where to put them?

     
  • astrand

    astrand - 2014-10-23

    Bump. No-one knows?

     
  • shooter

    shooter - 2014-10-28

    You can not write a POU outside the organizer, so why should you need to make a enumeration outside it?

    You can use libraries thou.

     
  • astrand

    astrand - 2014-10-28

    No, that's not what I mean. I want to define an enum inside a POU (for example a function block). The documentation states that this should be possible, but still this does not work for me. The only way that works is to define ENUMS under the tab "Data types".

    Br,
    Peter

     
  • shooter

    shooter - 2014-10-28

    I can not find what you say in the docs, however i can find a story about subranges, but TYPE can only be used in the datatypes tab. You can make a subrange in a POU, but enumeration is not direct possible.

    You can make variables a value like
    red:=0
    orange:=1
    green:=10;
    what would you like to make?
    an enumeration is just making a variable a constant value just like a global is doing.
    if you do it inside a POU the variable can only be used inside this pou as it is a local one.

     
  • astrand

    astrand - 2014-10-28

    shooter hat geschrieben:
    I can not find what you say in the docs, however i can find a story about subranges, but TYPE can only be used in the datatypes tab.

    The statement is in the "User Manual for PLC Programming with CoDeSys 2.3", Document Version 6.0, CoDeSys V.2.3.9.2, page 335, 10-35.

    Br,
    Peter

     
  • shooter

    shooter - 2014-10-28

    can you please send this manual version as page 335 is inside libraries in my manual, manuals are written for specific machines like beckhoff, wago schneider.
    i prefer using wetransfer.
    I do not have all manuals of all versions.

     
  • shooter

    shooter - 2014-10-28

    aha you mean this line:

    Enumeration values are recognized in all areas of the project even if they were declared within a
    POU. It is best to create your enumerations as objects in the Object Organizer under the register card

    You read it a little too strict. They will always be global, wherever you declare them.
    i can not put type in a varlist
    why would you do it?
    i will put it in the checklist to codesys

     
  • bamia

    bamia - 2020-09-13

    All the answers here did not in any way address the question.

     

Log in to post a comment.