FUNCTION_BLOCK ADD_FREQ

Upon the occurrence of an event at the REQ input of an instance of this simple function block type, the values of the IN1 and IN2 variables are added together to produce the value of the OUT variable, and an event is produced at the CNF output.

The operation of an instance of this FB type is illustrated below, using the Run option of the FBDK:

  1. The initial situation before clicking the REQ button.
  2. The situation after clicking the REQ button. The empty string is not a valid value for the FREQ data type, so the initial value of 50.0 is used for both the IN1 and IN2 inputs, giving an OUT value of 100.0.
  3. The situation after entering a value of 25 for the IN1 input and clicking the REQ button. The initial value of 50.0 continues to be used for the IN2 input, giving an OUT value of 75.0.
  4. The situation after entering a value of 35 for the IN2 input and clicking the REQ button, giving an OUT value of 60.0.
  5. The situation after entering a value of XXX for the IN2 input and clicking the REQ button. Since XXX is not a valid value for the FREQ data type, the previous value (35) is used for this input, giving an OUT value of 60.0.
1
2
3
4
5