Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Verilog code for driving the LCD on a Spartan-3e starter kit

Status
Not open for further replies.

hate

Member level 4
Member level 4
Joined
Apr 16, 2005
Messages
70
Helped
5
Reputation
10
Reaction score
4
Trophy points
1,288
Visit site
Activity points
1,709
Hi,
I started experimenting with fpga's on a Spartan-3E starter kit about a month ago. My first objective was to drive the lcd module on it to see the results of my routines. But unfortunately it was quite a hard task without support from xilinx of any kind. The only examples they provide are implemented with the 'picoblaze' microcontroller. In the end, after all the googling and experimenting I came up with the driver I'm attaching in case other beginners like myself need a working lcd driver for a spartan-3e board. I believe that's a generic driver that can go with an lcd connected to an fpga, I have no way of testing it on other platforms though. Some basic information about the driver:

- Data is transferred as an array to the character module. Data array is compressed into bits before transferred to the lcd module and expanded into a byte array in the module. That's because my version of Verilog (ISE 14.1) didn't support transferring of arrays to modules.

- Lcd data byte consists of 7-bits for char/command data and 1 bit for r/s pin data (0=command or 1=character) Expanding this to 8-bits of char/command data should be quite easy but doesn't suit my needs so I didn't. ;)

- I used an array of 20 bytes to transfer the character data to the lcd (16 visible characters on 1 line and 4 remaining for various commands). That's also quite easy to expand.

- Lcd pulls the 'busy' line high when operating, one can check this to see if lcd is operating or ready for operation.

- 'lcd_trgr' line is used to trigger the lcd when new data is ready to display. The user must pull that line to low when lcd starts operating. I'm looking for a better way to implement this so ideas are welcome. ;)

- The strobe pulse for the 'enable' pin can be adjusted for a minimum value that makes the lcd work, just didn't have the time to play with it.

These are all I can remember for now. I attached a sample program to act as an example to drive the lcd also with the constraints file. Hope this helps other newbies like me. Please feel free to comment and improve the code.

Regards...
 

Attachments

  • lcdmdl.zip
    3.1 KB · Views: 135

Here is an excellent tutorial that describes how to use the LCD on the Spartan 3E FPGA board. Example code is also provided, though I believe that it is written in VHDL. Regardless, it should give you a great starting point, and provide you with a solid understanding of how to go about drafting code to write to the LCD.

http://www.cosmiac.org/pdfs/09Tutorial6.pdf

Regards,
Willis
 
  • Like
Reactions: hate

    hate

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top