Jump to content

Component: Circular Buffer Free (Buffer): Difference between revisions

From Flowcode Help
Created page with "{| style="width:50%" |- | width="20%" style="color:gray;" | Author | Matrix Ltd |- | width="20%" style="color:gray;" | Version | 1.5 |- | width="20%" style="color:gray..."
 
No edit summary
Line 20: Line 20:


==Detailed description==
==Detailed description==




Line 42: Line 44:


==Examples==
==Examples==




Line 65: Line 69:




==Downloadable macro reference==
==Macro reference==


{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"

Revision as of 14:10, 20 January 2023

Author Matrix Ltd
Version 1.5
Category Buffer


Circular Buffer Free component

Circular buffer component allowing easy and efficient first in first out (FIFO) style data byte storage. Useful when used with a comms component to capture data as it comes in ready for processing when we have time. Also features macros to allow you to check for specific incoming responses such as "OK" or "ERROR".

Component Source Code

Please click here for the component source code: FC_Comp_Source_CircularBuffer_Free.fcfx

Detailed description

No detailed description exists yet for this component

Examples

No additional examples


Macro reference

LookForValue
Scans the buffer for an array of specific values. Returns 0 if the value is not found. Returns 1 if the value is found. 
- STRING Value
Value to look for, can be a string or byte array, 
- BYTE NumChars
The number of characters you wish to try and match 
- BYTE RemoveContent
0=Leave data alone, 1=Remove data from buffer 
- BYTE ResetFind
0=Continue the find from the last operation, 1=Start again 
- BYTE Return


GetIndexedByte
Gets the value of a single byte at a known location in the buffer. Leaves the buffer contents and pointers untouched. 
- UINT address
 
- BYTE Return


WaitForValue
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. 
- STRING Value
 
- BYTE NumChars
Number of characters to try and look for 
- BYTE RemoveContent
0=Leave the buffer contents untouched, 1=Remove values as you go 
- UINT Timeout
Max amount of time to wait in milliseconds before returning 0=WaitForever 
- BYTE Return


GetNumberBytes
Returns the number of valid data bytes currently inside the buffer. 
- UINT Return


GetConsoleHandle
Gets the handle to the console allowing data displaying on the panel etc. 
- HANDLE Return


PeekByte
Reads the next available byte from the circular buffer without advancing the current index, Returns 255/512 if the buffer is empty. 
- UINT Return


PutByte
Add byte 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. 
- BYTE Data
 
- BYTE Return


GetByte
Reads the next available byte from the circular buffer, Returns 255/512 if the buffer is empty. 
- UINT Return


FlushBuffer
Clears the contents of the buffer and re-initialises the index locations. 
- VOID Return



Property reference

Properties
Buffer Size
Sets the number of byte elements inside the circular buffer. 
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. 
Memory Type
 
Return Type
Specifies the way the receive function indicates a timeout. 8 Bit mode - Timeout is represented by the value 255. 16 Bit mode - Timeout is represented by the value 512 allowing the value 255 to represent valid data 
Console
Decides if the contents of the buffer are shown in a console tab.