Analog Scaling PLC Program by using FC105 &106
In program object, in the left Panel expand library Standard Library TI-S7 Converting Block and select FC105 for scale the analog input. FC105 is a function in Simatic that can convert analog data.
FC105 reads the integer value for analog input stored in PIW256 parameter IN. For this example, the state of M 1.1 parameter BIPOLAR determines whether the input value is bipolar or unipolar.Because the value of M 1.1 is 0, FC105 processes the analog input as a unipolar number 0 to 27648. FC105 converts the integer value to a Real number, FC105 scales the Real number to a value between 0.00 parameter LO_LIM and 100.00 parameter HI_LIM. If the function is executed without error, FC105 sets the RET_VAL MW2 to W#16#0000 hexadecimal.If the input integer value is greater than 27648 or less than 0, FC105sets the output OUT to 100.00 HI_LIM or 0.00 LO_LIM,respectively. FC105 also returns an error by setting the RET_VAL to W#16#0008 hexadecimal.FC105 stores the scaled value in MD4 parameter OUT.
Add FC106 UNSCALE CONVERT
And Add FC 106 from standard library
FC106 reads real number stored in memory MD4.Same with FC 105, the state of M 1.1 parameter BIPOLAR determines whether the input value is bipolar or unipolar.Because the value of M 1.1 is 0, FC106 processes the analog input as unipolar number 0 to 27648.FC106 converts the Real number that is scaled between 0.00(parameter LO_LIM and 100.00 parameter HI_LIM. If the function is executed without error, FC106 sets the RET_VAL MW4 to W#16#0000 hexadecimal.If the input integer value is greater than 400 HI_LIM or less than 0 LO_LIM, FC106sets the output (OUT) to 27648 or 0.00, respectively. FC106 also returns an error by setting the RET_VAL to W#16#0008 hexadecimal.FC106 stores the integer value in PQW272 parameter OUT
27 янв 2018