Difference between revisions of "Component: Circular Buffer (16 bit) (Storage)"

From Flowcode Help
Jump to navigationJump to search
(XML import)
 
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
+
{| style="width:50%"
 
 
{| width="50%"
 
 
|-
 
|-
| width="20%" style="color: gray;" | Author
+
| width="20%" style="color:gray;" | Author
 
| Matrix Ltd
 
| Matrix Ltd
 
|-
 
|-
| width="20%" style="color: gray;" | Version
+
| width="20%" style="color:gray;" | Version
| 1.5 (Release)
+
| 1.5
 
|-
 
|-
| width="20%" style="color: gray;" | Category
+
| width="20%" style="color:gray;" | Category
 
| Storage
 
| Storage
 
|}
 
|}
  
  
 +
==Circular Buffer (16-bit) 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 16-bit values.
  
==[[File:Component Icon 201d99f7_acf8_481d_a703_61860c2ba3ea.png|Image]] Circular Buffer (16_bit) component==
+
==Component Pack==
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 16-bit values.
 
  
==Examples==
+
STORAGE
''<span style="color:red;">No additional examples</span>''
 
  
 +
==Detailed description==
  
==Downloadable macro reference==
 
  
===<span style="font-weight: normal;"><u><tt>WaitForValues</tt></u></span>===
 
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.
 
  
'''Parameters'''
 
  
:[[Variable Types|UINT]] ''Values''
 
  
:[[Variable Types|BYTE]] ''NumValues''
 
::Number of values to try and look for
 
  
:[[Variable Types|BYTE]] ''RemoveContent''
 
::0=Leave the buffer contents untouched, 1=Remove values as you go
 
  
:[[Variable Types|UINT]] ''Timeout''
 
::Max amount of time to wait in milliseconds before returning 0=WaitForever
 
  
  
'''Return value'''
 
  
:[[Variable Types|BYTE]]
 
  
  
===<span style="font-weight: normal;"><u><tt>GetNumberValues</tt></u></span>===
 
Returns the number of valid 16-bit data values currently stored inside the buffer.
 
  
'''Parameters'''
+
''No detailed description exists yet for this component''
  
:''This macro has no parameters''
+
==Examples==
  
  
'''Return value'''
 
  
:[[Variable Types|UINT]]
 
  
  
===<span style="font-weight: normal;"><u><tt>PeekData</tt></u></span>===
 
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.
 
  
'''Parameters'''
 
  
:''This macro has no parameters''
 
  
  
'''Return value'''
 
  
:[[Variable Types|UINT]]
 
  
  
===<span style="font-weight: normal;"><u><tt>PutData</tt></u></span>===
 
Add a 16-bit value to the next free location inside the circular buffer.
 
  
If the data goes into the buffer correctly then return 1.
+
''<span style="color:red;">No additional examples</span>''
  
Otherwise the buffer is full and the return value will equal 0.
 
  
'''Parameters'''
+
==Downloadable macro reference==
  
:[[Variable Types|UINT]] ''Data''
+
{| 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-u16-icon.png]] - UINT
 +
| 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''
 +
|}
  
  
'''Return value'''
+
{| 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''
 +
|}
  
:[[Variable Types|BYTE]]
 
  
 +
{| 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-u16-icon.png]] - UINT
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
===<span style="font-weight: normal;"><u><tt>LookForValues</tt></u></span>===
 
Scans the buffer for an array of specific values.
 
  
Returns 0 if the value is not found.
+
{| 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 16-bit 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-u16-icon.png]] - UINT
 +
| 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''
 +
|}
  
Returns 1 if the value is found.
 
  
'''Parameters'''
+
{| 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;" | '''LookForValues'''
 +
|-
 +
| 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;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 +
| 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''
 +
|}
  
:[[Variable Types|UINT]] ''Values''
 
  
:[[Variable Types|BYTE]] ''NumValues''
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
::The number of values you wish to try and match
+
|-
 +
| 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 16-bit 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-u16-icon.png]] - UINT
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
:[[Variable Types|BYTE]] ''RemoveContent''
 
::0=Leave data alone, 1=Remove data from buffer
 
  
:[[Variable Types|BYTE]] ''ResetFind''
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
::0=Continue the find from the last operation, 1=Start again
+
|-
 
