云题海 - 专业文章范例文档资料分享平台

当前位置:首页 > 北邮数电实验报告(猜数字)

北邮数电实验报告(猜数字)

  • 62 次阅读
  • 3 次下载
  • 2025/12/3 9:25:11

x2<=key1; count1:=2;

else null; end if;

if key1 /= x2 and key1 /= x1 then

x3<=key1; count1:=3; else null; end if;

if key1 /= x3 and key1 /= x1 and key1 /= x2 then

x4<=key1; count1:=0; else null; end if;

when 2 =>

when 3 =>

when others => null;

end case;

如上是将矩阵键盘输入的数字显示在数码管上的代码,同时判断输入的数字不能出现重复,相当于消除了键盘抖动的问题。

count_a:=0; count_b:=0;

if x1=y1 then count_a:=count_a+1;end if; if x2=y2 then count_a:=count_a+1;end if; if x3=y3 then count_a:=count_a+1;end if; if x4=y4 then count_a:=count_a+1;end if; if x1=y2 then count_b:=count_b+1;end if; if x1=y3 then count_b:=count_b+1;end if; if x1=y4 then count_b:=count_b+1;end if; if x2=y1 then count_b:=count_b+1;end if; if x2=y3 then count_b:=count_b+1;end if; if x2=y4 then count_b:=count_b+1;end if; if x3=y1 then count_b:=count_b+1;end if; if x3=y2 then count_b:=count_b+1;end if; if x3=y4 then count_b:=count_b+1;end if; if x4=y1 then count_b:=count_b+1;end if; if x4=y2 then count_b:=count_b+1;end if; if x4=y3 then count_b:=count_b+1;end if;

如上是对A、B的计数,用基本的if语句。

详细程序见附件。

五、 功能说明及资源利用情况

按BTN6按键开始游戏,即可开始用矩阵键盘输入数字,数字不能出现重复(输入了重复的数字时将不会算作输入了数字),如图,输入了6312:

按BTN1按键确定输入的数字即可开始游戏,开始计时:

用矩阵键盘输入猜的数字,数字不允许出现重复,按BTN2按键确定,如图输入1234,出现0和3表示0A3B,并且点阵显示X、蜂鸣器警报表示猜的不对:

当时间结束时仍没有猜对数字时,点阵显示囧表示到时间了:

如果在64秒内猜对了数字,则点阵显示笑脸表示猜对了:

在整个猜数字的过程中均可按BTN7按键重置游戏,再次按BTN6开始。 矩阵键盘顺序: 1 2 3 4 5 6 7 8

搜索更多关于: 北邮数电实验报告(猜数字) 的文档
  • 收藏
  • 违规举报
  • 版权认领
下载文档10.00 元 加入VIP免费下载
推荐下载
本文作者:...

共分享92篇相关文档

文档简介:

x2<=key1; count1:=2; else null; end if; if key1 /= x2 and key1 /= x1 then x3<=key1; count1:=3; else null; end if; if key1 /= x3 and key1 /= x1 and key1 /= x2 then x4<=key1; count1:=0; else null; end if; when 2 => whe

× 游客快捷下载通道(下载后可以自由复制和排版)
单篇付费下载
限时特价:10 元/份 原价:20元
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219
Copyright © 云题海 All Rights Reserved. 苏ICP备16052595号-3 网站地图 客服QQ:370150219 邮箱:370150219@qq.com