Let's write a User Defined Function Block.

In our last lesson, we scaled a 4-20mA signal but our signal could go out of the 4-20mA range. We are going to make a UDFB to limit the range of our 4-20mA signal and adjust it if it is out of range.

Note, in Studio 5000 and RsLogix 500, these are called Add On Instructions AOI.