1 |
2 |
jodb |
Information to the Project HD44780 Driver
|
2 |
|
|
-----------------------------------------
|
3 |
|
|
This project contains VHDL descriptions for driving a standard HD44780
|
4 |
|
|
LCD Driver with a minimum of inputs. Please read on.
|
5 |
|
|
|
6 |
|
|
Information
|
7 |
|
|
-----------
|
8 |
|
|
Author: J.E.J. op den Brouw
|
9 |
|
|
Company: De Haagse Hogeschool
|
10 |
|
|
Rationale: This driver is written to facilitate my students
|
11 |
|
|
Software: Quartus II v11.1 / ModelSim v10.0.c / Windows 7
|
12 |
|
|
Hardware: Terasic DE0 board with optional display (Cyclone III)
|
13 |
|
|
Status: Alpha, tested by my students.
|
14 |
|
|
|
15 |
|
|
Files
|
16 |
|
|
-----
|
17 |
|
|
lcd_driver_hd44780_module.vhd - The Driver
|
18 |
|
|
tb_lcd_driver_hd44780_module.vhd - Simple testbench
|
19 |
|
|
tb_lcd_driver_hd44780_module.do - ModelSim command file
|
20 |
|
|
example_driver.vhd - Example on how to use the driver
|
21 |
|
|
tb_example_driver.vhd - Simple testbench
|
22 |
|
|
tb_example_driver.do - ModelSim command file
|
23 |
|
|
lcd_driver_hd44780.sdc - Synopsys Constraints File (clock info only)
|
24 |
|
|
readme.txt - This file
|
25 |
|
|
|
26 |
|
|
Overall Description
|
27 |
|
|
----------------------------------------------------------------------------------------
|
28 |
|
|
Currently, this driver uses the 8-bit databus mode. This is not a big problem
|
29 |
|
|
for most FPGA's because of the numerous pins.
|
30 |
|
|
Please note that there are a lot of almost-the-same displays available, so
|
31 |
|
|
it's not guaranteed to work with all displays available. Also, timing may differ.
|
32 |
|
|
|
33 |
|
|
This code is tested on a Terasic DE0-board with an optional LCD display.
|
34 |
|
|
See the weblinks:
|
35 |
|
|
http://www.terasic.com.tw/cgi-bin/page/archive.pl?Language=English&CategoryNo=56&No=364
|
36 |
|
|
http://www.terasic.com.tw/cgi-bin/page/archive.pl?Language=English&CategoryNo=78&No=396
|
37 |
|
|
for more info. The display used has only two lines.
|
38 |
|
|
|
39 |
3 |
jodb |
The VHDL descriptions can both be simulated and synthesized.
|
40 |
2 |
jodb |
|
41 |
|
|
This driver has a User Side and a LCD Side. The user is to interface at the User Side
|
42 |
|
|
and has a number of "routines" at her disposal. The User Side implements the following
|
43 |
|
|
inputs/routines in order of priority:
|
44 |
|
|
|
45 |
|
|
Command inputs:
|
46 |
|
|
init: a logic 1 initializes the display
|
47 |
|
|
cls: a logic 1 clears the display (and goes to home)
|
48 |
|
|
home: a logic 1 sets the cursor to row 0, column 0
|
49 |
|
|
goto10: a logic 1 sets the cursor to row 1, column 0
|
50 |
|
|
goto20: a logic 1 sets the cursor to row 2, column 0
|
51 |
|
|
goto30: a logic 1 sets the cursor to row 3, column 0
|
52 |
|
|
wr: a logic 1 writes a character to the display
|
53 |
|
|
|
54 |
|
|
Data inputs:
|
55 |
|
|
|
56 |
|
|
data: an 8-bit data to be written to the display
|
57 |
|
|
|
58 |
|
|
The user has one observable output:
|
59 |
|
|
|
60 |
|
|
busy: a logic 1 indicates that the driver is currently
|
61 |
|
|
busy driving the display, a logic 0 indicates that
|
62 |
|
|
the driver waits for the next command.
|
63 |
|
|
|
64 |
|
|
The user can supply the next generics, which are processed at
|
65 |
|
|
instantiation of the module:
|
66 |
|
|
|
67 |
|
|
freq: the clock frequency at which the hardware has to run.
|
68 |
|
|
this frequency is mandatory because of internal delays
|
69 |
|
|
calculated, defaults to 50 MHz.
|
70 |
|
|
areset_pol:
|
71 |
|
|
the polarity of the reset signal, defaults to High (1)
|
72 |
|
|
time_init1:
|
73 |
|
|
the time to wait after Vcc > 4.5 V
|
74 |
|
|
time_init2:
|
75 |
|
|
the time to wait after first "contact"
|
76 |
|
|
time_init3:
|
77 |
|
|
the time to wait after the second contact
|
78 |
|
|
time_tas:
|
79 |
|
|
the RW and RS signal setup time with respect to the positive
|
80 |
|
|
edge of the E pulse
|
81 |
|
|
time_cycle_e:
|
82 |
|
|
the complete cycle time
|
83 |
|
|
time_pweh:
|
84 |
|
|
the E pulse width high time
|
85 |
|
|
time_no_bf:
|
86 |
|
|
time to wait before command completion if no Busy Flag reading is done,
|
87 |
|
|
some designs connect RW to logic 0, so reading from the LCD is not
|
88 |
|
|
possible, saves a pin.
|
89 |
|
|
cursor_on:
|
90 |
|
|
true to set the cursor on at the display, false for no cursor
|
91 |
|
|
blink_on:
|
92 |
|
|
true to let the cursor blink, false for no blink (just a underscore)
|
93 |
|
|
use_bf: true if Busy Flag reading is to be used, false for no BF reading
|
94 |
|
|
|
95 |
|
|
Note: it's not possible to write command codes to the display.
|
96 |
|
|
|
97 |
|
|
A note about timing:
|
98 |
|
|
Some of the timing parameters are very small, e.g. the RW and RS setup time with
|
99 |
|
|
respect to rising edge of E. If the clock frequency is too low, the delay calculated
|
100 |
3 |
jodb |
will be zero, which result in at least a delay with the period time of the clock.
|
101 |
2 |
jodb |
|
102 |
|
|
A note about implementing:
|
103 |
|
|
If the driver doesn't work or you get clobbered strings, please use non-BF
|
104 |
3 |
jodb |
reading at first. Next, increase the Cycle E time and PWeh time.
|