This documentation is out of date.

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

Difference between revisions of "Map"

From CANNY Wiki
Jump to: navigation, search
[unchecked revision][unchecked revision]
(Created page with " <div style="float:right;margin:5px;"> {|class="cannytable" width="350px" |- !colspan="2" style="background-color:#AFEEEE;"|Appearance |- |colspan="2" align="center" style="...")
 
 
Line 50: Line 50:
  
 
<div>
 
<div>
Отображает (масштабирует) значение из диапазона значений в результат из диапазона результатов методом '''[https://en.wikipedia.org/wiki/Linear_interpolation linear interpolation]'''.<br clear="left">
+
Re-maps a number from one range to another using '''[https://en.wikipedia.org/wiki/Linear_interpolation linear interpolation]''' method.<br clear="left">
 
</div>
 
</div>
  
 
<div>
 
<div>
Расчет результата выполняется по формуле:
+
For the mathematically inclined, here's the whole formula:
  
 
[[File:5_10_7_1a.png]]
 
[[File: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.
  
При знаменателе равном нулю, значение на выходе блока будет равно 65535
+
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.
  
 
</div>
 
</div>
Line 70: Line 70:
  
 
== Features ==
 
== 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 ==
 
== Examples ==
 
{|
 
{|
 
|-
 
|-
|[[File:5_10_7_3.png|thumb|Отображение значения 12-битного 5В АЦП в соответствующую ему величину напряжения в милливольтах]]
+
|[[File:5_10_7_3.png|thumb|ADC value to millivolts]]
 
|}
 
|}
  
== Смотри также ==
+
== See Also ==
 
[[Converter 8-to-1]]
 
[[Converter 8-to-1]]
  

Latest revision as of 17:05, 15 April 2016

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