欢迎来到天天文库
浏览记录
ID:61444847
大小:1.35 MB
页数:75页
时间:2021-01-31
《单片机实验内容.doc》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、电工电子实验单片机实验指导书电工电子实验教学中心2008年11月目 录1.闪烁灯┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅22.模拟开关灯┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅33.广告灯的左移右移┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅54.广告灯(利用取表方式)┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅65.蜂鸣器报警信号产生┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅86.按键识别方法之一┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅97.00-99计数器┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅128.00-
2、59秒计时器(利用软件延时)┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅139.动态数码显示技术┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅1510.4×4矩阵式键盘识别技术┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅1711.定时计数器T0作定时应用技术(一)┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅2112.定时计数器T0作定时应用技术(二)┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅2313.99秒马表设计┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅2614.“嘀、嘀、……”报警声┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅2815.“叮咚”门铃┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅30
3、16.数字钟(★)┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅3317.拉幕式数码显示技术┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅3718.电子琴┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅4019.模拟计算器数字输入及显示┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅4420.8×8LED点阵显示技术┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅4621.点阵LED“0-9”数字显示技术┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅4822.点阵式LED简单图形显示技术┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅5223.ADC0809A/D转换器基本应用技术┅┅┅┅┅┅┅┅
4、┅┅┅┅┅┅┅┅5424.数字电压表┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅5725.两点间温度控制┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅5926.四位数数字温度计┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅6027.6位数显频率计数器┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅6228.电子密码锁设计┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅6329.4×4键盘及8位数码管显示构成的电子密码锁┅┅┅┅┅┅┅┅┅┅┅6530.带有存储器功能的数字温度计-DS1624技术应用┅┅┅┅┅┅┅┅┅┅6631.DS18B20数字温度计使用┅┅┅┅
5、┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅711.闪烁灯1、实验任务如图1.1所示:在8个发光二极管不停地一亮一灭,一亮一灭的时间间隔为0.2秒。2、电路原理图图1.13、系统板上硬件资源发光二极管单元地址:2FFFH4、程序设计内容(1)延时程序的设计方法作为单片机的指令的执行的时间是很短,数量大微秒级,因此,我们要求的闪烁时间间隔为0.2秒,相对于微秒来说,相差太大,所以我们在执行某一指令时,插入延时程序,来达到我们的要求,但这样的延时程序是如何设计呢?下面具体介绍其原理:如图4.1.1所示的石英晶体为12MHz,因此,1个机器周期为1微秒机器周期微秒DELAY:MOVR6
6、,#202个 2D1:MOVR7,#2482个 2 2+2×248=498 20×DJNZR7,$2个 2×248 (498DJNZR6,D12个 2×20=40 10002因此,上面的延时程序时间为10.002ms。由以上可知,当R6=10、R7=248时,延时5ms,R6=20、R7=248时,延时10ms,以此为基本的计时单位。如本实验要求0.2秒=200ms,10ms×R5=200ms,则R5=20,延时子程序如下:DELAY:MOVR5,#20D1:MOVR6,#20D2:MOVR7,#248DJNZ
7、R7,$DJNZR6,D2DJNZR5,D1RET(2)输出控制根据发光二极管的单向导电性可知,当给端口2FFFH单元输出高电平时,发光二极管熄灭;当端口2FFFH单元输出低电平,发光二极管亮;5、程序框图 如图1.2所示 图1.26、汇编源程序ORG0000hAJMP0030HORG0030HSTART:MOVDPTR,#2FFFHMOVA,#55HMOVX@DPTR,ALCALLDELAYCPLALCALLDEL
此文档下载收益归作者所有