?? 0809.lst
字號:
C51 COMPILER V8.02 0809 08/18/2007 20:07:10 PAGE 1
C51 COMPILER V8.02, COMPILATION OF MODULE 0809
OBJECT MODULE PLACED IN 0809.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE 0809.c BROWSE DEBUG OBJECTEXTEND
line level source
1 #include<at89x52.h>
2 code unsigned char seg7code[10]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
3 ///////////// //顯示段碼/////////0 1 2 3 4 5 6 7 8 9/////////
4 unsigned int datain;
5 unsigned int dataout,datac[4]={0};
6 float datamo;
7 sbit ST=P3^0; ////////////////////輸入通道就用IN0 /// A B C口 都接地////////////////
8 sbit OE=P3^1;
9 sbit EOC=P3^2; //////////////////輸入通道就用IN0 /// A B C口 都接地////////////////
10
11 void delayms(unsigned char x) //////延時x ms 誤差16us
12 { unsigned char y=123;
13 1 unsigned char j;
14 1 while(x--)
15 1 {
16 2 for(j=0;j<y;j++);
17 2 }
18 1 }
19
20
21 void ADC0809(void) //ADC0809轉(zhuǎn)換函數(shù)
22 {
23 1 ST=0;
24 1 ST=1;
25 1 ST=0;
26 1 while(EOC==0);
27 1 OE=1;
28 1 datain=P1; /////單片機接收的數(shù)字數(shù)據(jù)
29 1 OE=0;
30 1 }
31 void Datapro(void) //ADC0809數(shù)據(jù)處理函數(shù)
32 {
33 1 datamo=(datain*5)/256.0;
34 1 dataout=(unsigned int)(datamo*1000); //////////強制轉(zhuǎn)換
35 1 datac[3]=dataout%10;////////小數(shù)點后第三位/////四位數(shù)碼管顯示
36 1 datac[2]=dataout%100/10;/////////////第二位/////////
37 1 datac[1]=dataout/100%10;//////////////第一位//////////
38 1 datac[0]=dataout/1000;///////////////個位數(shù)/////
39 1 }
40
41 void Led(void)
42 {
43 1 P2_3=1; /////////////////P2低四位控制數(shù)碼管位選
44 1 P2_0=0;
45 1 P0=seg7code[datac[0]]|0x80; //輸出個位數(shù)和小數(shù)點
46 1 delayms(4);
47 1 P2_0=1;
48 1 P2_1=0;
49 1 P0=seg7code[datac[1]]; //輸出小數(shù)點后第一位
50 1 delayms(4);
51 1 P2_1=1;
52 1 P2_2=0;
53 1 P0=seg7code[datac[2]]; //輸出小數(shù)點后第二位
54 1 delayms(4);
55 1 P2_2=1;
C51 COMPILER V8.02 0809 08/18/2007 20:07:10 PAGE 2
56 1 P2_3=0;
57 1 P0=seg7code[datac[3]]; //輸出小數(shù)點后第三位
58 1 delayms(4);
59 1
60 1 }
61
62 void main(void)
63 {
64 1 P2=0xff;
65 1 P0=seg7code[0];
66 1 datain=0;
67 1 dataout=0;
68 1 while(1)
69 1 {
70 2 ADC0809();
71 2 Datapro();
72 2 Led();
73 2 }
74 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 261 ----
CONSTANT SIZE = 10 ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 16 ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -