User Tools

Site Tools


en-us_products:mpino_studio2:box_functions:arithmetic:scale

SCALE Box Function

Scale (Linear Interpolation)

Category: Arithmetic Box Functions

Behavior

Linearly maps an integer from an input range to an integer output range. Values outside the input range are limited to the nearest boundary; equal IN_MIN and IN_MAX stores OUT_MIN.

Syntax and Arguments

Syntax: SCALE D0 0 1023 R0 0 100

  • 1st = input: address or constant to convert
  • 2nd = input minimum
  • 3rd = input maximum
  • 4th = destination: address that stores the output
  • 5th = output minimum
  • 6th = output maximum

Behavior Example

Run condition Before Command entered Expected result
Left condition ON D0=1023 SCALE D0 0 1023 R0 0 100 R0=100.0

Inputs and results for Arithmetic Box Functions

Cautions

  • Make sure the result stays within the value range of the destination memory.
  • If IN_MIN equals IN_MAX, OUT_MIN is stored. Check the minimum and maximum of the input range.

Box Functions in the Same Category

en-us_products/mpino_studio2/box_functions/arithmetic/scale.txt · Last modified: by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki