Difference between revisions of "Component: Circular Buffer (Float) (Buffer)"

From Flowcode Help
Jump to navigationJump to search
 
(7 intermediate revisions by the same user not shown)
Line 16: Line 16:
  
 
==Component Source Code==
 
==Component Source Code==
 +
 +
Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/FC_Comp_Source_CircularBufferFloat.fcfx FC_Comp_Source_CircularBufferFloat.fcfx]
  
 
Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_CircularBufferFloat.fcfx FC_Comp_Source_CircularBufferFloat.fcfx]
 
Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_CircularBufferFloat.fcfx FC_Comp_Source_CircularBufferFloat.fcfx]
  
 
==Detailed description==
 
==Detailed description==
 +
 +
 +
 +
 +
 +
 +
 +
  
  
Line 28: Line 38:
  
 
==Examples==
 
==Examples==
 +
 +
 +
 +
 +
 +
 +
 +
  
  
Line 35: Line 53:
 
''<span style="color:red;">No additional examples</span>''
 
''<span style="color:red;">No additional examples</span>''
  
==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;" | '''WaitForValues'''
 
|-
 
| colspan="2" | Waits for an array of values to appear in the circular buffer. Returns 0 to indicate a timeout. Returns 1 to indicate the data has been found.&nbsp;
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-f32-icon.png]] - FLOAT
 
| width="90%" | Values
 
|-
 
| colspan="2" | &nbsp;
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | NumValues
 
|-
 
| colspan="2" | Number of values to try and look for&nbsp;
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | RemoveContent
 
|-
 
| colspan="2" | 0=Leave the buffer contents untouched, 1=Remove values as you go&nbsp;
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | Timeout
 
|-
 
| colspan="2" | Max amount of time to wait in milliseconds before returning 0=WaitForever&nbsp;
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 
| 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;" | '''GetNumberValues'''
 
|-
 
| colspan="2" | Returns the number of valid 16-bit data values currently stored inside the buffer.&nbsp;
 
|-
 
|-
 
| 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;" | '''PeekData'''
 
|-
 
| colspan="2" | Reads the next available 16-bit data value from the circular buffer without advancing the current index,  Returns the default value if the buffer is empty.&nbsp;
 
|-
 
|-
 
| 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;" | '''PutData'''
 
|-
 
| colspan="2" | Add a 32-bit floating point value to the next free location inside the circular buffer. If the data goes into the buffer correctly then return 1. Otherwise the buffer is full and the return value will equal 0.&nbsp;
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-f32-icon.png]] - FLOAT
 
| width="90%" | Data
 
|-
 
| colspan="2" | &nbsp;
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
  
  
 +
 +
==Macro reference==
 +
 +
===FlushBuffer===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''LookForValues'''
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''FlushBuffer'''
 
|-
 
|-
| colspan="2" | Scans the buffer for an array of specific values. Returns 0 if the value is not found. Returns 1 if the value is found.&nbsp;
+
| colspan="2" | Clears the contents of the buffer and re-initialises the index locations.&nbsp;
 
|-
 
|-
 
|-
 
|-
| width="10%" align="center" | [[File:Fc9-f32-icon.png]] - FLOAT
+
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" | Values
 
|-
 
| colspan="2" | &nbsp;
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | NumValues
 
|-
 
| colspan="2" | The number of values you wish to try and match&nbsp;
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | RemoveContent
 
|-
 
| colspan="2" | 0=Leave data alone, 1=Remove data from buffer&nbsp;
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | ResetFind
 
|-
 
| colspan="2" | 0=Continue the find from the last operation, 1=Start again&nbsp;
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
|}
  
  
 +
===GetData===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 160: Line 93:
  
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
+
===GetIndexedValue===
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''FlushBuffer'''
 
|-
 
| colspan="2" | Clears the contents of the buffer and re-initialises the index locations.&nbsp;
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| 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 191: Line 112:
  
  
 
+
===GetNumberValues===
 
 
==Property reference==
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
+
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''  
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetNumberValues'''
 
|-
 
|-
 +
| colspan="2" | Returns the number of valid 16-bit data values currently stored inside the buffer.&nbsp;
 
|-
 
|-
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 
| width="90%" | Buffer Size
 
 
|-
 
|-
| colspan="2" | Sets the number of byte elements inside the circular buffer.&nbsp;
+
| 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''
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
+
|}
| width="90%" | Storage Type
+
 
|-
 
| colspan="2" | When buffer is full this property decides what to do. Store first x values - Will retain the information inside the buffer, new data will be discarded. Store last x values - Will discard the oldest location in the buffer and overwrite with new data.&nbsp;
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
| width="90%" | Memory Type
 
|-
 
| colspan="2" | &nbsp;
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-15-icon.png]]
 
| width="90%" | Default Return Data
 
|-
 
| colspan="2" | Specifies the value returned by the receive function when there is no data held in the buffer&nbsp;
 
|}==Macro reference==
 
  
 +
===LookForValues===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''WaitForValues'''
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''LookForValues'''
 
|-
 
|-
| colspan="2" | Waits for an array of values to appear in the circular buffer. Returns 0 to indicate a timeout. Returns 1 to indicate the data has been found.&nbsp;
+
| colspan="2" | Scans the buffer for an array of specific values. Returns 0 if the value is not found. Returns 1 if the value is found.&nbsp;
 
|-
 
|-
 
|-
 
|-
Line 238: Line 143:
 
| width="90%" | NumValues
 
| width="90%" | NumValues
 
|-
 
|-
| colspan="2" | Number of values to try and look for&nbsp;
+
| colspan="2" | The number of values you wish to try and match&nbsp;
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | RemoveContent
 
| width="90%" | RemoveContent
 
|-
 
|-
| colspan="2" | 0=Leave the buffer contents untouched, 1=Remove values as you go&nbsp;
+
| colspan="2" | 0=Leave data alone, 1=Remove data from buffer&nbsp;
 
|-
 
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
+
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Timeout
+
| width="90%" | ResetFind
 
|-
 
|-
| colspan="2" | Max amount of time to wait in milliseconds before returning 0=WaitForever&nbsp;
+
| colspan="2" | 0=Continue the find from the last operation, 1=Start again&nbsp;
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
Line 255: Line 160:
  
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
+
===PeekData===
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetNumberValues'''
 
|-
 
| colspan="2" | Returns the number of valid 16-bit data values currently stored inside the buffer.&nbsp;
 
|-
 
|-
 
| 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 281: Line 174:
  
  
 +
===PutData===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 299: Line 193:
  
  
 +
===WaitForValues===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''LookForValues'''
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''WaitForValues'''
 
|-
 
|-
| colspan="2" | Scans the buffer for an array of specific values. Returns 0 if the value is not found. Returns 1 if the value is found.&nbsp;
+
| colspan="2" | Waits for an array of values to appear in the circular buffer. Returns 0 to indicate a timeout. Returns 1 to indicate the data has been found.&nbsp;
 
|-
 
|-
 
|-
 
|-
Line 315: Line 210:
 
| width="90%" | NumValues
 
| width="90%" | NumValues
 
|-
 
|-
| colspan="2" | The number of values you wish to try and match&nbsp;
+
| colspan="2" | Number of values to try and look for&nbsp;
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | RemoveContent
 
| width="90%" | RemoveContent
 
|-
 
|-
| colspan="2" | 0=Leave data alone, 1=Remove data from buffer&nbsp;
+
| colspan="2" | 0=Leave the buffer contents untouched, 1=Remove values as you go&nbsp;
 
|-
 
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
+
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | ResetFind
+
| width="90%" | Timeout
 
|-
 
|-
| colspan="2" | 0=Continue the find from the last operation, 1=Start again&nbsp;
+
| colspan="2" | Max amount of time to wait in milliseconds before returning 0=WaitForever&nbsp;
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 
| 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;" | '''GetData'''
 
|-
 
| colspan="2" | Reads the next available 32-bit floating point value from the circular buffer, Returns the default value if the buffer is empty.&nbsp;
 
|-
 
|-
 
| 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;" | '''FlushBuffer'''
 
|-
 
| colspan="2" | Clears the contents of the buffer and re-initialises the index locations.&nbsp;
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| 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;" | '''GetIndexedValue'''
 
|-
 
| colspan="2" | Gets the value of a single 32-bit floating point value at a known location in the buffer. Leaves the buffer contents and pointers untouched.&nbsp;
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | address
 
|-
 
| colspan="2" | &nbsp;
 
|-
 
| 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''
 
|}
 
 
 
  
  

Latest revision as of 13:09, 7 February 2023

Author Matrix Ltd
Version 1.5
Category Buffer


Circular Buffer (Float) component

Circular buffer component allowing easy and efficient first in first out (FIFO) style data storage. Also features macros to allow you to check for specific floating point values.

Component Source Code

Please click here to download the component source project: FC_Comp_Source_CircularBufferFloat.fcfx

Please click here to view the component source code (Beta): FC_Comp_Source_CircularBufferFloat.fcfx

Detailed description

No detailed description exists yet for this component

Examples

No additional examples






Macro reference

FlushBuffer

Fc9-comp-macro.png FlushBuffer
Clears the contents of the buffer and re-initialises the index locations. 
Fc9-void-icon.png - VOID Return


GetData

Fc9-comp-macro.png GetData
Reads the next available 32-bit floating point value from the circular buffer, Returns the default value if the buffer is empty. 
Fc9-f32-icon.png - FLOAT Return


GetIndexedValue

Fc9-comp-macro.png GetIndexedValue
Gets the value of a single 32-bit floating point value at a known location in the buffer. Leaves the buffer contents and pointers untouched. 
Fc9-u16-icon.png - UINT address
 
Fc9-f32-icon.png - FLOAT Return


GetNumberValues

Fc9-comp-macro.png GetNumberValues
Returns the number of valid 16-bit data values currently stored inside the buffer. 
Fc9-u16-icon.png - UINT Return


LookForValues

Fc9-comp-macro.png LookForValues
Scans the buffer for an array of specific values. Returns 0 if the value is not found. Returns 1 if the value is found. 
Fc9-f32-icon.png - FLOAT Values
 
Fc9-u8-icon.png - BYTE NumValues
The number of values you wish to try and match 
Fc9-u8-icon.png - BYTE RemoveContent
0=Leave data alone, 1=Remove data from buffer 
Fc9-u8-icon.png - BYTE ResetFind
0=Continue the find from the last operation, 1=Start again 
Fc9-u8-icon.png - BYTE Return


PeekData

Fc9-comp-macro.png PeekData
Reads the next available 16-bit data value from the circular buffer without advancing the current index, Returns the default value if the buffer is empty. 
Fc9-f32-icon.png - FLOAT Return


PutData

Fc9-comp-macro.png PutData
Add a 32-bit floating point value to the next free location inside the circular buffer. If the data goes into the buffer correctly then return 1. Otherwise the buffer is full and the return value will equal 0. 
Fc9-f32-icon.png - FLOAT Data
 
Fc9-u8-icon.png - BYTE Return


WaitForValues

Fc9-comp-macro.png WaitForValues
Waits for an array of values to appear in the circular buffer. Returns 0 to indicate a timeout. Returns 1 to indicate the data has been found. 
Fc9-f32-icon.png - FLOAT Values
 
Fc9-u8-icon.png - BYTE NumValues
Number of values to try and look for 
Fc9-u8-icon.png - BYTE RemoveContent
0=Leave the buffer contents untouched, 1=Remove values as you go 
Fc9-u16-icon.png - UINT Timeout
Max amount of time to wait in milliseconds before returning 0=WaitForever 
Fc9-u8-icon.png - BYTE Return


Property reference

Fc9-prop-icon.png Properties
Fc9-type-21-icon.png Buffer Size
Sets the number of byte elements inside the circular buffer. 
Fc9-type-16-icon.png Storage Type
When buffer is full this property decides what to do. Store first x values - Will retain the information inside the buffer, new data will be discarded. Store last x values - Will discard the oldest location in the buffer and overwrite with new data. 
Fc9-type-16-icon.png Memory Type
 
Fc9-type-15-icon.png Default Return Data
Specifies the value returned by the receive function when there is no data held in the buffer