How does Ring Buffer work?

Chapter 2  Ring Buffer animation
Chapter 2.1 Introduction
The animation is a very strong tool.  You observe the consecutive Ring Buffer states only instead of the vague text “the first byte is entering the buffer , provided that the falling edge of the clock pulse… etc.

Chapter 2.2  How does come  in and walk out of the every animation
The animation is the main advantage of this article. The interpretation is very easy then and the added text will be not necessary probably! Animation is based on the Scratch language. You don’t need to know and install it!
I recommend to turn on the audio in the computer. It isn’t necessary but it is very helpfull.
Additional Scratch requirement:
– Classical computers and laptops only. No mobiles and tablets!
– Adobe FlashPlayer. Everybody almost has it.
You call animation by clicking the text animation located under the majority of the figures–>see Note. You come to appropriate SCRATCH server site then, but you leave this article site simultaneously! So you need to return to the article when you will finish the animation. You do it by clicking the classical windows „return to previous site” push-button with the arrow–>see Fig. 2-1.
And my friendly advice. Don’t click clock-zegar too quickly! Give system the chance to react!
When you click  animation–>Scratch may ask you in polish language to click “Adobe Flash Player” symbol! Do it of course.

Fig. 2-1
How does return to the article from the animation?

Chapter 2.3 Ring Buffer animation
Click the text ANIMATION under  Fig. 2-2 and the green flag then to set the initial state.
The computer speaker on will be very helpful!

Fig. 2-2
Ring Buffer  ANIMATION
UDR, Ring Buffer are the microprocessors registers , RAM is a memory (Atmega microcontroller is an eaxmple  here).
The text “Alice has a cat” will be transmitted from the the outside (from the another microprocessor) through UDR and Ring Buffer  to the RAM memory.
Click the “zegar-clock” and observe the consecutive cycles:
Ring Buffer feeding –> the text bytes are transmitted UDR–>Ring Buffer
– Ring Buffer emptying–> the text bytes are transmitted Ring–>RAM memory
The appearance is similar to the crawilng snake in the Ring Buffer. But it’s very strange snake. It grows towards Head during feeding cycle and shrinks from the direction of Tail during emptying cycle!
The space byte in the text changes cycle Ring Buffer feeding/Ring Buffer emptying here.
“The empty buffor” state changes cycle Ring Buffer feeding/Ring Buffer emptying here.  (when T=H or other words–> snake death)
The above mentioned moments may be other. They depend on the software developer imagination only.

Dodaj komentarz

Twój adres e-mail nie zostanie opublikowany. Wymagane pola są oznaczone *