×

Subscribe to newsletter

subscribe to our weekly newsletter to get notified with latest story and article Subscribe now!




PLC BLOG | B&R Automation | Limit Function | B&R Automation Studio Limit Instruction example in ANSI C
Share on Facebook Share On Twitter Share on LinkedIn Share on Whatsapp


B&R Automation Studio Limit Instruction example in ANSI C

Limit Instruction in a PLC limit input value to specified maximum and minimum range. we can LIMIT instructions in ladder. in ANSI we create a limit function because ANSI Don't have limit instructions. so i am creating a simple limit instructions example. we can discuss more what is function in ANSI. we create a limit function with the help of conditional statement (if else). limit function that limits a value between a minimum and maximum range so first we create a Limit function.

create a limit function in ANSI C

create a limit function in ANSI C

In the above example, limit function takes three input arguments
    input arguments
  • Minimim_value: minimum value to limit the output
  • Maximum_value: Maximum value to limit the output.
  • Input_value: input value of limit instruction. limit operation perform on this value.
inside the The function checks we check range by conditional statement. if the value is less than minimum value than minimum value return as output value if the input value is greater than maximum value than maximum return the maximum value. Otherwise, input value return as output value.


Call limit Function in a main program

Call limit Function in a main program

now we call a limit function in main program and pass function parameter by new variable or constant value. if the input value within the range of maximum and minimum range then output is equal to input value. for example if the maximum value is 12.30 and minimum value is 1.0 so output of limit instruction is not greater then 12.3 and not less then 1.0. if the input value is greater then 12.30 then output is 12.30 and if the input value is less then 1.0 so the output is set to 1.0. in this program we all real data type.


limit Function With constant Value

limit Function With constant Value

we can use same limit function multiple time so we in second line of program we use limit function for a constant value. in this declaration we pass constant value as function arguments.12.0 is minimum range, 98.0 is maximum value and 13.0 is a input value. limit instruction in ladder and Structured Text visit link


Share on Facebook Share On Twitter Share on LinkedIn Share on Whatsapp


Suggested Post


 
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

comment