lcd_control_rtl_v3.vhd

来自「LCD display driver for xilinx fpga」· VHDL 代码 · 共 1,428 行 · 第 1/3 页

VHD
1,428
字号
		   state_lcd <= init19;		   count     <= 0;		   		 elsif (count = t_pulse_c) then		                      lcd_rw    <= '1';   		   count     <= count + 1;		   		 elsif (count = (t_pulse_c - t_hold_c)) then		   lcd_e     <= '0';		   		   count     <= count + 1;		   		 elsif (count = t_setup_c) then		   lcd_e     <= '1';   		   count     <= count + 1;		   		 else		   count     <= count + 1;		 end if;	       when init19 => -- wait for 1 祍		 if(count = (t_pulse_c + t_upper_lower_c)) then		   lcd_data  <= set_ddram_address_c2(3 downto 0);                   lcd_rw    <= '0';		   		   state_lcd <= init20;		   count     <= 0;		   		 elsif (count = t_pulse_c) then		                      lcd_rw    <= '1';   		   count     <= count + 1;		   		 elsif (count = (t_pulse_c - t_hold_c)) then		   lcd_e     <= '0';		   		   count     <= count + 1;		   		 elsif (count = t_setup_c) then		   lcd_e     <= '1';   		   count     <= count + 1;		   		 else		   count     <= count + 1;		 end if;	       when init20 => -- wait for 40 祍		 if(count = (t_pulse_c + t_next_pulse_c)) then		   lcd_data  <= data_3_c(7 downto 4);                   lcd_rw    <= '0';		                      lcd_rs    <= '1';		   		   state_lcd <= init21;		   count     <= 0;		   		 elsif (count = t_pulse_c) then		                      lcd_rw    <= '1';   		   count     <= count + 1;		   		 elsif (count = (t_pulse_c - t_hold_c)) then		   lcd_e     <= '0';		   		   count     <= count + 1;		   		 elsif (count = t_setup_c) then		   lcd_e     <= '1';   		   count     <= count + 1;		   		 else		   count     <= count + 1;		 end if;	       when init21 => -- wait for 1 祍		 if(count = (t_pulse_c + t_upper_lower_c)) then		   lcd_data  <= data_3_c(3 downto 0);                   lcd_rw    <= '0';		   		   state_lcd <= init22;		   count     <= 0;		   		 elsif (count = t_pulse_c) then		                      lcd_rw    <= '1';   		   count     <= count + 1;		   		 elsif (count = (t_pulse_c - t_hold_c)) then		   lcd_e     <= '0';		   		   count     <= count + 1;		   		 elsif (count = t_setup_c) then		   lcd_e     <= '1';   		   count     <= count + 1;		   		 else		   count     <= count + 1;		 end if;	       when init22 => -- wait for 40 祍		 if(count = (t_pulse_c + t_next_pulse_c)) then		   lcd_data  <= data_4_c(7 downto 4);                   lcd_rw    <= '0';		   		   state_lcd <= init23;		   count     <= 0;		   		 elsif (count = t_pulse_c) then		                      lcd_rw    <= '1';   		   count     <= count + 1;		   		 elsif (count = (t_pulse_c - t_hold_c)) then		   lcd_e     <= '0';		   		   count     <= count + 1;		   		 elsif (count = t_setup_c) then		   lcd_e     <= '1';   		   count     <= count + 1;		   		 else		   count     <= count + 1;		 end if;	       when init23 => -- wait for 1 祍		 if(count = (t_pulse_c + t_upper_lower_c)) then		   lcd_data  <= data_4_c(3 downto 0);                   lcd_rw    <= '0';		   		   state_lcd <= init24;		   count     <= 0;		   		 elsif (count = t_pulse_c) then		                      lcd_rw    <= '1';   		   count     <= count + 1;		   		 elsif (count = (t_pulse_c - t_hold_c)) then		   lcd_e     <= '0';		   		   count     <= count + 1;		   		 elsif (count = t_setup_c) then		   lcd_e     <= '1';   		   count     <= count + 1;		   		 else		   count     <= count + 1;		 end if;		 	       when init24 => -- wait for 40 祍		 if(count = (t_pulse_c + t_next_pulse_c)) then		   lcd_data  <= data_5_c(7 downto 4);                   lcd_rw    <= '0';		   		   state_lcd <= init25;		   count     <= 0;		   		 elsif (count = t_pulse_c) then		                      lcd_rw    <= '1';   		   count     <= count + 1;		   		 elsif (count = (t_pulse_c - t_hold_c)) then		   lcd_e     <= '0';		   		   count     <= count + 1;		   		 elsif (count = t_setup_c) then		   lcd_e     <= '1';   		   count     <= count + 1;		   		 else		   count     <= count + 1;		 end if;	       when init25 => -- wait for 1 祍		 if(count = (t_pulse_c + t_upper_lower_c)) then		   lcd_data  <= data_5_c(3 downto 0);                   lcd_rw    <= '0';		   		   state_lcd <= init26;		   count     <= 0;		   		 elsif (count = t_pulse_c) then		                      lcd_rw    <= '1';   		   count     <= count + 1;		   		 elsif (count = (t_pulse_c - t_hold_c)) then		   lcd_e     <= '0';		   		   count     <= count + 1;		   		 elsif (count = t_setup_c) then		   lcd_e     <= '1';   		   count     <= count + 1;		   		 else		   count     <= count + 1;		 end if;		 	       when init26 => -- wait for 40 祍		 if(count = (t_pulse_c + t_next_pulse_c)) then		   lcd_data  <= data_6_c(7 downto 4);                   lcd_rw    <= '0';		   		   state_lcd <= init27;		   count     <= 0;		   		 elsif (count = t_pulse_c) then		                      lcd_rw    <= '1';   		   count     <= count + 1;		   		 elsif (count = (t_pulse_c - t_hold_c)) then		   lcd_e     <= '0';		   		   count     <= count + 1;		   		 elsif (count = t_setup_c) then		   lcd_e     <= '1';   		   count     <= count + 1;		   		 else		   count     <= count + 1;		 end if;	       when init27 => -- wait for 1 祍		 if(count = (t_pulse_c + t_upper_lower_c)) then		   lcd_data  <= data_6_c(3 downto 0);                   lcd_rw    <= '0';		   		   state_lcd <= init28;		   count     <= 0;		   		 elsif (count = t_pulse_c) then		                      lcd_rw    <= '1';   		   count     <= count + 1;		   		 elsif (count = (t_pulse_c - t_hold_c)) then		   lcd_e     <= '0';		   		   count     <= count + 1;		   		 elsif (count = t_setup_c) then		   lcd_e     <= '1';   		   count     <= count + 1;		   		 else		   count     <= count + 1;		 end if;		 	       when init28 => -- wait for 40 祍		 if(count = (t_pulse_c + t_next_pulse_c)) then		   lcd_data  <= data_7_c(7 downto 4);                   lcd_rw    <= '0';		   		   state_lcd <= init29;		   count     <= 0;		   		 elsif (count = t_pulse_c) then		                      lcd_rw    <= '1';   		   count     <= count + 1;		   		 elsif (count = (t_pulse_c - t_hold_c)) then		   lcd_e     <= '0';		   		   count     <= count + 1;		   		 elsif (count = t_setup_c) then		   lcd_e     <= '1';   		   count     <= count + 1;		   		 else		   count     <= count + 1;		 end if;	       when init29 => -- wait for 1 祍		 if(count = (t_pulse_c + t_upper_lower_c)) then		   lcd_data  <= data_7_c(3 downto 0);                   lcd_rw    <= '0';		   		   state_lcd <= init30;		   count     <= 0;		   		 elsif (count = t_pulse_c) then		                      lcd_rw    <= '1';   		   count     <= count + 1;		   		 elsif (count = (t_pulse_c - t_hold_c)) then		   lcd_e     <= '0';		   		   count     <= count + 1;		   		 elsif (count = t_setup_c) then		   lcd_e     <= '1';   		   count     <= count + 1;		   		 else		   count     <= count + 1;		 end if;		 		 	       when init30 => -- wait for 40 祍		 if(count = (t_pulse_c + t_next_pulse_c)) then		   lcd_data  <= data_8_c(7 downto 4);                   lcd_rw    <= '0';		   		   state_lcd <= init31;		   count     <= 0;		   		 elsif (count = t_pulse_c) then		                      lcd_rw    <= '1';   		   count     <= count + 1;		   		 elsif (count = (t_pulse_c - t_hold_c)) then		   lcd_e     <= '0';		   		   count     <= count + 1;		   		 elsif (count = t_setup_c) then		   lcd_e     <= '1';   		   count     <= count + 1;		   		 else		   count     <= count + 1;		 end if;		 	       when init31  => null; -- wait for 1 祍	       when others =>		 state_lcd  <= lcdreset;	     end case;	  end if;				end process;	 end rtl;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?