How to check whether one input is assigned a value?

andy2008
2008-01-15
2008-01-15
  • andy2008 - 2008-01-15

    Hi, everyone,

    I have a function block with 3 inputs (IN1,IN2,IN3), but sometimes I call the function just with input of IN1, or IN2?

    For example: FB(IN1:=XX) or FB(IN2:=XX) or FB(IN1:=XX,IN2:=XX) etc.

    How can I know which input is assigned when the function block is called?

    Many thanks,

     
  • hugo - 2008-01-15

    you cannot, because the variables stay in memory and the value is going to be what it was the last time.

    i was looking for something like this and my solution was the following:

    1. a default value outside the range of a normal value would show that the variable had not been set. this input value could then be overwritten anytime the function is called and you would know if the input was assigned or not.

    for example: and input in1 with the range of 0..100 as value range

    the function block itself has to make sure the input is always at a value outside the defined input range then it can decide if the input valkue has been set or not

    var_input

    in1 : real;

    end_var

    in in1 <= 100 then

    input := in1

    end_if;

    in1 := 99999;

     

Log in to post a comment.