|
|
(5 intermediate revisions by the same user not shown) |
Line 15: |
Line 15: |
| A lookup-table component allowing an easy way to place arrays of static data into ROM memory. The LUT data is accessed directly allowing very low overhead when collecting the data. | | A lookup-table component allowing an easy way to place arrays of static data into ROM memory. The LUT data is accessed directly allowing very low overhead when collecting the data. |
| | | |
− | ==Component Source Code== | + | ==Version information== |
| + | |
| + | Library Version, Component Version, Date, Author, Info |
| + | 13, 1.7, 24-07-24, BR, Fixed LUT to allow more then 65535 values to be stored and used by the sim |
| | | |
− | Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/FC_Comp_Source_LUT.fcfx FC_Comp_Source_LUT.fcfx]
| + | ==Detailed description== |
| | | |
− | Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_LUT.fcfx FC_Comp_Source_LUT.fcfx]
| |
| | | |
− | ==Detailed description==
| |
| | | |
| | | |
Line 76: |
Line 77: |
| | | |
| ==Examples== | | ==Examples== |
| + | |
| + | |
| | | |
| | | |
Line 158: |
Line 161: |
| [[File:LUTdata.jpg]] | | [[File:LUTdata.jpg]] |
| | | |
− | ==Macro reference==
| |
| | | |
− | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"
| |
− | |-
| |
− | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| |
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetFloat'''
| |
− | |-
| |
− | | colspan="2" | Gets a float from the LUT
| |
− | |-
| |
− | |-
| |
− | | width="10%" align="center" | [[File:Fc9-u32-icon.png]] - ULONG
| |
− | | width="90%" | Index
| |
− | |-
| |
− | | colspan="2" |
| |
− | |-
| |
− | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-f32-icon.png]] - FLOAT
| |
− | | width="90%" style="border-top: 2px solid #000;" | ''Return''
| |
− | |}
| |
| | | |
| | | |
− | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"
| |
− | |-
| |
− | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| |
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetLUTCount'''
| |
− | |-
| |
− | | colspan="2" | Gets the number of individual data entries stored in the LUT.
| |
− | |-
| |
− | |-
| |
− | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
| |
− | | width="90%" style="border-top: 2px solid #000;" | ''Return''
| |
− | |}
| |
| | | |
| | | |
− | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"
| |
− | |-
| |
− | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| |
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetInt'''
| |
− | |-
| |
− | | colspan="2" | Gets an integer from the LUT
| |
− | |-
| |
− | |-
| |
− | | width="10%" align="center" | [[File:Fc9-u32-icon.png]] - ULONG
| |
− | | width="90%" | Index
| |
− | |-
| |
− | | colspan="2" |
| |
− | |-
| |
− | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u32-icon.png]] - ULONG
| |
− | | width="90%" style="border-top: 2px solid #000;" | ''Return''
| |
− | |}
| |
| | | |
| | | |
| | | |
| | | |
− | ==Property reference==
| |
| | | |
− | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"
| + | ==Macro reference== |
− | |-
| |
− | | width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
| |
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''
| |
− | |-
| |
− | |-
| |
− | | width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
| |
− | | width="90%" | Storage Type
| |
− | |-
| |
− | | colspan="2" | Controls the data type stored by the component.
| |
− | |-
| |
− | | width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
| |
− | | width="90%" | Storage Sign
| |
− | |-
| |
− | | colspan="2" | Controls if the integer numbers are allowed to be negative. Unsigned = Numbers are positive only. Signed = Numbers can be positive and negative.
| |
− | |-
| |
− | | width="10%" align="center" | [[File:Fc9-type-11-icon.png]]
| |
− | | width="90%" | Integers
| |
− | |-
| |
− | | colspan="2" | Comma seperated integer data which is used to create the C code which is inserted into the ROM.
| |
− | |-
| |
− | | width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
| |
− | | width="90%" | Num Values
| |
− | |-
| |
− | | colspan="2" |
| |
− | |-
| |
− | | width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
| |
− | | width="90%" | Embed Into C
| |
− | |-
| |
− | | colspan="2" | Flag to decide if code should be generated to C or not If this is false then the LUT is simulation only
| |
− | |}==Macro reference==
| |
| | | |
| + | ===GetFloat=== |
| {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" |
| |- | | |- |
Line 263: |
Line 192: |
| | | |
| | | |
− | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"
| + | ===GetInt=== |
− | |-
| |
− | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| |
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetLUTCount'''
| |
− | |-
| |
− | | colspan="2" | Gets the number of individual data entries stored in the LUT.
| |
− | |-
| |
− | |-
| |
− | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
| |
− | | width="90%" style="border-top: 2px solid #000;" | ''Return''
| |
− | |}
| |
− | | |
− | | |
| {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" |
| |- | | |- |
Line 294: |
Line 211: |
| | | |
| | | |
− | | + | ===GetLUTCount=== |
− | | |
− | ==Property reference== | |
− | | |
− | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"
| |
− | |-
| |
− | | width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
| |
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''
| |
− | |-
| |
− | |-
| |
− | | width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
| |
− | | width="90%" | Storage Type
| |
− | |-
| |
− | | colspan="2" | Controls the data type stored by the component.
| |
− | |-
| |
− | | width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
| |
− | | width="90%" | Storage Sign
| |
− | |-
| |
− | | colspan="2" | Controls if the integer numbers are allowed to be negative. Unsigned = Numbers are positive only. Signed = Numbers can be positive and negative.
| |
− | |-
| |
− | | width="10%" align="center" | [[File:Fc9-type-11-icon.png]]
| |
− | | width="90%" | Integers
| |
− | |-
| |
− | | colspan="2" | Comma seperated integer data which is used to create the C code which is inserted into the ROM.
| |
− | |-
| |
− | | width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
| |
− | | width="90%" | Num Values
| |
− | |-
| |
− | | colspan="2" |
| |
− | |-
| |
− | | width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
| |
− | | width="90%" | Embed Into C
| |
− | |-
| |
− | | colspan="2" | Flag to decide if code should be generated to C or not If this is false then the LUT is simulation only
| |
− | |}==Macro reference==
| |
− | | |
− | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"
| |
− | |-
| |
− | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| |
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetFloat'''
| |
− | |-
| |
− | | colspan="2" | Gets a float from the LUT
| |
− | |-
| |
− | |-
| |
− | | width="10%" align="center" | [[File:Fc9-u32-icon.png]] - ULONG
| |
− | | width="90%" | Index
| |
− | |-
| |
− | | colspan="2" |
| |
− | |-
| |
− | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-f32-icon.png]] - FLOAT
| |
− | | width="90%" style="border-top: 2px solid #000;" | ''Return''
| |
− | |}
| |
− | | |
− | | |
| {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" |
| |- | | |- |
Line 359: |
Line 223: |
| | width="90%" style="border-top: 2px solid #000;" | ''Return'' | | | width="90%" style="border-top: 2px solid #000;" | ''Return'' |
| |} | | |} |
− |
| |
− |
| |
− | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"
| |
− | |-
| |
− | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| |
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetInt'''
| |
− | |-
| |
− | | colspan="2" | Gets an integer from the LUT
| |
− | |-
| |
− | |-
| |
− | | width="10%" align="center" | [[File:Fc9-u32-icon.png]] - ULONG
| |
− | | width="90%" | Index
| |
− | |-
| |
− | | colspan="2" |
| |
− | |-
| |
− | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u32-icon.png]] - ULONG
| |
− | | width="90%" style="border-top: 2px solid #000;" | ''Return''
| |
− | |}
| |
− |
| |
− |
| |
| | | |
| | | |
Line 388: |
Line 232: |
| | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties''' | | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties''' |
| |- | | |- |
| + | |- |
| + | | width="10%" align="center" | [[File:Fc9-type-7-icon.png]] |
| + | | width="90%" | Enabled |
| + | |- |
| + | | colspan="2" | Determines if the LUT component is active. |
| |- | | |- |
| | width="10%" align="center" | [[File:Fc9-type-16-icon.png]] | | | width="10%" align="center" | [[File:Fc9-type-16-icon.png]] |
Line 413: |
Line 262: |
| |- | | |- |
| | colspan="2" | Flag to decide if code should be generated to C or not If this is false then the LUT is simulation only | | | colspan="2" | Flag to decide if code should be generated to C or not If this is false then the LUT is simulation only |
− | |}==Macro reference==
| |
− |
| |
− | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"
| |
− | |-
| |
− | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| |
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetFloat'''
| |
− | |-
| |
− | | colspan="2" | Gets a float from the LUT
| |
− | |-
| |
− | |-
| |
− | | width="10%" align="center" | [[File:Fc9-u32-icon.png]] - ULONG
| |
− | | width="90%" | Index
| |
− | |-
| |
− | | colspan="2" |
| |
− | |-
| |
− | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-f32-icon.png]] - FLOAT
| |
− | | width="90%" style="border-top: 2px solid #000;" | ''Return''
| |
| |} | | |} |
| | | |
| + | ==Component Source Code== |
| | | |
− | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"
| + | Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/FC_Comp_Source_LUT.fcfx FC_Comp_Source_LUT.fcfx] |
− | |-
| |
− | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| |
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetLUTCount'''
| |
− | |-
| |
− | | colspan="2" | Gets the number of individual data entries stored in the LUT.
| |
− | |-
| |
− | |-
| |
− | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
| |
− | | width="90%" style="border-top: 2px solid #000;" | ''Return''
| |
− | |}
| |
| | | |
− | | + | Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_LUT.fcfx FC_Comp_Source_LUT.fcfx] |
− | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"
| |
− | |-
| |
− | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| |
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetInt'''
| |
− | |-
| |
− | | colspan="2" | Gets an integer from the LUT
| |
− | |-
| |
− | |-
| |
− | | width="10%" align="center" | [[File:Fc9-u32-icon.png]] - ULONG
| |
− | | width="90%" | Index
| |
− | |-
| |
− | | colspan="2" |
| |
− | |-
| |
− | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u32-icon.png]] - ULONG
| |
− | | width="90%" style="border-top: 2px solid #000;" | ''Return''
| |
− | |}
| |
− | | |
− | | |
− | | |
− | | |
− | ==Property reference==
| |
− | | |
− | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"
| |
− | |-
| |
− | | width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
| |
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''
| |
− | |-
| |
− | |-
| |
− | | width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
| |
− | | width="90%" | Storage Type
| |
− | |-
| |
− | | colspan="2" | Controls the data type stored by the component.
| |
− | |-
| |
− | | width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
| |
− | | width="90%" | Storage Sign
| |
− | |-
| |
− | | colspan="2" | Controls if the integer numbers are allowed to be negative. Unsigned = Numbers are positive only. Signed = Numbers can be positive and negative.
| |
− | |-
| |
− | | width="10%" align="center" | [[File:Fc9-type-11-icon.png]]
| |
− | | width="90%" | Integers
| |
− | |-
| |
− | | colspan="2" | Comma seperated integer data which is used to create the C code which is inserted into the ROM.
| |
− | |-
| |
− | | width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
| |
− | | width="90%" | Num Values
| |
− | |-
| |
− | | colspan="2" |
| |
− | |-
| |
− | | width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
| |
− | | width="90%" | Embed Into C
| |
− | |-
| |
− | | colspan="2" | Flag to decide if code should be generated to C or not If this is false then the LUT is simulation only
| |
− | |}
| |
Author
|
Matrix Ltd
|
Version
|
1.7
|
Category
|
Utility
|
Lookup tables component
A lookup-table component allowing an easy way to place arrays of static data into ROM memory. The LUT data is accessed directly allowing very low overhead when collecting the data.
Version information
Library Version, Component Version, Date, Author, Info
13, 1.7, 24-07-24, BR, Fixed LUT to allow more then 65535 values to be stored and used by the sim
Detailed description
No detailed description exists yet for this component
Examples
A look up table component is useful when including data into a program which may not be linear and therefore hard to calculate.
One example of this is a sine wave or working out a temperature based on the resistance of a thermistor.
For a simple example lets say we want to store a sine wave on board the microcontroller.
First of all we use Excel to generate the data for a sine wave to do this we work out the angles in degrees we want to reproduce, then convert the degrees to radians and then generate the Sine wave for the angle. the angle returned will be between -1 and 1 so we need to convert this to fit into the microcontroller's memory. The most efficient way is to store the value as a byte which means scaling up the output to 0 - 255 and removing the real portion of the number to give integer values.
File:SineWaveLUT.xlsx
Then using the file -> Save as menu in Excel we can export the data as a raw .CSV file.
File:SineWaveLUT.csv
The line in the CSV file we are interested in is the Integer Offset Data. We can then copy and paste this data into the integer property of the look up table component.
In this example Flowcode file we display the LUT data onto a graphical LCD display
LUT
Here is what you should expect to see on the glcd after running the simulation.
Macro reference
GetFloat
|
GetFloat
|
Gets a float from the LUT
|
- ULONG
|
Index
|
|
- FLOAT
|
Return
|
GetInt
|
GetInt
|
Gets an integer from the LUT
|
- ULONG
|
Index
|
|
- ULONG
|
Return
|
GetLUTCount
|
GetLUTCount
|
Gets the number of individual data entries stored in the LUT.
|
- UINT
|
Return
|
Property reference
|
Properties
|
|
Enabled
|
Determines if the LUT component is active.
|
|
Storage Type
|
Controls the data type stored by the component.
|
|
Storage Sign
|
Controls if the integer numbers are allowed to be negative. Unsigned = Numbers are positive only. Signed = Numbers can be positive and negative.
|
|
Integers
|
Comma seperated integer data which is used to create the C code which is inserted into the ROM.
|
|
Num Values
|
|
|
Embed Into C
|
Flag to decide if code should be generated to C or not If this is false then the LUT is simulation only
|
Component Source Code
Please click here to download the component source project: FC_Comp_Source_LUT.fcfx
Please click here to view the component source code (Beta): FC_Comp_Source_LUT.fcfx