Hi everyone and thanks for all the comments.
This question was a theoretical / hypothetical one so the only “code” there is is our “pseudo-code” which is plain old English and just lists the steps that will be needed to get the job done, sometimes with the particular command that should be used.
In this case I had used “array_shift()” which is a PHP command that returns the first value in the array, removes it and moves everything down.
A few hours later I realized that in PHP (for the most part anyway) arrays are dynamic and that “array_shift()” will only work on a dynamic array - here we are talking about a fixed length array.
A dynamic array will probably be very expensive as far as resources are concerned.
Although I have been programming for more than 30 years I have never had the need to learn the “C” language and have just started reading through the language command list and figuring out that, how etc each command does - have not reached the “array” section yet but I will get there while I wait for Banggood to come to the party with our components.
THAT “circular queue / cyclic buffer” is exactly what I was looking for!
Thank You SIR ;>}
Everybody who replied DID answer my question and more importantly, brought a whole lot of other knowledge my way.
I agree that the “suck it and see” approach is often the best way but making decisions about static vs dynamic arrays is a no-brainer if you do not absolutely have to have a dynamic array.
Your most valued contribution was your comment about “compilers and MCU architecture” playing an important roll in all of this.
Please remember that the last time I used a compiled language in real life was before the public internet existed!
I am aware that different MCU’s have different instruction sets but I was always under the impression that a compiler is a compiler is a compiler.
But from your comment I see that I may need to see if one compiles a specific script more efficiently than another.
You make a good point there BUT you need to realize the following:
Aubrey+soldering iron+discrete components=expensive blue smoke
This project started off before the Arduino was developed and at that time I blew up about 30 high spec PIC16 MCU’s before the project eventually got put in a box under the workbench.
The pin-out plug in connectors on the Uno/Due really appeal to me!
Your comment that if a function is not needed then the linker won’t add it is something that I either never knew or had forgotten.
You also brought “circular buffer” into the discussion - Thanks to you too!
I agree that the “pointer” section will have to be carefully thought out and debugged and I definitely do not want to go shifting data all over the place!
Once a specific piece of data is in the array, it “should” stay exactly where it is until it has been used and then it gets replaced - period!
You raise a very good point as well!
Using bytes as pointers WILL be far more efficient as far as memory usage goes.
However I see that RayLivingston has added a codicil.
Guess I will have to look into the whole situation there too.
Thanks for that!
I am starting to realize that C does not have a multitude of “standard” functionality and that is probably why it is so powerful.
You can do just about anything if you build the function yourself because all the low level commands are exposed and not hidden away as in some other programming languages.
I think you are correct as far as the “circular buffer” is concerned.
Getting the pointers and the “full/empty” bit working correctly is going to be fun though!
Thanks to you too. Once I have finished reading through the commands and explanation list I have found I am going to investigate “circular buffers” (if it is not a native of the language that is)
To all of you who commented here please understand that I am NOT one of those “Please do my homework for me” kind of people!
We all do the “copy/paste” thing, they are called libraries!
However this project will be coded from start to finish (with the exception of libraries of course!) by my fingers.
EVERY error or bug will be mine and hopefully I can sort them all out all by myself and learn mountains in the process.
Hopefully I will never be posting an actual piece of code here because it is concepts and methodology that are going to be my biggest problem.
Which way to do something would be better in what circumstances etc.
Once again, thanks to all and everybody have a good one.