?? ledtest.lst
字號:
C51 COMPILER V8.09 LEDTEST 02/10/2009 22:00:59 PAGE 1
C51 COMPILER V8.09, COMPILATION OF MODULE LEDTEST
OBJECT MODULE PLACED IN ledtest.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE ledtest.c BROWSE DEBUG OBJECTEXTEND
line level source
1 #include <ledtest.h>
2
3 static int LastDiscrepancy;
4 static int LastFamilyDiscrepancy;
5 static int LastDeviceFlag;
6 static int USpeed = 0; // current 1-Wire Net communication speed
7 static int ULevel = 0; // current 1-Wire Net level
8 uchar ROM_NO[8];
9 //uchar FamilySN[MAXDEVICES][8];
10 uchar crc8;
11 ushort utilcrc16;
12 bit c16;
13
14 static short oddparity[16] = { 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0 };
15 void main(void)
16 {
17 1 int y=0;
18 1 int flag=0;
19 1 //uchar test;
20 1 //uchar receive;
21 1 uchar temp1,temp2;
22 1 // uchar temp3,temp4;
23 1 // bit crcbit;
24 1 ushort lastcrc16;
25 1
26 1 delay(100);
*** WARNING C206 IN LINE 26 OF LEDTEST.C: 'delay': missing function-prototype
*** ERROR C267 IN LINE 26 OF LEDTEST.C: 'delay': requires ANSI-style prototype
27 1 led_blink();
28 1 Init_Rs232();
29 1
30 1 delay(500);
31 1 //init conditional search status
32 1 while(1)
33 1 {
34 2 ow_reset();
35 2 write_byte(0xcc); //LSB address
36 2 write_byte(0x55); //LSB address
37 2 write_byte(0x07); //MSB address
38 2 write_byte(0x00); //LSB address
39 2 if (flag==0)
40 2 {
41 3 write_byte(0x76); //MSB address
42 3 }
43 2 else{
44 3 write_byte(0x56); //MSB address
45 3 }
46 2 temp1=read_byte();
47 2 temp2=read_byte();
48 2 // crcbit=read_bit();
49 2 setcrc16(0x0000); //
50 2 docrc16(0x55);
51 2 docrc16(0x07);
52 2 docrc16(0x00);
53 2 if (flag==1)
C51 COMPILER V8.09 LEDTEST 02/10/2009 22:00:59 PAGE 2
54 2 {
55 3 docrc16(0x16);
56 3 }
57 2 else{
58 3 docrc16(0x36);
59 3 }
60 2
61 2 // read and calculate the read crc
62 2 docrc16(temp1);
63 2 lastcrc16 = docrc16(temp2);
64 2 // crc should now be 0xB001
65 2 if (lastcrc16 != 0xB001)
66 2 {
67 3 ow_reset();
68 3
69 3 }
70 2 else{
71 3 }
72 2
73 2 if (first(TRUE))
74 2 {
75 3 if(flag==0)
76 3 {
77 4 flag=1;
78 4 }
79 3 else{
80 4 flag=0;
81 4 }
82 3
83 3 if(Send_MatchRom())
84 3 {
85 4 write_byte(0x55); //write status
86 4 write_byte(0x07); //LSB address
87 4 write_byte(0x00); //MSB address
88 4 if (flag==1)
89 4 {
90 5 write_byte(0x0e); //LSB address
91 5 }
92 4 else{
93 5 write_byte(0x6d); //LSB address
94 5 }
95 4 temp1=read_byte();
96 4 temp2=read_byte();
97 4 // crcbit=read_bit();
98 4 setcrc16(0x0000); //
99 4 docrc16(0x55);
100 4 docrc16(0x07);
101 4 docrc16(0x00);
102 4 if (flag==1)
103 4 {
104 5 docrc16(0x0e);
105 5 }
106 4 else{
107 5 docrc16(0x6d);
108 5 }
109 4
110 4 // read and calculate the read crc
111 4 docrc16(temp1);
112 4 lastcrc16 = docrc16(temp2);
113 4 // crc should now be 0xB001
114 4 if (lastcrc16 != 0xB001)
115 4 {
C51 COMPILER V8.09 LEDTEST 02/10/2009 22:00:59 PAGE 3
116 5 ow_reset();
117 5 //tx_str("make PIOA high crc error!");
118 5 }
119 4 else{
120 5 //tx_str("make PIOA high crc correct!");
121 5 }
122 4 //tx_lfbs();
123 4 }
124 3 }
125 2 }
126 1 /*delay(255);
127 1 tx_str("Pelease input 1 or 2 or 3 or 4 or 5");
128 1 tx_lfbs();
129 1 tx_str("case '1':Send 1_wire reset");
130 1 tx_lfbs();
131 1 tx_str("case '2':Performing search rom CODE");
132 1 tx_lfbs();
133 1 tx_str("case '3':Performing SKIP READ ROM COMMAND");
134 1 tx_lfbs();
135 1 tx_str("case '4':Performing SKIP WRITE ROM COMMAND");
136 1 tx_lfbs();
137 1 tx_str("case '5':read status from ds2406!");
138 1 tx_lfbs();
139 1 tx_str("case '6':write one low bit!");
140 1 tx_lfbs();
141 1 tx_str("case '7':make PIOA high crc correct!");
142 1 tx_lfbs();
143 1 while(1)
144 1 {
145 1 receive=rx_char();
146 1 switch (receive)
147 1 {
148 1 case '1':
149 1 tx_str("Send 1_wire reset");
150 1 tx_lfbs();
151 1 if (ow_reset())
152 1 {
153 1 tx_str("reset failure!");
154 1 tx_lfbs();
155 1 }
156 1 else {
157 1 tx_str("reset success!");
158 1 tx_lfbs();
159 1 }
160 1 break;
161 1 case '2':
162 1 tx_str("Performing search rom CODE");
163 1 tx_lfbs();
164 1 ow_reset();
165 1 first(FALSE);
166 1 if (ROM_NO[0]==0x12)
167 1 {
168 1 tx_str("Correct find Ds2406 family ROM code");
169 1 tx_lfbs();
170 1 }
171 1 /* tx_str("ROM_NO[0]=18");
172 1 tx_lfbs();
173 1 for (y=1;y<8;y++)
174 1 {
175 1 tx_str("ROM_NO[");
176 1 tx_char(y+48);
177 1 tx_str("]=");
C51 COMPILER V8.09 LEDTEST 02/10/2009 22:00:59 PAGE 4
178 1 if (ROM_NO[y]>=128)
179 1 {tx_char((ROM_NO[y]-80));
180 1 tx_str(" (ROM_NO>128)");
181 1 }
182 1 else if (ROM_NO[y]<48)
183 1 { tx_char((ROM_NO[y]+48));
184 1 tx_str(" (ROM_NO<48)");
185 1 }
186 1 else{
187 1 tx_char(ROM_NO[y]);
188 1 }
189 1 tx_lfbs();
190 1 }*/
191 1 /* tx_str("Performing send Match Rom");
192 1 tx_lfbs();
193 1 if(Send_MatchRom())
194 1 {
195 1
196 1 write_byte(0x55); //write status
197 1 write_byte(0x07); //LSB address
198 1 write_byte(0x00); //MSB address
199 1 write_byte(0x0e); //LSB address
200 1 temp1=read_byte();
201 1 temp2=read_byte();
202 1 // crcbit=read_bit();
203 1 setcrc16(0x0000); //
204 1 docrc16(0x55);
205 1 docrc16(0x07);
206 1 docrc16(0x00);
207 1 docrc16(0x0e);
208 1 // read and calculate the read crc
209 1 docrc16(temp1);
210 1 lastcrc16 = docrc16(temp2);
211 1 // crc should now be 0xB001
212 1 if (lastcrc16 != 0xB001)
213 1 {
214 1 ow_reset();
215 1 tx_str("make PIOA high crc error!");
216 1 }
217 1 else{
218 1 tx_str("make PIOA high crc correct!");
219 1 }
220 1 tx_lfbs();
221 1 }
222 1 break;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -