Question: I have written Verilog code that allows real - time input of arbitrary characters using the cursor, displaying them on a 2 - line (

I have written Verilog code that allows real-time input of arbitrary characters using the cursor, displaying them on a 2-line (16x2display window)LCD across LINE1and LINE2.Please modify my code by adding an input to allow the cursor to switch between LINE1and LINE2in the Verilog code.
```
module LCD_controller(rst, CIk. Icd_e. Icd_rs, Icd_rw. Icd_data; Ied, number_btn, control_btn):
input rst. clk;
input [9:0] number_btn;
input [1:0] control_btn:
wire [9:0] rumber_btn_t:
wite [1:0] control_btn_t:
oneshot_unlversal #(.w10tH(12)) A1(clk. rst.{number_btn[9:0]. control_btn[1:0]}.{number_btn_t{9:0]. control_bin_t[1:0]}):
output Icd_e, Iod_rs, Icd_rm:
output reg [7:0] Iod_data:
output reg [7:0] led:
wire lod_e:
reg led_rs. lod_rw:
feg [7:0] ont:
reg [2:0] state:
parameter DELAY =3'b000.
FUNCTION_SET =3'b001,
DISP_ONOFF =3'b010,
ENTRY_MODE =3'b011,
SET_ADORESS =3'b100,
DELAY_T =3'b101.
WRITE =3'b110,
CURSOR =3'b111;
always @(posedge clk or negedge rst)
begin
if(Irst) begin
state <= DELAY:
led <=8'b0000_0000:
end
else begin
case(state)
DELAY : bEgin
if(cnt ==70) state <= FUNCTION_SET:
led <=8'b1000_0000:
``````
FUNCTION_SET : begin
if(cnt =30) state <= DISP_ONOFF;
led <=8'b0100_0000:
end
DISP_ONDFF : begin
if(cnt =30) state <= ENTRY_MODE;
led <=8*b0010_0001;
end
ENTRY_MODE : begin
if(cnt =30) state <= SET_ADORESS:
led <=8'b0001_0000;
end
SET_ADORESS : begin
if(cnt =100) state <= DELAY_Ti
led <=8'b0000_1000;
end
DELAY_T : begin
state <=|number_btn_t ? HRITE : (lcontrol_btn_t ? CURSOR : OELAY_T);
led <=8'b0000_0100;
end
MRITE: begin
If(cnt ==30) state <= DELAY_T:
led <=8'b0000_0010:
end
CURSOR: begin
if(cnt ==30) state <= DELAY_T:
led <=8'b0000_0001:
end
endcase
end
end
always (posedge clk or negedge rst)
begin
if(Irst)
cnt <=8'b0000_0000;
else
begin
case(state)
DELAY :
if(cnt >=70) ont <=0;
else cnt <= cnt+1;
``````
FUNCTION_SET :
if(cnt >=30) cnt <=0;
else cnt <= cnt +1;
OISP_ONOFF :
if(cnt s=30) cnt <=0;
else cnt <= cnt +1;
ENTRY MODE:
if (cnt >=30) cnt <=0;
else cnt <= cnt +1;
SET_ADDRESS :
if(cnt >=100) cnt <=0;
else ont <= cnt +1:
OELAY_T :
cnt & & ;
MRITE:
if(cnt >=30) cnt <=0;
else cnt <= cnt +1:
CURSOR :
if(cnt >=30) cnt <=0:
else cnt <= cnt +1;
endcase
end
end
always f(posedge clk or negedge rst)
begin
if(lrst)
{lod_rs, led_ri,, Icd_data}<=10'b0_0_0000_0001;
else
begin
case(state)
FUNCTION_SET :
{lcd_rs, Icd_rm, Icd_data}<=10'b0_0_0011_1000;
OISP_ONOFF :
{lod_rs, Icd_rw, Icd_data}}=10'b0_0_0000_1111:
ENTRY_MOOE:
{lcd_rs, lcd_rw, Icd_data}<=10'b0_0_0000_0110;
SET_ADLRESS :
{lcd_rs, Icd_rw, Icd_data}<=10'b0_0_0000_0010;
DELAY_T :
{lod_rs, icd_rw, Icd_data}<=10'b0_0_0000_1111:
``````
if(cnt ==20) begin
case(number_btn)
10'b1000_0000_00:{led_rs, Icd_rw, Icd_data}<=10'b1_0_0011_0001;
10'b0100_0000_00 : {lcd_rs, Icd_rw, Icd_data}<=10'b1_0_0011_0010;
10'b0010_0000_00 : {Icd_rs, Icd_riw, Icd_data}}=10'b1_0_0011_0011;
10'b0001_0000_00 : {lcd_rs, Ict_rm, Icd_data}}=10.b1_0_0011_0100;
10'b0000_1000_00 : {lcd_rs, Icd_rm, Icd_data}<=10'b1_0_0011_0101;
10'b0000_0100_00 : {lod_rs, Icd_rw; Icd_data}}=10'b1_0_0011_0110;
10'b0000_0010_00 : {lcd_rs, Icd_rw, Icd_data}<=10'b1_0_0011_0111;
10'b0000_0001_00 : {lcd_rs,1cd_rw, Icd_data<

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!