📄 baseclk.lst
字号:
C51 COMPILER V7.09 BASECLK 09/11/2007 09:30:25 PAGE 1
C51 COMPILER V7.09, COMPILATION OF MODULE BASECLK
OBJECT MODULE PLACED IN baseclk.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE baseclk.c ROM(COMPACT) BROWSE DEBUG OBJECTEXTEND
line level source
1 #include "typedef.h"
2 #include "intrins.h"
3 #include "time.h"
4 #include "ll.h"
5
6 ////////////////////////////////////////////////////
7 void _sendBit(bit temp)
8 {
9 1 DIN = 1;
10 1 SCLOCK = 0; _nop_();
11 1 DIN = temp; _nop_();
12 1 SCLOCK = 1; _nop_();
13 1 SCLOCK = 0;
14 1 }
15 /************************************************************************/
16 /* clockmaster transfer from uctrl to ASIC*/
17 /************************************************************************/
18 void _trans1(void)
19 {
20 1 SCLOCK = 0;
21 1 DIN = 0; _nop_();
22 1 DIN = 1; _nop_();
23 1 DIN = 0; _nop_();
24 1 DIN = 1; _nop_();
25 1 SCLOCK = 1;_nop_();
26 1 }
27 /*****************************************************************/
28 /* clockmaster transfer from ASIC to uctrl************************/
29 /*****************************************************************/
30
31 void _trans2(void)
32 {
33 1 SCLOCK = 0;
34 1 DIN = 1; _nop_();
35 1 DIN = 0; _nop_();
36 1 DIN = 1; _nop_();
37 1 DIN = 0; _nop_();
38 1 }
39
40 /*****************************************************************/
41 /*startbit S1:rising edge on Din while SCLOCK high *************/
42 /*****************************************************************/
43 void _startBit(void)
44 {
45 1 SCLOCK = 0; _nop_();
46 1 DIN = 0; _nop_();
47 1 SCLOCK = 1; _nop_();
48 1 DIN = 1; _nop_();
49 1 SCLOCK = 0; _nop_();
50 1 }
51
52 /*****************************************************************/
53 /* stopbit ES1:falling edge on Din while SCLOCK high ************/
54 /*****************************************************************/
55 void _stopBit(void)
C51 COMPILER V7.09 BASECLK 09/11/2007 09:30:25 PAGE 2
56 {
57 1 SCLOCK = 0; _nop_();
58 1 DIN = 1; _nop_();
59 1 SCLOCK = 1; _nop_();
60 1 DIN = 0; _nop_();
61 1 SCLOCK = 0; _nop_();
62 1 }
63 /*****************************************************************/
64 /* find S2: a SOF sent by the TAG *******************************/
65 /*****************************************************************/
66 uchar _findS2(void)
67 {
68 1 uchar S2=0;
69 1 while ((!SCLOCK)&&(!TIMERINT)); //等到SCLK变高
70 1 if (SCLOCK) //sclk变到高电平
71 1 {
72 2 while ((SCLOCK)&&(!TIMERINT)&&(!DOUT)); //等到dout输出为高
73 2 if (DOUT) //dout已经为高电平
74 2 {
75 3 while ((SCLOCK)&&(!TIMERINT)&&(DOUT));//等sclk变为低电平,dout为高
76 3 if (!SCLOCK)
77 3 {
78 4 S2 = 1; //找到起始信号
79 4 }
80 3 }
81 2 }
82 1 return (S2);
83 1 }
84
85 /*****************************************************************/
86 /* readbit:read data from DOUT*************************************/
87 /*****************************************************************/
88 uchar _readbit(void)
89 {
90 1 /*
91 1 uchar i, sample;
92 1 uchar debounce=1; // min clockpulse is 4.7us for 106kBaud
93 1 bit doutstore = 0;
94 1 while ((!SCLOCK)&&(!TIMERINT)); //wait for rising edge
95 1
96 1 for (i=0; i<debounce;i++);
97 1 if (SCLOCK)
98 1 {
99 1 if(ERR)
100 1 {
101 1 if(ERR)
102 1 {
103 1 sample = 2; //冲撞
104 1 return (sample);
105 1 }
106 1 }
107 1 doutstore=DOUT;
108 1
109 1 if (DOUT)
110 1 sample = 1;
111 1 else
112 1 sample = 0; //store sample: no debouncing!
113 1
114 1
115 1 while ((SCLOCK)&&(!TIMERINT)&&(doutstore==DOUT)); //等到sclk变为低电平,等待下个数据位
116 1
117 1 if ((SCLOCK)&&(doutstore != DOUT) ) // ES2
C51 COMPILER V7.09 BASECLK 09/11/2007 09:30:25 PAGE 3
118 1 {
119 1 sample = 0x03;
120 1 }
121 1 else if (TIMERINT) // timeout
122 1 {
123 1 sample = 0x04;
124 1 }
125 1 }
126 1 return(sample);
127 1 */
128 1 uchar i, sample, doutstore;
129 1 uchar debounce=1; // min clockpulse is 4.7us for 106kBaud
130 1 while ((!SCLOCK)&&(!TIMERINT)); //wait for rising edge
131 1
132 1 for (i=0; i<debounce;i++);
133 1 if (SCLOCK)
134 1 {
135 2 if(ERR)
136 2 {
137 3 if(ERR) { sample = 2; return (sample); }
138 3 }
139 2 doutstore=DOUT;
140 2 if (!DOUT)
141 2 sample = 0;
142 2 else
143 2 sample = 1; //store sample: no debouncing!
144 2
145 2 while ((SCLOCK)&&(!TIMERINT)&&(doutstore ==DOUT));
146 2
147 2 if ((SCLOCK)&&(doutstore != DOUT) ) // ES2
148 2 {
149 3 sample = 0x03;
150 3 }
151 2 else if (TIMERINT) // timeout
152 2 {
153 3 sample = 0x04;
154 3 }
155 2 }
156 1 return(sample);
157 1 }
158
159 /*****************************************************************/
160 /***read on DOUT and write on DIN, with uctrl master of clock.****/
161 /*****************************************************************/
162
163 uchar _rwbit(uchar wbit)
164 {
165 1 uchar i, rbit;
166 1 if(wbit)
167 1 DIN = 1;
168 1 else
169 1 DIN = 0;
170 1 SCLOCK = 1;
171 1 DOUT = 1;
172 1 for (i=0;i<2;i++); //dummy
173 1 if (!DOUT)
174 1 rbit=0;
175 1 else
176 1 rbit=1;
177 1 SCLOCK = 0;
178 1 return (rbit);
179 1 }
C51 COMPILER V7.09 BASECLK 09/11/2007 09:30:25 PAGE 4
180 /*****************************************************************/
181
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 229 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
IDATA SIZE = ---- ----
BIT SIZE = ---- 1
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -