`define LCDTimeExpire 25000 module LCD(clk, rst, button, LCD_Data, LCD_EN, LCD_RS, LCD_RW); input clk, rst; input button; output LCD_EN, LCD_RS, LCD_RW; output [7:0]LCD_Data; reg LCD_EN, LCD_RS, LCD_RW; reg [5:0]LCDStep; reg [7:0]LCD_Data; reg [10:0]LCD_DATA_state, n_LCD_DATA; reg [15:0]LCDDelay; always@(posedge clk) begin if(!rst) begin LCDStep = 6'd0; LCDDelay = 16'd0; n_LCD_DATA = 11'd0; LCD_DATA_state = 11'd0; {LCD_EN, LCD_RS, LCD_RW, LCD_Data} = 11'd0; end else if(LCDDelay == `LCDTimeExpire) begin LCDDelay = 16'd0; LCDStep = (LCDStep == 6'd40) ? LCDStep : LCDStep + 1'd1; //initial 7 state + 32bit LCD_DATA_state = 11'd0; end else begin LCDDelay = LCDDelay + 1'd1; LCD_DATA_state = n_LCD_DATA; end case(LCDStep) //LCD_DATA endcase {LCD_EN, LCD_RS, LCD_RW, LCD_Data} = LCD_DATA_state; end endmodule