--- Quote Start ---
Hi everyone,
Hopefully I chose which forum to post in correctly.
I am starting a project with an Altera DE2 Development Board that is going to control a LED dot matrix. I want to create the LED dot matrix, which I have already built, and control it through the GPIO pins on the DE2 board.
From what I have read I know that you cannot update the entire LED dot matrix at once. I know I need a clock of at least 50 Hz to avoid showing the flickering on the LEDs updating row by row.
My problem is writing the VHDL to control LED dot matrix. I have VHDL experience, but only with writing adders and multipliers and simulations. This is my first time trying to use an FPGA. My main problem that I am having is how to update the LED dot matrix row by row. My goal is to start the LED dot matrix is just one LED on, and, through the use of the debounce switch buttons, "move" the LED through the matrix.
My current solution was trying to update the whole LED dot matrix at once, which I now know I can't do. Does anybody know how to go about updating the LED dot matrix row by row using VHDL?
I would like to get a simple 3x3 matrix working.
--- Quote End ---
Think of your LED matrix a bit like a SDRAM - The rows = data, the columns = address, and you have to refresh it on a periodic basis. Of course, this is a classic "write-only" memory, but you get the idea.
The easiest way would be to have a block RAM mirror the pattern you want to appear on the LED's, and then read each byte/word/longword out, such that each column gets "written" at 50-60Hz (or whatever refresh rate you like). I'm assuming you are directly driving the columns, and not using external 3:8 decoders, so you will need to essentially "decode" the address to light up a single column. (model a 3:8 or 4:16 decoder in the HDL of your choice) The dout of the ram is written directly to the rows.
This is a classic frame-buffer approach, with the advantage of being implemented in block ram, which is dual-ported by design. This allows you to write in at one rate, while reading out at another. If you implement your logic correctly, you can even do so without visible flicker in the pattern. (implement a sync pulse to a micro, which will DMA the new pattern in just behind the control logic reading the old pattern out)
With a slight modification (to handle the analog timing issues), this method can be used to drive a VGA DAC as well, with the added bonus that you no longer need to decode the frame address to a discrete - you just sequentially write the contents to the DAC.