FB_ScaleInput - Scaling Analog IO

 Function Block - Converts un-scaled DINT values from Analog Inputs into user units of type LREAL.

Inputs

Input

Data Type

Range

Unit

Default

Description

InputSignal

DINT

0 to 4

N/A

No default

Un-scaled input signal.

InputMin

DINT

0 to 4

N/A

No default

Minimum value of accepted input signal range.

InputMax

DINT

0 to 4

N/A

No default

Maximum value of accepted input signal range.

OutputMin

LREAL

0 to 4

N/A

No default

Output value mapped to the InputMin.

OutputMax

LREAL

0 to 4

N/A

No default

Output value mapped to the InputMax.

Outputs

Output

Data Type

Range

Unit

Description

OutputSignal

LREAL

 

N/A

Scaled value of the Input Signal with type converted to LREAL.

Stays within specified Min/Max output values.

OutsideRange

BOOL

FALSE, TRUE

N/A

TRUE if the InputSignal is outside the range setup by min/max values, otherwise FALSE.

Remarks

  • Scale s DINT to LREAL.
  • The input signal is converted based on a linear mapping automatically calculated by two points entered.
  • InputMin is mapped to OutputMin, InputMax is mapped to OutputMax, and all values in between are scaled automatically.
  • If an input value is not between the selected Min/Max, the Boolean output OutsideRange turns TRUE.
    • The OutputSignal is set to the corresponding OutputMin or OutputMax value.

This image shows the function or function block I/O.

Figure 1: FB_ScaleInput

Usage

Scale an analog signal from a drive.

FBD Language Example

FFLD Language Example

IL Language Example

Not available.

ST Language Example

//Scale an integer based analog input signal into floating point LREAL variable
ScaleInput_1( Analog_In, Analog_In_Min, Analog_In_Max, LREAL_Out_Min, LREAL_Out_Max );
LREAL_OutputSignal:= ScaleInput_1.OutputSignal;
Analog_Range_Err:= ScaleInput_1.OutsideRange;

See Also

FB_ScaleOutput - Scaling Analog IO