Difference between revisions of "Component: Circular Buffer (16-bit) (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_CircularBuffer16.fcfx FC_Comp_Source_CircularBuffer16.fcfx] | ||
Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_CircularBuffer16.fcfx FC_Comp_Source_CircularBuffer16.fcfx] | Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_CircularBuffer16.fcfx FC_Comp_Source_CircularBuffer16.fcfx] | ||
==Detailed description== | ==Detailed description== | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
Line 44: | Line 54: | ||
==Examples== | ==Examples== | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
Line 69: | Line 87: | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
+ | |||
+ | ==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;" | ''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''FlushBuffer''' |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | Clears the contents of the buffer and re-initialises the index locations. |
|- | |- | ||
|- | |- | ||
− | + | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9- | ||
| 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 194: | Line 127: | ||
− | + | ===GetIndexedValue=== | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 225: | Line 146: | ||
− | + | ===GetNumberValues=== | |
− | |||
− | == | ||
− | |||
{| 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- | + | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] |
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | ''' | + | | 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. | ||
|- | |- | ||
− | |||
− | |||
|- | |- | ||
− | + | | 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" | + | |} |
− | + | ||
− | |||
− | |||
− | |||
− | |||
− | | width="90%" | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | | | ||
− | |||
− | |||
+ | ===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;" | ''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''LookForValues''' |
|- | |- | ||
− | | colspan="2" | | + | | 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. |
|- | |- | ||
|- | |- | ||
Line 272: | Line 177: | ||
| width="90%" | NumValues | | width="90%" | NumValues | ||
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | The number of values you wish to try and match |
|- | |- | ||
| 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 | + | | colspan="2" | 0=Leave data alone, 1=Remove data from buffer |
|- | |- | ||
− | | width="10%" align="center" | [[File:Fc9- | + | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE |
− | | width="90%" | | + | | width="90%" | ResetFind |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | 0=Continue the find from the last operation, 1=Start again |
|- | |- | ||
| 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 289: | Line 194: | ||
− | + | ===PeekData=== | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 315: | Line 208: | ||
+ | ===PutData=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 333: | Line 227: | ||
+ | ===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;" | ''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''WaitForValues''' |
|- | |- | ||
− | | colspan="2" | | + | | 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. |
|- | |- | ||
|- | |- | ||
Line 349: | Line 244: | ||
| width="90%" | NumValues | | width="90%" | NumValues | ||
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | Number of values to try and look for |
|- | |- | ||
| 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 | + | | colspan="2" | 0=Leave the buffer contents untouched, 1=Remove values as you go |
|- | |- | ||
− | | width="10%" align="center" | [[File:Fc9- | + | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT |
− | | width="90%" | | + | | width="90%" | Timeout |
|- | |- | ||
− | | colspan="2" | 0= | + | | colspan="2" | Max amount of time to wait in milliseconds before returning 0=WaitForever |
|- | |- | ||
| 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'' | ||
|} | |} | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
Latest revision as of 13:09, 7 February 2023
Author | Matrix Ltd |
Version | 1.5 |
Category | Buffer |
Contents
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 Source Code
Please click here to download the component source project: FC_Comp_Source_CircularBuffer16.fcfx
Please click here to view the component source code (Beta): FC_Comp_Source_CircularBuffer16.fcfx
Detailed description
No detailed description exists yet for this component
Examples
No additional examples
Macro reference
FlushBuffer
![]() |
FlushBuffer |
Clears the contents of the buffer and re-initialises the index locations. | |
![]() |
Return |
GetData
![]() |
GetData |
Reads the next available 16-bit value from the circular buffer, Returns the default value if the buffer is empty. | |
![]() |
Return |
GetIndexedValue
![]() |
GetIndexedValue |
Gets the value of a single 16-bit value at a known location in the buffer. Leaves the buffer contents and pointers untouched. | |
![]() |
address |
![]() |
Return |
GetNumberValues
![]() |
GetNumberValues |
Returns the number of valid 16-bit data values currently stored inside the buffer. | |
![]() |
Return |
LookForValues
PeekData
![]() |
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. | |
![]() |
Return |
PutData
WaitForValues