00001 --**************************************************************
00002 --* *
00003 --* The source code for the ATLAS BCM "AAA" FPGA is made *
00004 --* available via the GNU General Public License (GPL) *
00005 --* unless otherwise stated below. *
00006 --* *
00007 --* In case of problems/questions/bug reports etc. please *
00008 --* contact michael.niegl@cern.ch *
00009 --* *
00010 --**************************************************************
00011
00012 --**************************************************************
00013 --* *
00014 --* $Source: /local/reps/bcmfpga/bcm_aaa/bcm_aaa/lcd/LCD.vhd,v $ *
00015 --* $Revision: 1.7.2.4 $ *
00016 --* $Name: dev $ *
00017 --* $Author: mniegl $ *
00018 --* $Date: 2008/11/03 17:57:46 $ *
00019
00020
00021 --* *
00022 --**************************************************************
00023
00024 library ieee;
00025
00026 use ieee.std_logic_1164.all;
00027
00028 use ieee.std_logic_arith.all;
00029
00030 use ieee.std_logic_unsigned.all;
00031 library work;
00032 use work.main_components.all;
00033 use work.lcd_characters.all;
00034
00035
00036
00037 entity LCD is
00038 port (
00039 LCDCLK : in ;
00040 LCD_DIRECTION : out ;
00041 LCD_RS : out ;
00042 LCD_RW : out ;
00043 LCD_E : out ;
00044 LCD_DB : inout (7 downto 0);
00045 TAKE : in ;
00046 GIVE : in ;
00047 RES : in
00048 );
00049 end LCD;
00050
00051
00052 architecture LCD_arc of LCD is
00053
00054 signal lcd_clk : := '0';
00055 signal init_lcd : := '0';
00056 signal paint_lcd : := '0';
00057 signal busy_lcd : := '0';
00058 signal line1_lcd : lcd_line;
00059 signal line2_lcd : lcd_line;
00060 signal lcd_cs : lcd_states;
00061
00062 begin
00063
00064
00065 gen_lcdclk : prescaler --* gen slow clk for lcd
00066 generic map (divider => 52)
00067 port map(
00068 CLK => LCDCLK,
00069 CE => '1' ,
00070 R => RES ,
00071 TC => lcd_clk
00072 );
00073
00074 LCD_FSM : process(lcd_clk)
00075 variable cnt : range 0 to 7;
00076 begin
00077 if lcd_clk'event and lcd_clk = '1' then
00078 if RES = '1' then
00079 init_lcd <= '1';
00080 lcd_cs <= lcdinit;
00081 else
00082 case lcd_cs is
00083 when lcdinit =>
00084 cnt := cnt + 1;
00085 if cnt = 1 then
00086 init_lcd <= '1';
00087 cnt := 0;
00088 lcd_cs <= lcdwrite;
00089 else
00090 lcd_cs <= lcd_cs;
00091 end if;
00092
00093 when lcdwrite =>
00094 if busy_lcd = '0' then
00095 paint_lcd <= '1';
00096 if (TAKE and GIVE) = '1' then
00097 line1_lcd <= (ch_f_c, ch_u_c, ch_c_c, ch_k_c, ch_space, ch_e_c, ch_r, ch_r, ch_o, ch_r, ch_space, ch_space, ch_space, ch_space, ch_space, ch_space);
00098 line2_lcd <= (ch_space, ch_space, ch_space, ch_space, ch_space, ch_space, ch_space, ch_space, ch_space, ch_space, ch_space, ch_space, ch_space, ch_space, ch_space, ch_space);
00099 elsif TAKE = '1' then
00100 line1_lcd <= (ch_space, ch_space, ch_t_c, ch_a, ch_k, ch_i, ch_n, ch_g, ch_space, ch_space, ch_d_c, ch_a, ch_t, ch_a, ch_space, ch_space);
00101 line2_lcd <= (ch_star, ch_star, ch_star, ch_star, ch_star, ch_star, ch_star, ch_star, ch_star, ch_star, ch_star, ch_star, ch_star, ch_star, ch_star, ch_star);
00102 elsif GIVE = '1' then
00103 line1_lcd <= (ch_space, ch_space, ch_r_c, ch_e, ch_a, ch_d, ch_i, ch_n, ch_g, ch_space, ch_space, ch_o_c, ch_u, ch_t, ch_space, ch_space);
00104 line2_lcd <= (ch_i_c, ch_r, ch_e, ch_n, ch_a, ch_space, ch_w, ch_a, ch_i, ch_t, ch_i, ch_n, ch_g, ch_dot, ch_dot, ch_dot);
00105 else
00106 line1_lcd <= (ch_f_c, ch_u_c, ch_c_c, ch_k_c, ch_space, ch_e_c, ch_r, ch_r, ch_o, ch_r, ch_space, ch_space, ch_space, ch_space, ch_space, ch_space);
00107 line2_lcd <= (ch_space, ch_space, ch_space, ch_space, ch_space, ch_space, ch_space, ch_space, ch_space, ch_space, ch_space, ch_space, ch_space, ch_space, ch_space, ch_space);
00108 end if;
00109 else
00110 null;
00111 end if;
00112 lcd_cs <= lcd_cs;
00113
00114 when others =>
00115 lcd_cs <= lcdinit;
00116
00117 end case;
00118 end if;
00119 end if;
00120 end process LCD_FSM;
00121
00122
00123 lcd_contr : lcd_controller
00124 port map
00125 (
00126 CLOCK_LCD => lcd_clk ,
00127 CLOCK_ANI_I => lcd_clk,
00128 CLOCK_ANI_II => lcd_clk,
00129 LINE_I => line1_lcd,
00130 LINE_II => line2_lcd,
00131 LINE_I_PAINT => paint_lcd,
00132 LINE_II_PAINT => paint_lcd,
00133 LINE_I_MODE => "00",
00134 LINE_II_MODE => "00",
00135 AUTO_REFRESH_I => '1',
00136 AUTO_REFRESH_II => '1',
00137 BUSY => busy_lcd,
00138 DIRECTION => LCD_DIRECTION,
00139 RS => LCD_RS,
00140 RW => LCD_RW,
00141 DB => LCD_DB,
00142 E => LCD_E
00143 );
00144
00145
00146 end LCD_arc;
00147