hate
Member level 4
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...
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...