📄 common_fun.lst
字号:
C51 COMPILER V8.02 COMMON_FUN 01/10/2009 20:00:41 PAGE 1
C51 COMPILER V8.02, COMPILATION OF MODULE COMMON_FUN
OBJECT MODULE PLACED IN common_fun.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE common_fun.c BROWSE DEBUG OBJECTEXTEND
line level source
1 #include "common_fun.h"
2 #include "Mini51b.h"
3
4 void delay(unsigned int t)
5 {
6 1 while(t--);
7 1 //测量如下:
8 1 //delay(1);//15.2us
9 1 //delay(2);//20.2us
10 1 //delay(5);//34.8us
11 1 //delay(10);//59.2us
12 1 //delay(20);//108us
13 1 //delay(50);//256us
14 1 //delay(100);//500us
15 1 //delay(200);//984us
16 1 //delay(500);//2460us
17 1 //delay(1000);//4880us
18 1 //delay(2000);//9760us
19 1 //delay(5000);//24400us
20 1 }
21
22 //延时nms子程序,
23 void delay_ms(unsigned int n)
24 {
25 1 unsigned char j;
26 1 while(n--)
27 1 for(j=0;j<230;j++);//230是实验测试所得!
28 1 }
29 /*
30
31 参数n>0;
32 延时 1ms:delay_ms(1);
33 延时 11ms:delay_ms(11);
34 延时123ms:delay_ms(123);
35 延时155ms:delay_ms(155);
36 */
37
38
39 /*/一般常用通用延时函数
40 void delay(unsigned char t)
41 {
42 while(t--);
43 }
44
45 测量如下:
46 //delay(1);//10.88us
47 //delay(2);//14us
48 //delay(5);//23.8us
49 //delay(10);//40us
50 //delay(20);//72.8us
51 //delay(50);//170us
52 //delay(100);//332us
53 //delay(200);//656us
54 //delay(250);//824us
55
C51 COMPILER V8.02 COMMON_FUN 01/10/2009 20:00:41 PAGE 2
56 */
57
58 /*调试用*/
59 //通用数码管显示函数,传入数据0~9999
60 void seg7_disp(uint number)
61 {
62 1 unsigned char code tab1[20]= {0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,};
63 1 unsigned char temp,flag=0;
64 1
65 1 if(number < 10000)
66 1 {
67 2 //千位数码管
68 2 temp = number/1000%10;
69 2 if (temp) {
70 3 SEG_Q = tab1[temp];
71 3 flag = 1;
72 3 }
73 2 else {
74 3 SEG_Q = 0xff;//数码管熄灭
75 3 flag = 0;
76 3 }
77 2
78 2 //百位数码管
79 2 temp = number/100%10;
80 2 if(flag | temp) {
81 3 SEG_B = tab1[temp];
82 3 flag = 1;
83 3 }
84 2 else {
85 3 SEG_B = 0xff;//数码管熄灭
86 3 flag = 0;
87 3 }
88 2
89 2 //十位数码管
90 2 temp = number/10%10;
91 2 if(flag | temp) SEG_S = tab1[temp];
92 2 else SEG_S = 0xff;//数码管熄灭
93 2
94 2 //个位数码管
95 2 temp = number%10;
96 2 SEG_G = tab1[temp];
97 2 }
98 1 else {
99 2 SEG_Q = 0xbf;//"-"
100 2 SEG_B = 0xbf;
101 2 SEG_S = 0xbf;
102 2 SEG_G = 0xbf;
103 2 }
104 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 213 ----
CONSTANT SIZE = 20 ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = ---- 2
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 + -