好文档 - 专业文书写作范文服务资料分享网站

PLD与数字系统设计实验报告 - 图文

天下 分享 时间: 加入收藏 我要投稿 点赞

9: //判断数字键盘收到的第一个密码是否正确

begin if(w_flag==0) begin state<=9; cs1<=1; cs2<=1; data<=8'h3f; end else begin if((di_mi==0)&&(pw0==key_get)) state<=13; else begin state<=6; char_cnt<=176; end end end 10: //判断数字键盘收到的第二个密码是否正确 begin if(w_flag==0||key_get==pw0) begin state<=10; cs1<=1; cs2<=1; data<=8'h3f; end else begin if((di_mi==1)&&(pw1==key_get)) state<=13; else begin state<=6; char_cnt<=176; end end end 11: //判断数字键盘收到的第三个密码是否正确

10

begin if(w_flag==0||key_get==pw1) begin state<=11; cs1<=1; cs2<=1; data<=8'h3f; end else begin if((di_mi==2)&&(pw2==key_get)) state<=13; else begin state<=6; char_cnt<=176; end end end 12: //判断数字键盘收到的第四个密码是否正确 begin if(w_flag==0||key_get==pw2) begin state<=12; cs1<=1; cs2<=1; data<=8'h3f; end else begin if((di_mi==3)&&(pw3==key_get)) state<=state+1; else begin state<=6; char_cnt<=176; end end end 13: //显示数字页初始化 begin

11

state<=state+1;

if((mi_cnt==0)||(mi_cnt==16)||(mi_cnt==32)||(mi_cnt==48)) data<=8'hb8; else

if((mi_cnt==8)||(mi_cnt==24)||(mi_cnt==40)||(mi_cnt==56)) data<=8'hb9; end 14: //显示数字列初始化 begin state<=state+1; if((mi_cnt==0)||(mi_cnt==8)) data<=8'h50; else if((mi_cnt==16)||(mi_cnt==24)) data<=8'h58; else if((mi_cnt==32)||(mi_cnt==40)) data<=8'h60; else if((mi_cnt==48)||(mi_cnt==56)) data<=8'h68; end 15: //写数字数据给LCD begin cs1<=0; cs2<=1; if(mi_cnt>=0&&mi_cnt<=7) begin mi_cnt<=mi_cnt+1'b1; data<=mi_disp; if(mi_cnt==7) state<=13; else state<=15; end else if(mi_cnt>=8&&mi_cnt<=15) begin mi_cnt<=mi_cnt+1'b1; data<=mi_disp; if(mi_cnt==15) begin state<=10; di_mi<=2'b01;

12

end else state<=15; end

else if(mi_cnt>=16&&mi_cnt<=23) begin mi_cnt<=mi_cnt+1'b1; data<=mi_disp; if(mi_cnt==23) state<=13; else state<=15; end

else if(mi_cnt>=24&&mi_cnt<=31) begin mi_cnt<=mi_cnt+1'b1; data<=mi_disp; if(mi_cnt==31) begin state<=11; di_mi<=2'b10; end else state<=16; end

else if(mi_cnt>=32&&mi_cnt<=39) begin mi_cnt<=mi_cnt+1'b1; data<=mi_disp; if(mi_cnt==39) state<=13; else state<=15; end

else if(mi_cnt>=40&&mi_cnt<=47) begin mi_cnt<=mi_cnt+1'b1; data<=mi_disp;

13

if(mi_cnt==47) begin state<=12; di_mi<=2'b11; end else state<=15; end else if(mi_cnt>=48&&mi_cnt<=55) begin mi_cnt<=mi_cnt+1'b1; data<=mi_disp; if(mi_cnt==55) state<=13; else state<=15; end else if(mi_cnt>=56&&mi_cnt<=63) begin mi_cnt<=mi_cnt+1'b1; data<=mi_disp; if(mi_cnt==63) begin state<=state+1; char_cnt<=144; di_mi<=2'b00; end else state<=WRITERAM1; end end

always@(mi_cnt) begin case(mi_cnt) 6'h00:mi_disp<=8'h00;

6'h01:mi_disp<=8'hE0; 6'h02:mi_disp<=8'h10; 6'h03:mi_disp<=8'h08; 6'h04:mi_disp<=8'h08;

14

PLD与数字系统设计实验报告 - 图文

推荐度:
点击下载文档文档为doc格式
6eim531m366bod04q6zu
领取福利

微信扫码领取福利

微信扫码分享