Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic 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.

Register Log in

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

Status
Not open for further replies.

hate

Member level 4
Joined
Apr 16, 2005
Messages
70
Helped
4
Reputation
8
Reaction score
4
Trophy points
1,288
Activity points
1,714
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


willis...

Full Member level 2
Joined
Dec 26, 2011
Messages
134
Helped
25
Reputation
50
Reaction score
25
Trophy points
1,308
Location
Pretoria, South Africa
Activity points
2,268
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.
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top