+
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''FlushBuffer'''
'''Return value'''
+
|-
 
+
| colspan="2" | Clears the contents of the buffer and re-initialises the index locations.&nbsp;
:[[Variable Types|BYTE]]
+
|-
 
+
|-
 
+
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
===<span style="font-weight: normal;"><u><tt>GetData</tt></u></span>===
+
| width="90%" style="border-top: 2px solid #000;" | ''Return''
Reads the next available 16-bit value from the circular buffer,
+
|}
 
 
Returns the default value if the buffer is empty.
 
 
 
'''Parameters'''
 
 
 
:''This macro has no parameters''
 
 
 
 
 
'''Return value'''
 
 
 
:[[Variable Types|UINT]]
 
 
 
 
 
===<span style="font-weight: normal;"><u><tt>FlushBuffer</tt></u></span>===
 
Clears the contents of the buffer and re-initialises the index locations.
 
 
 
'''Parameters'''
 
 
 
:''This macro has no parameters''
 
 
 
 
 
'''Return value'''
 
 
 
:''This call does not return a value''
 
 
 
 
 
===<span style="font-weight: normal;"><u><tt>GetIndexedValue</tt></u></span>===
 
Gets the value of a single 16-bit value at a known location in the buffer.
 
 
 
Leaves the buffer contents and pointers untouched.
 
 
 
'''Parameters'''
 
 
 
:[[Variable Types|UINT]] ''address''
 
 
 
 
 
'''Return value'''
 
 
 
:[[Variable Types|UINT]]
 
  
  
 +
{| 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 16-bit 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-u16-icon.png]] - UINT
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
==Simulation macro reference==
 
  
''This component does not contain any simulation macros''
 
  
  
 
==Property reference==
 
==Property reference==
<span style="font-weight: normal;"><u>Buffer Size</u></span>
 
  
This property is of type ''Unsigned integer'' and can be referenced with the variable name ''BufferSize''.
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
+
|-
Sets the number of byte elements inside the circular buffer.
+
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
 
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''  
The maximum number of bytes that can be stored at any one time is this number minus 1.
+
|-
 
+
|-
<span style="font-weight: normal;"><u>Storage Type</u></span>
+
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 
+
| width="90%" | Buffer Size
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''StorageType''.
+
|-
 
+
| colspan="2" | Sets the number of byte elements inside the circular buffer. The maximum number of bytes that can be stored at any one time is this number minus 1.&nbsp;
When buffer is full this property decides what to do.
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
Store first x values - Will retain the information inside the buffer, new data will be discarded.
+
| width="90%" | Storage Type
 
+
|-
Store last x values - Will discard the oldest location in the buffer and overwrite with new data.
+
| 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;
 
+
|-
<span style="font-weight: normal;"><u>Memory Type</u></span>
+
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
+
| width="90%" | Memory Type
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''MemType''.
+
|-
 
+
| colspan="2" | &nbsp;
''<span style="color:red;">No additional information</span>''
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 
+
| width="90%" | Default Return Data
 
+
|-
<span style="font-weight: normal;"><u>Default Return Data</u></span>
+
| colspan="2" | Specifies the value returned by the receive function when there is no data held in the buffer&nbsp;
 
+
|}
This property is of type ''Unsigned integer'' and can be referenced with the variable name ''RETURN''.
 
 
 
Specifies the value returned by the receive function when there is no data held in the buffer
 

Latest revision as of 17:24, 9 November 2022

Author Matrix Ltd
Version 1.5
Category Storage


Circular Buffer (16-bit) 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 16-bit values.

Component Pack

STORAGE

Detailed description

No detailed description exists yet for this component

Examples

No additional examples


Downloadable macro reference

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-u16-icon.png - UINT 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


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


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-u16-icon.png - UINT Return


Fc9-comp-macro.png PutData
Add a 16-bit 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-u16-icon.png - UINT Data
 
Fc9-u8-icon.png - BYTE Return


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-u16-icon.png - UINT 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


Fc9-comp-macro.png GetData
Reads the next available 16-bit value from the circular buffer, Returns the default value if the buffer is empty. 
Fc9-u16-icon.png - UINT Return


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


Fc9-comp-macro.png GetIndexedValue
Gets the value of a single 16-bit value at a known location in the buffer. Leaves the buffer contents and pointers untouched. 
Fc9-u16-icon.png - UINT address
 
Fc9-u16-icon.png - UINT 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. The maximum number of bytes that can be stored at any one time is this number minus 1. 
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-21-icon.png Default Return Data
Specifies the value returned by the receive function when there is no data held in the buffer