Forum Discussion
Altera_Forum
Honored Contributor
20 years agoClever UARTs (Interrupt Driven)
Hello all, By this time I know that everybody is tired of this topic, but I can't seem to find a clear answer anywhere. Firstly, I am not using a RTOS but am wanting to use the RX & TX...
Altera_Forum
Honored Contributor
20 years agoHi tyrone,
My ring buffer sizes are powers of 2, usually 512 bytes. I have two variables that tell me where the 'in' and 'out' positions are. When characters are inserted or removed these indexes are incremented, I then &= them with a mask that keeps them in range and takes care of the wrap around. For a 512 byte buffer the mask is 0x1ff. Quick and simple. Banx.