This project illustrates the interfacing of a HD44780 based LCD to the Xilinx Spartan-2 XCS200 FPGA using delayed Finite State Machine (FSM). While using a microcontroller to display text on the LCD is a fairly simple task, interfacing the LCD with a programmable logic device is a different story. The FSM controls the timing and generation of the signals required for data communication, making the process a lot easier.
The HD44780 LCD uses minimum 2.2V voltage for logic ‘1’ and maximum 0.6V voltage for logic ‘0’ for a given Vcc of 4.5 to 5.5V. These voltages are easily managed by the FPGA, using LVTTL mode. The project makes use of the write operation only in communicating with the LCD, so the RW pin is not used. The execution time delay, used to determine that the current write operation is completed, is 40ns. A 4-bit counter is used to control the instructions (the counter is controlled with the CE signal).
When electrical power is applied to the circuit the FSM enters its first state, the Pwr_Up state (check the diagram). The next state is the Pwr_Up_Delay state which lasts 45ms. The device has a multiplexer that puts the CE signal of the counter on high during these two first states. The next state is the Off_Pwr_Up_Delay, after which the FSM enters the Write_Data state (Enable pulse generation state machine). Next is the Data_Setup_Delay state, in which a delay is generated to make sure the setup time before the rising edge of the Enable pulse is adequate.
The Enable must has to be at least 240ns to be valid, and this is handled in the E_Pulse_Hi, E_Hi_Time and E_Pulse_Lo states. The E pin of the LCD is set on high during E_Pulse_Hi and E_Hi_Time states, and low on E_Pulse_Lo state. The next state is the Proc_Comp_Delay state, in which the delay for the current instruction is activated. The next state is Load_Next_Data and the FSM can either move back to Write_Data state and continue to send instructions to the LCD or go to the End_State.
The FSM and hardware layout is using the Xilinx ISE 8.1i VHDL Compiler. Check the article for a pdf file with additional instructions, diagrams and schematics and look into the datasheet of the HD44780 Based LCD for detailed specifications.
In-Depth FPGA Interfacing of HD44780 Based LCD: [Link] – [Link2]
Another interesting FPGA-based project, this is a Logic Analyzer that is designed to make samples of 24 logic channels and stream the data to a computer for subsequent processing. The device connects to the PC using the USB 2.0 port and supports high transfer rates.
The FPGA mentioned is the EP2C5T144C7N model of Cyclone II device family from Altera and it was programmed using VHDL. The Logic Analyzer also possesses a NET2272 USB controller from NetChip. The device can be self-powered or powered using the USB port, which has a 5V voltage that is converted to 3.3V for the NET2272 controller and to 1.2V for the FPGA core (the conversion is made using two LTC3411 switching regulators).
The Logic Analyzer has three connectors intended for connecting various devices. There is a 10-pin connector for JTAG configuration, another 10-pin connector for a serial FPGA configuration device and a 26-pin connector for probes. The link provides an erratum with key information about software and hardware and some useful tips & tricks on SMD soldering. Schematics and PCB layout pdf files are also included.
FPGA Logic Analyzer: [Link]
Released by Atari in 1972, Pong was a simple video game that became a huge commercial success and is actually considered the game that started the whole video game industry. Pong has simple 2D black-and-white graphics and involves hitting a ball with a paddle located on one side of the screen, simulating table tennis. It can be played with a computer controlled opponent or with another human player and has many different variants that emerged over the years, including on home consoles.
This project features a game of Pong on a Pluto FPGA board that connects to a VGA monitor and has a mouse as a game controller. The HS and VS (horizontal and vertical synchronization, respectively) are digital signals and can be directly connected to FPGA pins or using two low values resistances. The R, G, B signals are analog, so three resistances are required to form voltage dividers that get the 3.3V FPGA output close to the 0.7V nominal values of the aforementioned analog signals (you can find more information about these values and calculations in the link).
Displaying the actual game on the monitor is a bit tricky, you have to generate the HS and VS to be able to display something on the monitor. Then, drawing the actual game, the paddles and the ball is another story, you need to generate the R, G, B and make the ball moving. Another part that can get hairy is the collision detection, you need the ball bouncing off when it hits the paddles. The code for all this is available below, as well as detailed pictures on the board, the VGA connectors and other Pong FPGA project links.
Pong on FPGA: [Link]
There are countless MP3 players projects out there, and building your own is not the most difficult task a portable music player enthusiast can undertake. What’s different about this project right here though is the fact that it’s designer claims it’s faster and cheaper than all the others. That may or may not be true, but it’s worth taking a closer look.
The yPod is based on a microcontroller from Atmel’s ARM7 processor family. The player has a 1.6″ color LCD and a 5-way switch for user control and is powered by a 650 mAh Li-Ion battery that is charged using the USB port. This is also used for firmware updates and music uploading. The player’s memory consists of a Micro SD card and the headphones connect to a 3.5mm jack. The board has a 4-layer PCB design. In terms of software, the player makes use of the VLSI VS1033 MPEG3 codec and supports MP3, WMA, AAC and WAV formats. The yPod is pretty small, having 65 x 45 x 14mm dimensions and weighing only 65g, so it fits and any pocket.
The original project was designed by Jesper Hansen and he provides a lot of additional information, schematics and source code on his homepage. The project presented here is based on Hansen’s work and makes some hardware modifications, having a DS1337 RTC chip and a crystal added, that provide a clock feature with time and date. Two firmware versions are available for download, one for each implementation, and are both released under GNU General Public License, free for use.
yPod MP3 Player: [Link]
Toy cars are something that everybody has encountered during the childhood and even a non-car enthusiast like myself has had his share of toy car playing, racing, garage and road building and all that good stuff. You’d think that something like this would be more suited for kids, but what if you’re a grown-up, you have a small car at your disposal AND possess the knowledge to make some cool hardware improvements? That’s right, awesomeness occurs!
This is a DIY project that enhances a Kyosho Mini-Z car with some incredibly useful features: front, rear and under car lights! The model is actually a VW Golf R32 and, as you can see from the picture, it looks terrific, in true Fast and Furious fashion. The lights are LEDs, two white ones for the front, two red ones for the rear and two bars with 4 LEDs for under the car. The circuit keeping them all on uses a NE555 timer that generates a delay and keeps them on regardless of what the car is doing. Other parts include three capacitors, three resistors and three diodes (you can find a complete parts list and detailed schematics in the link provided, as well as other cool pics).
This is a truly astonishing piece of art, soldering a bunch of LEDs on a toy car, especially with the blue under car lights. If you’re a girl, then I suspect this amazing achievement of science might appear… uninteresting. But if that’s the case, then perhaps an LED Heart of Love would be more appropriate.
Mini-car Light Installation: [Link]