📄 ad7416.lst
字号:
C51 COMPILER V7.10 AD7416 11/03/2004 15:40:41 PAGE 1
C51 COMPILER V7.10, COMPILATION OF MODULE AD7416
OBJECT MODULE PLACED IN ad7416.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE ad7416.c BROWSE DEBUG OBJECTEXTEND
line level source
1 #include <reg51.h>
2 #include <intrins.h>
3 #include <stdio.h>
4
5 sbit SDA =P1^0;
6 sbit SCL =P1^1;
7 sbit OTI =P1^2;
8 sbit AD0 =P0^0;
9 sbit AD1 =P0^1;
10 sbit AD2 =P0^2;
11
12 unsigned char Command;
13
14
15 void START()
16 {
17 1 SCL=1;
18 1 SDA=1;
19 1 _nop_();
20 1 _nop_();
21 1 _nop_();
22 1 _nop_();
23 1 SDA=0;
24 1 _nop_();
25 1 _nop_();
26 1 _nop_();
27 1 _nop_();
28 1 SCL=0;
29 1
30 1 }
31
32 void STOP()
33 {
34 1 SDA=0;
35 1 SCL=1;
36 1 _nop_();
37 1 _nop_();
38 1 _nop_();
39 1 _nop_();
40 1 _nop_();
41 1 SDA=1;
42 1 }
43
44 void WRCOM(unsigned char com)
45 {
46 1 unsigned char i;
47 1 Command=com;
48 1 for(i=0;i<8;i++)
49 1 {
50 2 SCL=0;
51 2 if(Command & 0x80 )
52 2 SDA=1;
53 2 else SDA=0;
54 2 _nop_();
55 2 _nop_();
C51 COMPILER V7.10 AD7416 11/03/2004 15:40:41 PAGE 2
56 2 Command=Command<<1;
57 2 _nop_();
58 2 SCL=1;
59 2 _nop_();
60 2 _nop_();
61 2 _nop_();
62 2 _nop_();
63 2 _nop_();
64 2 }
65 1 SCL=0;
66 1 _nop_();
67 1 _nop_();
68 1 _nop_();
69 1 _nop_();
70 1 _nop_();
71 1 SDA=1;
72 1
73 1 }
74
75 char RDCOM()
76 {
77 1 unsigned char i;
78 1 char temp;
79 1 for(i=0;i<8;i++)
80 1 {
81 2 SCL=0;
82 2 _nop_();
83 2 _nop_();
84 2 _nop_();
85 2 _nop_();
86 2 _nop_();
87 2 SCL=1;
88 2 _nop_();
89 2 _nop_();
90 2 temp=temp<<1;
91 2 if(SDA==1) temp=temp | 0x01;
92 2
93 2 }
94 1 SCL=0;
95 1 _nop_();
96 1 _nop_();
97 1 SDA=1;
98 1 return(temp);
99 1
100 1 }
101
102 main()
103 {
104 1 unsigned char com;
105 1 char dat;
106 1 TMOD=0x20|TMOD;
107 1 TL1=0xfd;
108 1 TH1=0xfd;
109 1 TR1=1;
110 1 SCON=0x50;
111 1 TI=1;
112 1 P0=0XFF;
113 1 puts("the temp is:\r\n");
114 1 com=0x9E;
115 1 START();
116 1 WRCOM(com);
117 1 com=0x01;
C51 COMPILER V7.10 AD7416 11/03/2004 15:40:41 PAGE 3
118 1 WRCOM(com);
119 1 com=0x18;
120 1 WRCOM(com);
121 1 STOP();
122 1 START();
123 1 com=0x9e;
124 1 WRCOM(com);
125 1 com=0x03;
126 1 WRCOM(com);
127 1 com=0x30;
128 1 WRCOM(com);
129 1 STOP();
130 1 START();
131 1 com=0x9e;
132 1 WRCOM(com);
133 1 com=0x02;
134 1 WRCOM(com);
135 1 com=0x0a;
136 1 WRCOM(com);
137 1 STOP();
138 1 START();
139 1 com=0x9e;
140 1 WRCOM(com);
141 1 STOP();
142 1 START();
143 1 com=0x00;
144 1 WRCOM(com);
145 1 STOP();
146 1 START();
147 1 com=0x9f;
148 1 WRCOM(com);
149 1 while(1)
150 1 {
151 2 STOP();
152 2 START();
153 2 dat=RDCOM();
154 2 STOP();
155 2 printf("%d",dat);
156 2 }
157 1
158 1
159 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 235 ----
CONSTANT SIZE = 18 ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 1 1
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 + -