📄 text2.lst
字号:
C51 COMPILER V8.02 TEXT2 07/22/2007 08:33:49 PAGE 1
C51 COMPILER V8.02, COMPILATION OF MODULE TEXT2
OBJECT MODULE PLACED IN Text2.OBJ
COMPILER INVOKED BY: D:\Keil\C51\BIN\C51.EXE Text2.C BROWSE DEBUG OBJECTEXTEND
line level source
1 #include<absacc.h>
2 #include<reg51.h>
3 #include<intrins.h>
4 #define uint unsigned int
5 #define uchar unsigned char
6 sbit cs=P1^1; /*片选*/
7 sbit clk_adc=P1^0; /*TLC549 的时钟信号*/
8 sbit dout_adc=P1^2; /*TLC549的数据输出*/
9 uchar temp,LED2_data,LED3_data;
10 uchar code led_segment[13]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0xff,0x00,0x80};
11 uchar code wei[3]={0xfb,0xfd,0xfe};
12 void display();
13 void delay(uint v);
14 uchar tlc549_read();
15 void delay(uint v)
16 {
17 1 while(v!=0) v--;
18 1 }
19
20 /*TLC549转换数据读出程序*/
21 uchar tlc549_read()
22 {
23 1 uchar i,adcdata;
24 1 adcdata=0;
25 1 cs=1;
26 1 clk_adc=0;
27 1 cs=0;
28 1 _nop_();
29 1 for(i=0;i<8;i++)
30 1 { clk_adc=1;
31 2 if(dout_adc)
32 2 adcdata++;
33 2 adcdata=adcdata<<1;
34 2 clk_adc=0;
35 2 }
36 1 cs=1;
37 1 return adcdata;
38 1 for(i=0;i<3;i++)
39 1 _nop_();
40 1 }
41 /*显示程序*/
42 void display()
43 {
44 1 P2=wei[0]; //十位
45 1 P0=led_segment[LED2_data];
46 1 delay(500);
47 1 //个位
48 1 P2=wei[2];
49 1 P0=led_segment[LED3_data];
50 1 delay(500);
51 1 //小数
52 1 P2=wei[1];
53 1 P0=led_segment[12];
54 1 delay(500);
55 1 }
C51 COMPILER V8.02 TEXT2 07/22/2007 08:33:49 PAGE 2
56 void main(void)
57 {
58 1
59 1 while(1)
60 1 {
61 2 temp=tlc549_read();
62 2 if(temp>0xFB){ LED2_data=5;LED3_data=0;display();}
63 2 else if(temp>0xF5){ LED2_data=4;LED3_data=9;display();}
64 2 else if(temp>0xF0){ LED2_data=4;LED3_data=8;display();}
65 2 else if(temp>0xEB){ LED2_data=4;LED3_data=7;display();}
66 2 else if(temp>0xE7){ LED2_data=4;LED3_data=6;display();}
67 2 else if(temp>0xE1){ LED2_data=4;LED3_data=5;display();}
68 2 else if(temp>0xDF){ LED2_data=4;LED3_data=4;display();}
69 2 else if(temp>0xD7){ LED2_data=4;LED3_data=3;display();}
70 2 else if(temp>0xD3){ LED2_data=4;LED3_data=2;display();}
71 2 else if(temp>0xCF){ LED2_data=4;LED3_data=1;display();}
72 2
73 2 else if(temp>0xCD){ LED2_data=4;LED3_data=0;display();}
74 2 else if(temp>0xC2){ LED2_data=3;LED3_data=9;display();}
75 2 else if(temp>0xBD){ LED2_data=3;LED3_data=8;display();}
76 2 else if(temp>0xB8){ LED2_data=3;LED3_data=7;display();}
77 2 else if(temp>0xB7){ LED2_data=3;LED3_data=6;display();}
78 2 else if(temp>0xAF){ LED2_data=3;LED3_data=5;display();}
79 2 else if(temp>0xA9){ LED2_data=3;LED3_data=4;display();}
80 2 else if(temp>0xA4){ LED2_data=3;LED3_data=3;display();}
81 2 else if(temp>0x9F){ LED2_data=3;LED3_data=2;display();}
82 2 else if(temp>0x9B){ LED2_data=3;LED3_data=1;display();}
83 2
84 2 else if(temp>0x95){ LED2_data=3;LED3_data=0;display();}
85 2 else if(temp>0x90){ LED2_data=2;LED3_data=9;display();}
86 2 else if(temp>0x8B){ LED2_data=2;LED3_data=8;display();}
87 2 else if(temp>0x86){ LED2_data=2;LED3_data=7;display();}
88 2 else if(temp>0x81){ LED2_data=2;LED3_data=6;display();}
89 2 else if(temp>0x7F){ LED2_data=2;LED3_data=5;display();}
90 2 else if(temp>0x77){ LED2_data=2;LED3_data=4;display();}
91 2 else if(temp>0x73){ LED2_data=2;LED3_data=3;display();}
92 2 else if(temp>0x6F){ LED2_data=2;LED3_data=2;display();}
93 2 else if(temp>0x6D){ LED2_data=2;LED3_data=1;display();}
94 2
95 2 else if(temp>0x63){ LED2_data=2;LED3_data=0;display();}
96 2 else if(temp>0x5F){ LED2_data=1;LED3_data=9;display();}
97 2 else if(temp>0x59){ LED2_data=1;LED3_data=8;display();}
98 2 else if(temp>0x57){ LED2_data=1;LED3_data=7;display();}
99 2 else if(temp>0x4F){ LED2_data=1;LED3_data=6;display();}
100 2 else if(temp>0x4B){ LED2_data=1;LED3_data=5;display();}
101 2 else if(temp>0x44){ LED2_data=1;LED3_data=4;display();}
102 2 else if(temp>0x3F){ LED2_data=1;LED3_data=3;display();}
103 2 else if(temp>0x3B){ LED2_data=1;LED3_data=2;display();}
104 2 else if(temp>0x35){ LED2_data=1;LED3_data=1;display();}
105 2
106 2 else if(temp>0x30){ LED2_data=1;LED3_data=0;display();}
107 2 else if(temp>0x2B){ LED2_data=0;LED3_data=9;display();}
108 2 else if(temp>0x26){ LED2_data=0;LED3_data=8;display();}
109 2 else if(temp>0x21){ LED2_data=0;LED3_data=7;display();}
110 2 else if(temp>0x1C){ LED2_data=0;LED3_data=6;display();}
111 2 else if(temp>0x17){ LED2_data=0;LED3_data=5;display();}
112 2 else if(temp>0x12){ LED2_data=0;LED3_data=4;display();}
113 2 else if(temp>0x0D){ LED2_data=0;LED3_data=3;display();}
114 2 else if(temp>0xF){ LED2_data=0;LED3_data=2;display();}
115 2 display();
116 2 }
117 1 }
C51 COMPILER V8.02 TEXT2 07/22/2007 08:33:49 PAGE 3
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 766 ----
CONSTANT SIZE = 16 ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 3 ----
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 + -