Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

⚠️[WARNING] ... is no valid assignment target

2020-11-25
2020-12-08
  • andras-mozes - 2020-11-25

    Hello,

    I would like to ask for some help.

    I get the below warning message.
    [WARNING] v316_plc: DXP [Device: Local_IO]: C0373: 'Application.ST1.xSensorPresence' is no valid assignment target

    I think that it is b/c of I assign a read_only (%IX0.) variable to a VAR_INPUT which has read and write access as well - am I right?

    What should be an appropriate solution?

    Btw, I would like to stick to the so-called array-instantiation of FBs.

    Thanks for your help in advance.

     

    Last edit: andras-mozes 2020-11-25
  • rickj - 2020-12-05

    Where/how is 'Application.ST1.xSensorPresence' defined?

     
    πŸ‘
    1
    • andras-mozes - 2020-12-07

      Hello,

      I/O mapping to global variable, and it is an input.

       
  • rickj - 2020-12-07

    Is 'Application.ST1.xSensorPresence' defined? Is ST1 a GVL? Post a screen cap of where it's defined.

     
  • rickj - 2020-12-07

    Is 'Application.ST1.xSensorPresence' defined? Is ST1 a GVL? Post a screen cap of where it's defined.

     
  • andras-mozes - 2020-12-08

    Here you are. 😊

     
  • aliazzz

    aliazzz - 2020-12-08

    Hi,

    As far as IO mapping goes, I'd steer personally steer clear away from connecting Globals to IO if possible (i.e. when not necessary). Your IO seems to be a part of a (repeatable?) machine. If it is a repeatable machine part, then makes sense to declare an FB (which the contains the repeatable machine code) and instance it and then hook that directly to the IO.

    Good luck

     
    πŸ‘
    1
    • andras-mozes - 2020-12-08

      Hello aliazzz,

      would you mind providing an example.
      I am newbie, but it sounds great and I would like to test it.

      Thanks!

       

      Last edit: andras-mozes 2020-12-08
    • andras-mozes - 2020-12-08

      Hello aliazzz,

      would you mind providing an example.
      I am newbie, but it sounds great and I would like to test it.

      Thanks!

       

      Last edit: andras-mozes 2020-12-08
    • andras-mozes - 2020-12-08

      Hello,

      is it what you are meaning?

       
      πŸ‘
      1
      • aliazzz

        aliazzz - 2020-12-08

        Correct, now you can instanciate multiple FB with the same repeatable code and still connect them to different IO.

         
        πŸ‘
        1
        • andras-mozes - 2020-12-08

          Awesome! 😎

          BTW, is multiple assignment possible?
          I.e. I would like to link the same DXP to 2 different FB objects.

           

          Last edit: andras-mozes 2020-12-08
          • aliazzz

            aliazzz - 2020-12-08

            No, an IO point can only be connected to a single variable. However, you can read from this single variable from several parts in the application. Plus there are other workarounds thinkable to overcome this.

            Just some mock code (example) not to be taken too litteral

            HW_IO.CH1 => Ch1Var // DI Ch1
            
            FB_X.In1 := Ch1Var; // assign to X.1
            FB_Y.In1 := Ch1Var; // assign to Y.1
            FB_Z.In1 := Ch1Var; // assign to Z.1
            
             
            πŸ‘
            1

            Last edit: aliazzz 2020-12-08
            • andras-mozes - 2020-12-08

              I see!

              Thanks.

              BTW, what does 1 mean in In1 mean?

              I have noticed that in FB RS the property of RESET has a suffix like RESET1.

              Thanks for your support.

               

              Last edit: andras-mozes 2020-12-08

Log in to post a comment.