Page 1 of 1

Circular buffer - FlushBuffer command

Posted: Thu Aug 16, 2018 9:26 am
by petesmart
Gents,

A quick one on the circular buffer. Does the FlushBuffer command simulate?

It appears not to do anything to the Circular buffer tab information in the console. Is this normal?

best

Pete

Re: Circular buffer - FlushBuffer command

Posted: Thu Aug 16, 2018 10:46 am
by Benj
Hi Pete,

For efficiency the flush command simply resets the read and write pointers, the contents of the buffer are unaffected so this is probably what you are seeing. I suppose for simulation I could also scrub the data if this would make things more obvious.

Re: Circular buffer - FlushBuffer command

Posted: Thu Aug 16, 2018 11:38 am
by petesmart
Thanks,


edit... forget below...I just re read your note... thats the way its designed!... dont bother changing the simulation...I will read out all of the data...


Got it.. was that supposed to be the design? - reset pointers and leave data in the buffer?

I will check again but the data still seems to be in the Circ buffer ie i can read it

best

Pete

Re: Circular buffer - FlushBuffer command

Posted: Wed Sep 08, 2021 2:10 pm
by AbhijitR
Hello! Ben
good afternoon
Benj wrote:
Thu Aug 16, 2018 10:46 am

For efficiency the flush command simply resets the read and write pointers, the contents of the buffer are unaffected so this is probably what you are seeing.
May i request you if it is possible and the upgrade of component allows, to add one more option/command for this component, FlushBuffer which will absolutely clear the buffer and ResetBuffer which will rest the pointer.

In other case if it is not possible is there any other way to clear the buffer so it will be blank to receive next data.

I am using this component for the first time and it is indeed very helpful.

Thank you.

Abhi

Re: Circular buffer - FlushBuffer command

Posted: Fri Sep 10, 2021 9:51 am
by Benj
Hi Abhi,

This should not be required. If you flush the buffer then the buffer is effectively empty and available to receive more data.

Make sure you use the GetNumberBytes macro to check the contents of the buffer before reading out data and then you will be sure you won't be reading out old stale data.

If you do need to flood the buffer with a known value then you can do this by adding that value in a loop for the buffer size number of times. Then flushing the buffer. But as I say this shouldn't be required.