Component: Map Function (Calculation): Difference between revisions
Appearance
No edit summary |
m Text replacement - "width="90%" style="background-color:#D8C9D8; color:#4B008D;"" to "width="90%" class="mtx-class-macrohead"" |
||
| (9 intermediate revisions by 3 users not shown) | |||
| Line 14: | Line 14: | ||
==Map Function component== | ==Map Function component== | ||
The map function is intended to change one range of values into another range of values. For example. Output from a temperature sensor is in centigrade. you can map it to give the result in Fahrenheit. To do that set: InMin to 0, InMax 100, OutMin to 32 & OutMax to 212 | The map function is intended to change one range of values into another range of values. For example. Output from a temperature sensor is in centigrade. you can map it to give the result in Fahrenheit. To do that set: InMin to 0, InMax 100, OutMin to 32 & OutMax to 212 | ||
==Detailed description== | ==Detailed description== | ||
| Line 37: | Line 31: | ||
==Examples== | ==Examples== | ||
A simple example showing how to take a value from an adc input with the range 0-255 and mapping this to a predetermined range of 50-150 to drive a PWM output. | |||
{{Fcfile|MappingADCtoPWM.fcfx|Mapping ADC to PWM}} | |||
==Macro reference== | ==Macro reference== | ||
===MapByte=== | ===MapByte=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''MapByte''' | ||
|- | |- | ||
| colspan="2" | Map function for byte type variables | | colspan="2" | Map function for byte type variables | ||
| Line 102: | Line 82: | ||
===MapFloat=== | ===MapFloat=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''MapFloat''' | ||
|- | |- | ||
| colspan="2" | Map function for floating point type variables | | colspan="2" | Map function for floating point type variables | ||
| Line 146: | Line 126: | ||
===MapInt=== | ===MapInt=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''MapInt''' | ||
|- | |- | ||
| colspan="2" | Map function for signed int type variables | | colspan="2" | Map function for signed int type variables | ||
| Line 190: | Line 170: | ||
===MapLong=== | ===MapLong=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''MapLong''' | ||
|- | |- | ||
| colspan="2" | Map function for signed long type variables | | colspan="2" | Map function for signed long type variables | ||
| Line 234: | Line 214: | ||
===MapUInt=== | ===MapUInt=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''MapUInt''' | ||
|- | |- | ||
| colspan="2" | Map function for unsigned int type variables | | colspan="2" | Map function for unsigned int type variables | ||
| Line 278: | Line 258: | ||
===MapUlong=== | ===MapUlong=== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''MapUlong''' | ||
|- | |- | ||
| colspan="2" | Map function for unsigned long type variables | | colspan="2" | Map function for unsigned long type variables | ||
| Line 319: | Line 299: | ||
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
|} | |} | ||
==Property reference== | ==Property reference== | ||
{| class="wikitable | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-prop-icon.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''Properties''' | ||
|- | |- | ||
|} | |} | ||
==Component Source Code== | |||
Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/FC_Comp_Source_Map-Function.fcfx FC_Comp_Source_Map-Function.fcfx] | |||
Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_Map-Function.fcfx FC_Comp_Source_Map-Function.fcfx] | |||
Latest revision as of 14:23, 13 July 2026
| Author | medelec35 |
| Version | 2.0 |
| Category | Calculation |
Map Function component
The map function is intended to change one range of values into another range of values. For example. Output from a temperature sensor is in centigrade. you can map it to give the result in Fahrenheit. To do that set: InMin to 0, InMax 100, OutMin to 32 & OutMax to 212
Detailed description
No detailed description exists yet for this component
Examples
A simple example showing how to take a value from an adc input with the range 0-255 and mapping this to a predetermined range of 50-150 to drive a PWM output.
Macro reference
MapByte
MapFloat
MapInt
MapLong
MapUInt
MapUlong
Property reference
| Properties |
Component Source Code
Please click here to download the component source project: FC_Comp_Source_Map-Function.fcfx
Please click here to view the component source code (Beta): FC_Comp_Source_Map-Function.fcfx