
Four 8-bit registers store four programmable LED patterns. A shared-clock binary divider advances a two-bit playback counter at 1 or 4 steps per second when supplied with a 128 Hz clock. Eight outputs drive active-high LEDs.
The eight ui inputs supply parallel pattern data. uio[0:1] select the edit address, uio[2] enables writing, uio[3] enables playback, and uio[4] selects fast playback. All bidirectional pins are configured as inputs. uio[5:7] are unused. Controls pass through two-stage synchronizers.
Assert active-low reset to clear all patterns. Release reset. Set RUN and WRITE low. Select an edit address and set the data inputs. Wait at least 0.1 seconds at 128 Hz, hold WRITE high for at least 0.1 seconds, then return WRITE low and wait 0.1 seconds before changing data or address. Repeat for all four rows. Program 0x81, 0x42, 0x24 and 0x18 as an inward-moving example. Set RUN high to play. FAST low gives 1 step/s; FAST high gives 4 steps/s. RUN low previews the edit address and returns the playback counter to zero. Reset erases memory; programmed patterns do not survive power loss.
128 Hz clock, reset control, eight data switches, five control switches, and eight LEDs with suitable current limiting. Inputs need defined logic levels; use external pull-downs for switches. Set data and address before asserting WRITE and leave them stable until WRITE has returned low and the control synchronization delay has elapsed.
With RUN and WRITE low, select each row and set DATA as follows. DATA switch 1 is bit 0; switch 8 is bit 7. Address is uio[1:0], with uio[0] the low bit.
| Row | Address | DATA switches ON | Hex pattern |
|---|---|---|---|
| 0 | 00 | 1, 8 | 0x81 |
| 1 | 01 | 2, 7 | 0x42 |
| 2 | 10 | 3, 6 | 0x24 |
| 3 | 11 | 4, 5 | 0x18 |
For each row, observe the setup/writing delays above and turn WRITE off before changing the data or address. Then turn RUN on. LEDs move inward and repeat. WRITE is ignored during playback. Editing previews the selected stored row, not the uncommitted data switches. RUN off resets playback position and phase; it does not hold the current playback step.
The design uses 32 flip-flops for pattern memory, 10 for two-stage control synchronizers, seven for the divider, and two for the playback counter. All 51 flip-flops use the same clock. Multiplexers select hold/write data and the displayed row. A clock-enable pulse advances playback every 128 clocks in slow mode or every 32 clocks in fast mode. At other clock frequencies, playback rates scale proportionally. Changing speed mid-step can shorten or lengthen the transitional interval.
Reset is active low at the external interface and inverted internally to clear the flip-flops. Controls take approximately two clock cycles to pass through synchronizers. Data is a stable parallel bus, not individually synchronized; keep it stable during the programming procedure. Physical switch debouncing and reset-release timing must be handled by the external controller or board. Pattern storage is volatile.
| # | Input | Output | Bidirectional |
|---|---|---|---|
| 0 | Pattern data bit 0 | LED 0 (active high) | Edit address bit 0 |
| 1 | Pattern data bit 1 | LED 1 (active high) | Edit address bit 1 |
| 2 | Pattern data bit 2 | LED 2 (active high) | Write enable (high; edit mode only) |
| 3 | Pattern data bit 3 | LED 3 (active high) | Run (high) / edit (low) |
| 4 | Pattern data bit 4 | LED 4 (active high) | Fast (high: 4 steps/s; low: 1 step/s at 128 Hz) |
| 5 | Pattern data bit 5 | LED 5 (active high) | |
| 6 | Pattern data bit 6 | LED 6 (active high) | |
| 7 | Pattern data bit 7 | LED 7 (active high) |