Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
16 years ago

cyclone III: LCD Help needed

I have been trying to program the lcd on the cyclone iii but i don;t get any respone...i even probed the pins to check if what the pins were what they should be and most of the data pins just stay on high.........The program i wrote is shown below: and i assign the pinouts according to the reference manual.....help is urgently needed............

.............................................

module lcd_display (clk,user_dipswitch2,user_dipswitch3,mydata,lcd_rs, lcd_rw, lcd_e, lcd_code);

input clk;

input user_dipswitch2;

input user_dipswitch3;

input [7:0] mydata;

integer count;

reg busy_flag;

//reg [6:0] lcd_code

output reg lcd_rs ;

output reg lcd_rw ;

output reg [7:0]lcd_code;

output reg lcd_e;

initial

begin

busy_flag <= lcd_code[7];

lcd_rs <= 0;

lcd_rw <= 0;

lcd_e <= 0;

count <= 0;

end

always @ (posedge clk )

begin

lcd_rs <= 0;

lcd_rw <= 1;

if (user_dipswitch2 && !busy_flag) //initialize lcd

begin

lcd_rs <= 0;

lcd_rw <= 0;

lcd_e <= 1;

case (count)

0: begin //function set

lcd_code <= 8'b00111100;

count <= 1;

end

1: begin // Display on

lcd_code <= 8'b00001111;

count <= 2;

end

2: begin // Display clear

lcd_code <= 8'b00000001;

count <= 3;

end

3: begin // Entry mode set

lcd_code <= 8'b00000111;

count <= 4;

end

4: lcd_e <= 0;

endcase

end

else if (!user_dipswitch2 && !busy_flag && user_dipswitch3)

begin

lcd_rs<= 1;

lcd_rw <= 0;

lcd_e <= 1;

lcd_code = 8'b11100011;

end

end

endmodule

2 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    This kind of LCD is extremely slow, what is your clock frequency?

    commands like "clear screen", take to execute even 40 ms.

    Did you simulate this module?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    thanks for the reply....am fairly new to verilog...am not familliar about how to introduce the timing into the hardware......am using 50MHz