Line 16... |
Line 16... |
-- DISCLAIMED. IN NO EVENT SHALL JEREMY SETH HENRY BE LIABLE FOR ANY
|
-- DISCLAIMED. IN NO EVENT SHALL JEREMY SETH HENRY BE LIABLE FOR ANY
|
-- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
-- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
-- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
-- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
-- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
-- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
-- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
-- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
-- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
--
|
--
|
-- VHDL Entity: o8_hd44780_8b
|
-- VHDL Entity: o8_hd44780_8b
|
-- Description: Provides low-level access to a "standard" character LCD using
|
-- Description: Provides low-level access to a "standard" character LCD using
|
-- the ST/HD44780(U) control ASIC wired in full (8-bit) mode.
|
-- the ST/HD44780(U) control ASIC wired in full (8-bit) mode.
|
-- All low-level timing of the control signals are handled by this
|
-- All low-level timing of the control signals are handled by
|
-- module, allowing client firmware to use a simple register
|
-- this module, allowing client firmware to use a simple
|
-- interface to program the LCD panel.
|
-- register interface to program the LCD panel.
|
-- Init routine initializes the display and displays a single
|
-- Init routine initializes the display and displays a single
|
-- character to demonstrate correct function, then listens for
|
-- character to demonstrate correct function, then listens for
|
-- user data on its external interface.
|
-- user data on its external interface.
|
|
--
|
|
-- Register Map
|
|
-- Address Function
|
|
-- Offset Bitfield Description Read/Write
|
|
-- 0x0 AAAAAAAA LCD Register Write (Write-only)
|
|
-- 0x1 AAAAAAAA LCD Data Write (Write-only)
|
|
-- 0x2 AAAAAAAA LCD Contrast (Read-Write)
|
|
-- 0x3 AAAAAAAA LCD Backlight (Read-Write)
|
|
--
|
|
--------------------------------------------------------------------------------
|
|
-- LCD Controller
|
|
--------------------------------------------------------------------------------
|
|
--
|
|
-- LCD Instruction Set
|
|
-- Instruction RS RW D7 D6 D5 D4 D3 D2 D1 D0 Time
|
|
------------------------------------------------------------------------
|
|
-- Clear Display | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1.52mS
|
|
-- Return Home | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | x | 1.52mS
|
|
-- Entry Mode | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | ID| S | 37uS
|
|
-- Display Pwr | 0 | 0 | 0 | 0 | 0 | 0 | 1 | D | C | B | 37uS
|
|
-- Cursor/Display Shift | 0 | 0 | 0 | 0 | 0 | 1 | SC| RL| x | x | 37uS
|
|
-- Function Set | 0 | 0 | 0 | 0 | 1 | DL| N | F | x | x | 37uS
|
|
-- Set CGRAM Address | 0 | 0 | 0 | 1 | A | A | A | A | A | A | 37uS
|
|
-- Set DDRAM Address | 0 | 0 | 1 | A | A | A | A | A | A | A | 37uS
|
|
|
|
-- Notes:
|
|
-- ID = Increment/Decrement DDRAM Address (1 = increment, 0 = decrement)
|
|
-- S = Shift Enable (1 = Shift display according to ID, 0 = Don't shift)
|
|
-- D = Display On/Off (1 = on, 0 = off)
|
|
-- C = Cursor On/Off (1 = on, 0 = off)
|
|
-- B = Cursor Blink (1 = block cursor, 0 = underline cursor)
|
|
-- SC / RL = Shift Cursor/Display Right/Left (see data sheet - not needed for init)
|
|
-- F = Font (0 = 5x8, 1 = 5x11) Ignored on 2-line displays (N = 1)
|
|
-- N = Number of Lines (0 = 1 lines, 1 = 2 lines)
|
|
-- DL = Data Length (0 = 4-bit bus, 1 = 8-bit bus) This is fixed at 1 in this module
|
|
-- A = Address (see data sheet for usage)
|
|
--
|
|
-- Revision History
|
|
-- Author Date Change
|
|
------------------ -------- ---------------------------------------------------
|
|
-- Seth Henry 01/22/13 Design Start
|
|
-- Seth Henry 04/10/20 Code & comment cleanup
|
|
|
library ieee;
|
library ieee;
|
use ieee.std_logic_1164.all;
|
use ieee.std_logic_1164.all;
|
use ieee.std_logic_unsigned.all;
|
use ieee.std_logic_unsigned.all;
|
use ieee.std_logic_arith.all;
|
use ieee.std_logic_arith.all;
|
Line 86... |
Line 128... |
|
|
signal Reg_Valid : std_logic := '0';
|
signal Reg_Valid : std_logic := '0';
|
signal Reg_Sel : std_logic := '0';
|
signal Reg_Sel : std_logic := '0';
|
signal Reg_Data : DATA_TYPE := x"00";
|
signal Reg_Data : DATA_TYPE := x"00";
|
|
|
signal Tx_Ready : std_logic;
|
signal Tx_Ready : std_logic := '0';
|
|
|
--------------------------------------------------------------------------------
|
|
-- LCD Controller
|
|
--------------------------------------------------------------------------------
|
|
|
|
-- Register Map
|
|
-- Address Function
|
|
-- Offset Bitfield Description Read/Write
|
|
-- 0x0 AAAAAAAA LCD Register Write (Write-only)
|
|
-- 0x1 AAAAAAAA LCD Data Write (Write-only)
|
|
-- 0x2 AAAAAAAA LCD Contrast (Read-Write)
|
|
-- 0x3 AAAAAAAA LCD Backlight (Read-Write)
|
|
|
|
-- LCD Instruction Set
|
|
-- Instruction RS RW D7 D6 D5 D4 D3 D2 D1 D0 Time
|
|
------------------------------------------------------------------------
|
|
-- Clear Display | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1.52mS
|
|
-- Return Home | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | x | 1.52mS
|
|
-- Entry Mode | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | ID| S | 37uS
|
|
-- Display Pwr | 0 | 0 | 0 | 0 | 0 | 0 | 1 | D | C | B | 37uS
|
|
-- Cursor/Display Shift | 0 | 0 | 0 | 0 | 0 | 1 | SC| RL| x | x | 37uS
|
|
-- Function Set | 0 | 0 | 0 | 0 | 1 | DL| N | F | x | x | 37uS
|
|
-- Set CGRAM Address | 0 | 0 | 0 | 1 | A | A | A | A | A | A | 37uS
|
|
-- Set DDRAM Address | 0 | 0 | 1 | A | A | A | A | A | A | A | 37uS
|
|
|
|
-- Notes:
|
|
-- ID = Increment/Decrement DDRAM Address (1 = increment, 0 = decrement)
|
|
-- S = Shift Enable (1 = Shift display according to ID, 0 = Don't shift)
|
|
-- D = Display On/Off (1 = on, 0 = off)
|
|
-- C = Cursor On/Off (1 = on, 0 = off)
|
|
-- B = Cursor Blink (1 = block cursor, 0 = underline cursor)
|
|
-- SC / RL = Shift Cursor/Display Right/Left (see data sheet - not needed for init)
|
|
-- F = Font (0 = 5x8, 1 = 5x11) Ignored on 2-line displays (N = 1)
|
|
-- N = Number of Lines (0 = 1 lines, 1 = 2 lines)
|
|
-- DL = Data Length (0 = 4-bit bus, 1 = 8-bit bus) This is fixed at 1 in this module
|
|
-- A = Address (see data sheet for usage)
|
|
|
|
constant LCD_CONFIG1 : std_logic_vector(7 downto 0) := x"38"; -- Set 4-bit, 2-line mode
|
constant LCD_CONFIG1 : std_logic_vector(7 downto 0) := x"38"; -- Set 4-bit, 2-line mode
|
constant LCD_CONFIG2 : std_logic_vector(7 downto 0) := x"0C"; -- Turn display on, no cursor
|
constant LCD_CONFIG2 : std_logic_vector(7 downto 0) := x"0C"; -- Turn display on, no cursor
|
constant LCD_CONFIG3 : std_logic_vector(7 downto 0) := x"01"; -- Clear display
|
constant LCD_CONFIG3 : std_logic_vector(7 downto 0) := x"01"; -- Clear display
|
constant LCD_CONFIG4 : std_logic_vector(7 downto 0) := x"06"; -- Positive increment, no shift
|
constant LCD_CONFIG4 : std_logic_vector(7 downto 0) := x"06"; -- Positive increment, no shift
|