Omega98 / LedCube4x4x4

LED Cube 4x4x4
0 stars 0 forks source link

Compare performance between 2D buffer and 1D buffer architecture #2

Closed Omega98 closed 10 years ago

Omega98 commented 10 years ago

Buffer can be defined with a 2D array: volatile uint8_t buffer[4][4] = {{B0000, B0000, B0000, B0000}, {0x0, 0x0, 0x0, 0x0}, {0x0, 0x0, 0x0, 0x0}, {0x0, 0x0, 0x0, 0x0}}; First dimension is [z] and gives a 1D array: {0x0, 0x0, 0x0, 0x0}. Second dimension is [y] and gives a byte. Each bit of this byte [x] defines the LED status.

Buffer can also be defined as 1D array: volatile uint16_t buffer[4] = {0x0000, 0x0000, 0x0000, 0x0000}; Array index [z] gives a 16-bit byte. Each byte contains LED status in four group [y] of 4-bit chunks [x].

Tests were run with each buffer architecture and consisted of driving the 164 SR to set the 16 anodes using the buffer.

2D 8-bit buffer: 159us 1D 16-bit buffer: 271us

This code is critical since it represents the time the cube is fully off thus affecting the duty cycle.

Omega98 commented 10 years ago

Conclusion, 8-bit 2D buffer will be used for better performance.

Cube max size will be 8x8x8 because it is an array of bytes. Use array of unsigned int if 16 LEDs per dimension is needed.