单片机课程设计实验报告
(仅供参考)
单片机最小系统
姓名:
系别:
专业:
1、目的要求
目的:通过对单片机最小系统的研究, 掌握单片机各引脚功能,理解单片机工作过程及原理,以及与各种外部扩展器件的连接,能够自己运用单片机来解决实际问题。
要求:搭建51单片机最小系统,用LED闪烁验证。
实现串口通信。
搭建LED数码管多位动态显示电路,并用程序验证。
编写外部中断INT0的中断服务程序,单片机持续发送串口信息,每来一次中断翻转LED灯。
利用已经做过的中断、数码管实验,实现按键次数累加,并在数码管上显示。
2、设计过程
用LED闪烁验证51单片机最小系统的电路
数码管多位动态显示电路
3、程序代码
最小系统:/*------------------------------------------------------------------------------
Copyright 1995-1999 Keil Software, Inc.
------------------------------------------------------------------------------*/
#include <> /* special function register declarations */
/* for the intended 8051 derivative */
#include <> /* prototype declarations for I/O functions */
#ifdef MONITOR51 /* Debugging with Monitor-51 needs */
char code reserve [3] _at_ 0x23; /* space for serial interrupt if */
#endif /* Stop Exection with Serial Intr. */
/* is enabled */
void delay()
{ int t;
for(t=0;t<0x5000;t++);
}
/*------------------------------------------------
The main C function. Program execution starts
here after stack initialization.
------------------------------------------------*/
void main (void) {
while (1) {
P1 ^= 0x80; /* Toggle each time we print */
delay();
}
}
四位数码管:
/*========7段数码管实验=========*/
#include ""
code unsigned char ledtab[]={0X
3F,0X6,0X5B,0X4F,0X66,0X6D,0X7D,0X7,0X7F,0X6F};
/*0~9的段
单片机最小系统实验报告 来自淘豆网m.daumloan.com转载请标明出处.