Cyclic Buffer
Chapter 1 Introduction
Fig. 1-1
General outline of a cyclic buffer
Note:
Each black square is a single byte, i.e. an 8-bit register. The Cyclic Buffer is most often implemented by a microprocessor program. The programmer has at his disposal, for example, an Atmega microcontroller with 3 memory areas:
-UDR 1-byte register accepting single bytes from outside at any time
– Cyclic Buffer – here an 8-byte register accepting subsequent bytes from the UDR.
Mostly, registers are larger–> 16, 32 or 64 bytes.
-RAM-Memory to which subsequent portions of bytes from the Cyclic Buffer will be inserted, here 16 bytes.
The system operates in cycles consisting of 2 alternating phases:
-Filling the Cyclic Buffer–>A few bytes flow from the UDR into the Cyclic Buffer
-Flushing the Cyclic Buffer–>Several bytes are dropped from the Cyclic Buffer into RAM
The transmitted bytes are rotated in the Cyclic Buffer. The movement of bytes in the buffer resembles a snake with an H head and a T tail.
In the head H is always the earliest byte from the UDR (oldest) entered, and in the tail T the latest byte (youngest).
Fig. 1-1 shows the initial state of the Cyclic Buffer in which the H and T of the snake share byte number 0. This means there is no snake, or in other words, the buffer is empty. After a few cycles, all information will be introduced externally into RAM via UDR and Cyclic Buffer.
Didn’t you understand everything? Don’t worry. Everything will be clear after the animation in the next chapter.