📄 jishu-miao-0-9999999.9.lst
字号:
C51 COMPILER V7.08 JISHU_MIAO_0_9999999_9 12/21/2006 15:02:52 PAGE 1
C51 COMPILER V7.08, COMPILATION OF MODULE JISHU_MIAO_0_9999999_9
OBJECT MODULE PLACED IN jishu-miao-0-9999999.9.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE jishu-miao-0-9999999.9.c BROWSE DEBUG OBJECTEXTEND
line level source
1 /******************************************************************
2 * *
3 * ME500单片机开发系统演示程序 - 0-9999999.9 秒计时 *
4 * *
5 * 8位数码管显示 *
6 * *
7 * 版本: V1.0 (2006/11/20) *
8 * 作者: gguoqing (Email: gguoqing@willar.com) *
9 * 网站: www.willar.com(伟纳电子) www.mcusj.com(伟纳单片机世界) *
10 * 时间: 2006/10/12 *
11 * *
12 *【版权】Copyright(C)伟纳电子 www.willar.com All Rights Reserved *
13 *【声明】此程序仅用于学习与参考,引用请注明版权和作者信息! *
14 * *
15 *******************************************************************/
16
17 #include <reg51.h>
18 #include <intrins.h>
19
20 #define uchar unsigned char
21 #define uint unsigned int
22
23 uchar Count;
24
25 sbit DIN = P0^7; //小数点
26
27 uchar code LEDData[ ] = {0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,
28 0x80,0x90,0xff};
29
30 uchar data display[8] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
31
32 uchar code scan_bit[] = {0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe};
33
34 /*********************************************************
35 延时函数
36 *********************************************************/
37 void Delay(uint num)//延时函数
38 {
39 1 while( --num );
40 1 }
41
42 /********************************************************
43 显示函数
44 *********************************************************/
45 play()
46 {
47 1 uchar i;
48 1 for(i=0;i<8;i++)
49 1 {
50 2 P0=LEDData[display[i]]; //显示个位
51 2 P2=scan_bit[i];
52 2 if(scan_bit[i]==0xbf)
53 2 DIN=0; //加小数点
54 2 Delay(50);
55 2 }
C51 COMPILER V7.08 JISHU_MIAO_0_9999999_9 12/21/2006 15:02:52 PAGE 2
56 1 P2=0xff; //关闭显示
57 1 }
58
59 /********************************************************
60 主函数
61 *********************************************************/
62 main()
63 {
64 1 P0=0xff;
65 1 P2=0xff;
66 1 Count=0x00;
67 1 TMOD=0x01;
68 1 TH0=0x4c; TL0=0x00; //50ms定时
69 1 EA=1; ET0=1; TR0=1;
70 1
71 1 while(1)
72 1 play();
73 1 }
74
75 /*********************************************************
76 Time0中断函数
77 **********************************************************/
78 void Time0(void) interrupt 1 using 0
79 {
80 1 TH0=0x4c; //50ms定时
81 1 TL0=0x00;
82 1 Count++;
83 1 if(Count==2)
84 1 {
85 2 Count=0;
86 2 display[0]++; //0.1S
87 2 }
88 1 if(display[0]==10)
89 1 {
90 2 display[0]=0;
91 2 display[1]++; //个位
92 2 }
93 1 if(display[1]==10)
94 1 {
95 2 display[1]=0;
96 2 display[2]++; //十位
97 2 }
98 1 if(display[2]==10)
99 1 {
100 2 display[2]=0;
101 2 display[3]++; //百位
102 2 }
103 1 if(display[3]==10)
104 1 {
105 2 display[3]=0;
106 2 display[4]++; //千位
107 2 }
108 1 if(display[4]==10)
109 1 {
110 2 display[4]=0;
111 2 display[5]++; //万位
112 2 }
113 1 if(display[5]==10)
114 1 {
115 2 display[5]=0;
116 2 display[6]++; //十万位
117 2 }
C51 COMPILER V7.08 JISHU_MIAO_0_9999999_9 12/21/2006 15:02:52 PAGE 3
118 1 if(display[6]==10)
119 1 {
120 2 display[6]=0;
121 2 display[7]++; //百万位
122 2 }
123 1 if(display[7]==10)
124 1 {
125 2 display[7]=0;
126 2 }
127 1 }
128
129 /*********************************************************/
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 183 ----
CONSTANT SIZE = 19 ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 9 ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -