Upon the occurrence of an event at the
REQ
input of an instance of this simple function block type, the ANALOG_DATA values of the
IN1
and
IN2
variables are added together and the result is limited to the
subrange
{-4095..4095}
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:
- The initial situation before clicking the REQ button.
- The situation after clicking the REQ button. The
empty string is not a valid value for the
ANALOG_DATAdata type, so the default initial value of-4095is used for both theIN1andIN2inputs, and the sum (-8190) is then limited to the lower bound to give anOUTvalue of-4095. - The situation after entering a value of
4095for theIN1input and clicking the REQ button. The initial value of-4095continues to be used for theIN2input, giving anOUTvalue of0. - The situation after entering a value of
1for theIN2input and clicking the REQ button. The sum (4096) is now limited to the upper bound to give anOUTvalue of4095. - The situation after entering a value of
-5000for theIN1input and clicking the REQ button. TheIN1input is automatically limited to the lower bound of-4095, and the resulting sum is now-4094.