This documentation is out of date.

The new version of the documentation is here: https://cannylogic.com/docs

Map

From CANNY Wiki
Jump to: navigation, search
Appearance
5 10 7 2.png
Symbol
MAP
Group
Converters
Inputs
Value: Integer
Value from: Integer
Value to: Integer
Result from: Integer
Result to: Integer
Outputs
Result: Integer
Version CANNY Lab
from 1.18
Icon

Re-maps a number from one range to another using linear interpolation method.

For the mathematically inclined, here's the whole formula:

5 10 7 1a.png


The Map function block uses integer math so will not generate fractions. Fractional remainders are truncated, and are not rounded or averaged.

If the denominator of a fraction in above formula is zero, the Result is equal to 65535

Does not constrain values to within the range, because out-of-range values are sometimes intended and useful.

Features

You can use the Map function block to map an analog input value, which ranges from 0 to 4095 to a voltage value, which ranges from 0 - 5000 millivolts.

Examples

ADC value to millivolts

See Also

Converter 8-to-1

Converter 16-to-1

Converter 1-to-8

Converter 1-to-16

ASCII to Integer

Integer to ASCII

Built-in Function Blocks