📄 adc0808 diy.lst
字号:
C51 COMPILER V8.09 ADC0808_DIY 04/01/2009 23:05:11 PAGE 1
C51 COMPILER V8.09, COMPILATION OF MODULE ADC0808_DIY
OBJECT MODULE PLACED IN ADC0808 DIY.OBJ
COMPILER INVOKED BY: C:\Keil C51\C51\BIN\C51.EXE ADC0808 DIY.c BROWSE DEBUG OBJECTEXTEND
line level source
1 #include<reg51.h>
2 #include<stdio.h>
3 #define uchar unsigned char
4 #define uint unsigned int
5 #define N 5
6 //uchar code dispbitcode[10]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
7 uchar code dispbitcode[10]={0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x90};
8 uint temp;
9 uchar getdata;
10 uchar temp_H;
11 uchar temp_M;
12 uchar temp_L;
13 sbit P17=P1^7;
14 sbit ST=P3^0;
15 sbit CLK=P3^1;
16 sbit EOC=P3^2;
17 sbit OE=P3^3;
18 sbit P34=P3^4;
19 sbit P35=P3^5;
20 sbit P36=P3^6;
21 sbit P20=P2^0;
22 sbit P21=P2^1;
23 sbit P22=P2^2;
24 sbit P23=P2^3;
25
26 void inital()
27 {
28 1 TMOD=0x01;
29 1 TH0=(65536-200)/256;
30 1 TL0=(65536-200)%256;
31 1 ET0=1;
32 1 EA=1;
33 1 TR0=1;
34 1 }
35
36
37 void intr()interrupt 1
38 {
39 1
40 1 TH0=(65536-200)/256;
41 1 TL0=(65536-200)%256;
42 1 CLK=~CLK;
43 1 }
44
45
46 void Delay(unsigned int i)
47 {
48 1 unsigned int j;
49 1
50 1 for(;i>1;i--)
51 1 {
52 2 for(j=0;j<125;j++);
53 2 {;}
54 2 }
55 1 }
C51 COMPILER V8.09 ADC0808_DIY 04/01/2009 23:05:11 PAGE 2
56
57 void display()
58 {
59 1 P34=1;
60 1 P35=0;
61 1 P36=0;
62 1 P1=dispbitcode[temp_H];
63 1 P17=0;
64 1 P34=1;
65 1 P35=0;
66 1 P36=0;
67 1 Delay(N);
68 1 P1=0xff;
69 1
70 1 P1=dispbitcode[temp_M];
71 1 P34=0;
72 1 P35=1;
73 1 P36=0;
74 1 Delay(N);
75 1 P1=0xff;
76 1
77 1 P1=dispbitcode[temp_L];
78 1 P34=0;
79 1 P35=0;
80 1 P36=1;
81 1 Delay(N);
82 1 P1=0xff;
83 1 }
84
85
86 void main()
87 {
88 1 inital();
89 1 P2=0xff;
90 1 while(1)
91 1 {
92 2 ST=0;
93 2 OE=0;
94 2 ST=1;
95 2 ST=0;
96 2
97 2 while(EOC==0);
98 2 OE=1;
99 2 getdata=P2;
100 2 OE=0;
101 2 temp=getdata*1.0/255*500;
102 2 temp_H=temp/100;
103 2 temp_M=temp/10%10;
104 2 temp_L=temp%10;
105 2 display();
106 2 }
107 1 }
108
109
110
111
112
113
114
115
116
117
C51 COMPILER V8.09 ADC0808_DIY 04/01/2009 23:05:11 PAGE 3
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 225 ----
CONSTANT SIZE = 10 ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 6 ----
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 + -