📄 temp.lst
字号:
C51 COMPILER V8.02 TEMP 07/25/2007 14:04:26 PAGE 1
C51 COMPILER V8.02, COMPILATION OF MODULE TEMP
OBJECT MODULE PLACED IN temp.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE temp.c BROWSE DEBUG OBJECTEXTEND
line level source
1 #include <REG2051.H>
2 #include <temp.h>
3 #include <intrins.h>
4
5 struct Frame frame;
6
7
8 bit read_state()
9 {
10 1 unsigned char i=0;
11 1 unsigned char command=0xAC;
12 1 bit state;
13 1
14 1
15 1 RESET=0;
16 1 CLK=1;
17 1 _nop_();
18 1
19 1 CLK=0;
20 1 RESET=1;
21 1 for(i=0;i<8;i++)
22 1 {
23 2 CLK=0;
24 2 _nop_();
25 2 _nop_();
26 2 _nop_();
27 2 DQ=(bit)(command&0x01);
28 2 _nop_();
29 2 _nop_();
30 2 _nop_();
31 2 _nop_();
32 2 _nop_();
33 2 CLK=1;
34 2 command>>=1;
35 2 _nop_();
36 2 _nop_();
37 2 _nop_();
38 2 _nop_();
39 2
40 2 }
41 1 watchdog=(!watchdog);
42 1 DQ=1;
43 1 for(i=0;i<8;i++)
44 1 {
45 2 CLK=0;
46 2 _nop_();
47 2 _nop_();
48 2 _nop_();
49 2 state=DQ;
50 2 _nop_();
51 2 _nop_();
52 2 _nop_();
53 2 _nop_();
54 2 _nop_();
55 2 CLK=1;
C51 COMPILER V8.02 TEMP 07/25/2007 14:04:26 PAGE 2
56 2 watchdog=(!watchdog);
57 2 _nop_();
58 2 _nop_();
59 2 _nop_();
60 2 _nop_();
61 2 }
62 1 RESET=0;
63 1 if(state)
64 1 {
65 2 return 1;
66 2 }
67 1 else
68 1 return 0;
69 1
70 1 }
71 void read(unsigned char command1)
72 {
73 1 unsigned char i=0;
74 1 unsigned char command=command1;
75 1 int back_up=0;
76 1 bit data1=0; //存贮读到的数据
77 1
78 1
79 1 while(!read_state()) //可以用延时代替
80 1 {
81 2 debug=!debug;
82 2 }
83 1 //DelayMs(110);
84 1 //watchdog=(!watchdog);
85 1
86 1 RESET=0;
87 1 CLK=1;
88 1 _nop_();
89 1 _nop_();
90 1 RESET=1;
91 1 CLK=0;
92 1
93 1
94 1 for(i=0;i<8;i++)
95 1 {
96 2 CLK=0;
97 2 _nop_();
98 2 _nop_();
99 2 _nop_();
100 2 _nop_();
101 2 DQ=(bit)(command&0x01);
102 2 _nop_();
103 2 _nop_();
104 2 _nop_();
105 2 _nop_();
106 2 _nop_();
107 2
108 2 CLK=1;
109 2 command>>=1;
110 2 _nop_();
111 2 _nop_();
112 2 _nop_();
113 2 _nop_();
114 2 _nop_();
115 2
116 2 }
117 1
C51 COMPILER V8.02 TEMP 07/25/2007 14:04:26 PAGE 3
118 1 watchdog=(!watchdog);
119 1 DQ=1;
120 1 back_up=0;
121 1 for(i=0;i<9;i++)
122 1 {
123 2
124 2 CLK=0;
125 2 _nop_();
126 2 _nop_();
127 2 _nop_();
128 2 _nop_();
129 2 data1=DQ;
130 2 if(data1)
131 2 {
132 3 back_up|=(0x01<<i);
133 3 }
134 2 CLK=1;
135 2 _nop_();
136 2 _nop_();
137 2 _nop_();
138 2 _nop_();
139 2 }
140 1 RESET=0;
141 1
142 1 frame.info=back_up;
143 1 DelayMs(1);
144 1
145 1 }
146 void write(unsigned char command,int t)
147 {
148 1
149 1 unsigned char i=0;
150 1 unsigned char command_copy=0;
151 1 command_copy=command; // 将命令备份下来,以便于下面switch语句使用
152 1
153 1 RESET=0;
154 1 CLK=1;
155 1 _nop_();
156 1 _nop_();
157 1
158 1 RESET=1;
159 1 CLK=0;
160 1
161 1
162 1 for(i=0;i<8;i++)
163 1 {
164 2 CLK=0;
165 2 _nop_();
166 2 _nop_();
167 2 DQ=(bit)(command_copy&0x01);
168 2 _nop_();
169 2 _nop_();
170 2 _nop_();
171 2 _nop_();
172 2 CLK=1;
173 2 command_copy>>=1;
174 2 _nop_();
175 2 _nop_();
176 2
177 2 }
178 1
179 1 switch(command)
C51 COMPILER V8.02 TEMP 07/25/2007 14:04:26 PAGE 4
180 1 {
181 2
182 2 case WRITE_CONFIG:
183 2 command_copy=ISHOT;
184 2 for(i=0;i<8;i++)
185 2 {
186 3 CLK=0;
187 3 _nop_();
188 3 _nop_();
189 3 _nop_();
190 3 _nop_();
191 3 DQ=(bit)(command_copy&0x01);
192 3 _nop_();
193 3 _nop_();
194 3 _nop_();
195 3 _nop_();
196 3 CLK=1;
197 3 command_copy>>=1;
198 3 _nop_();
199 3 _nop_();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -