OSCAT Scale_r function not working in LD 4.60 works in LAD2 on 3.5.21sp3

shaunvdm
2025-10-23
17 hours ago
  • shaunvdm - 2025-10-23

    Hi We have picked up an issue
    OSCAT_BASIC.Scale_r function call not working in the old lad and FBD version 4.60.
    Gives no output on the function call. When we convert this to LAD2 it works.

    As can be see by the two screenshot in normal LD not working in LAD2 it works.

    Please confirm if this is an issue with Oscat or with LAD in 3.5.21sp3, is there an workaround.

    Regards

    Shaun

     
  • ph0010421 - 2025-10-23

    Is that rung definitely being executed? Is the POU called?

     
    • shaunvdm - 2025-10-24

      Yes it is called

       
  • TimvH

    TimvH - 2025-10-26

    It seems like a bug in FBD. Work-around:
    If you click on the small line between the box and the output variable and delete this, the variable is removed. When you then assign a variable again (Ctrl-A), then you will see that the line will be a bit longer. If you then select the previous variable, you will see that it works.

     
  • kishan - 2025-10-26

    here is formula for scale function you can impliment your own scale function

    Output=OutMin+(Input−InMin)×(InMax−InMin)(OutMax−OutMin)

    FUNCTION_BLOCK FB_Scale
    VAR_INPUT
    xIn : REAL; // Input value (e.g., raw sensor)
    xInMin : REAL; // Input range minimum
    xInMax : REAL; // Input range maximum
    xOutMin : REAL; // Output range minimum
    xOutMax : REAL; // Output range maximum
    END_VAR

    VAR_OUTPUT
    xOut : REAL; // Scaled output
    END_VAR

    VAR
    xGain : REAL;
    xOffset : REAL;
    END_VAR

    // Implementation
    xGain := (xOutMax - xOutMin) / (xInMax - xInMin);
    xOffset := xOutMin - xGain * xInMin;
    xOut := xGain * xIn + xOffset;

     
  • shaunvdm - 5 days ago

    Hi All,

    We downgraded Codesys LAD/FB in the IDE to version 4.5 and it works. Codesys Version 4.6 lad/fb not working.

    Was the way we fixed this.

    Kind Regards

    Shaun

     
  • AntonZ - 17 hours ago

    That's what I found as well Shaun. I have seen it at least in versions 3.5.21.1 and 3.5.21.3. There seems to be an issue with the FBD/LD package v4.6.0.0. The workaround proposed by Tim works but needs to be done manually on every code change/addition.

    For now we manually downgrade the FBD/LD package from v4.6.0.0 down to v4.5.0.0 after installation of CoDeSys. Same as you did. I hope this gets fixed on a next patch.

     

Log in to post a comment.