📄 ledtest.lst
字号:
227 1 {
228 1 ow_reset();
229 1 write_byte(0xCC); //LSB address
230 1 write_byte(0xF0); //MSB address
231 1 write_byte(y); //LSB address
232 1 write_byte(0x00); //MSB address
233 1 test=read_byte();
234 1 if (test==0xff)
235 1 {
236 1 tx_str("read_byte=0xff!");
237 1 tx_lfbs();
238 1 }
239 1 else {
240 1 tx_str("read_byte=");
241 1 tx_char((test+48));
C51 COMPILER V7.06 LEDTEST 11/22/2005 22:07:04 PAGE 5
242 1 tx_lfbs();
243 1 }
244 1 }
245 1
246 1 break;
247 1 case '4':
248 1 tx_str("4:Performing SKIP Write Rom Command");
249 1 tx_lfbs();
250 1 for (y=0x0a;y<=0x0f;y++)
251 1 {
252 1 ow_reset();
253 1 write_byte(0xCC); //LSB address
254 1 write_byte(0x0F); //MSB address
255 1 write_byte(y); //LSB address
256 1 write_byte(0x00); //MSB address
257 1 write_byte(y); //LSB address
258 1 temp1=read_byte();
259 1 temp2=read_byte();
260 1 // crcbit=read_bit();
261 1 setcrc16(0x0000); //
262 1 docrc16(0x0f);
263 1 docrc16(y);
264 1 docrc16(0x00);
265 1 docrc16(y);
266 1 // read and calculate the read crc
267 1 docrc16(temp1);
268 1 lastcrc16 = docrc16(temp2);
269 1 // crc should now be 0xB001
270 1 if (lastcrc16 != 0xB001)
271 1 {
272 1 ow_reset();
273 1 tx_str("write crc error!");
274 1 }
275 1 else{
276 1 tx_str("write crc correct!");
277 1 }
278 1 tx_lfbs();
279 1 wdelay(10000);
280 1 }
281 1 tx_str("3:Performing SKIP Read Rom Command");
282 1 tx_lfbs();
283 1 for (y=0x0a;y<=0x0f;y++)
284 1 {
285 1 ow_reset();
286 1 write_byte(0xCC); //LSB address
287 1 write_byte(0xF0); //MSB address
288 1 write_byte(y); //LSB address
289 1 write_byte(0x00); //MSB address
290 1 test=read_byte();
291 1 temp1=read_byte();
292 1 temp2=read_byte();
293 1 setcrc16(0x0000); //
294 1 docrc16(0xF0);
295 1 docrc16(y);
296 1 docrc16(0x00);
297 1 docrc16(test);
298 1 // read and calculate the read crc
299 1 docrc16(temp1);
300 1 lastcrc16 = docrc16(temp2);
301 1 // crc should now be 0xB001
302 1 if (lastcrc16 != 0xB001)
303 1 {
C51 COMPILER V7.06 LEDTEST 11/22/2005 22:07:04 PAGE 6
304 1 ow_reset();
305 1 tx_str("read crc error!");
306 1 }
307 1 else{
308 1 tx_str("read crc correct!");
309 1 }
310 1 if (test==0xff)
311 1 {
312 1 tx_str("read_byte=0xff!");
313 1 tx_lfbs();
314 1 }
315 1 else {
316 1 tx_str("read_byte=");
317 1 tx_char((test+55));
318 1 tx_lfbs();
319 1 }
320 1 wdelay(10000);
321 1 }
322 1 break;
323 1 case '5':
324 1 tx_str("read status from ds2406!");
325 1 tx_lfbs();
326 1 for (y=0x00;y<0x08;y++)
327 1 {
328 1 ow_reset();
329 1 write_byte(0xCC); //LSB address
330 1 write_byte(0xaa); //MSB address
331 1 write_byte(y); //LSB address
332 1 write_byte(0x00); //MSB address
333 1 test=read_byte(); //LSB address
334 1 temp1=read_byte();
335 1 temp2=read_byte();
336 1 // crcbit=read_bit();
337 1 setcrc16(0x0000); //
338 1 docrc16(0xaa);
339 1 docrc16(y);
340 1 docrc16(0x00);
341 1 docrc16(test);
342 1 // read and calculate the read crc
343 1 docrc16(temp1);
344 1 lastcrc16 = docrc16(temp2);
345 1 // crc should now be 0xB001
346 1 if (lastcrc16 != 0xB001)
347 1 {
348 1 ow_reset();
349 1 tx_str("read status crc error!");
350 1 }
351 1 else{
352 1 tx_str("read status crc correct!");
353 1 }
354 1 tx_lfbs();
355 1 if (test==0xff)
356 1 {
357 1 tx_str("read_byte=0xff!");
358 1 tx_lfbs();
359 1 }
360 1 else {
361 1 tx_str("read_byte=");
362 1 tx_char((test+48));
363 1 tx_lfbs();
364 1 }
365 1 delay(5000);
C51 COMPILER V7.06 LEDTEST 11/22/2005 22:07:04 PAGE 7
366 1
367 1 }
368 1 break;
369 1 case '6':
370 1 tx_str("setup search conditional");
371 1 tx_lfbs();
372 1 tx_str("make PIOA high start!");
373 1 tx_lfbs();
374 1 ow_reset();
375 1 write_byte(0xCC); //LSB address
376 1 write_byte(0x55); //MSB address
377 1 write_byte(0x07); //LSB address
378 1 write_byte(0x00); //MSB address
379 1 write_byte(0x56); //LSB address
380 1 temp1=read_byte();
381 1 temp2=read_byte();
382 1 // crcbit=read_bit();
383 1 setcrc16(0x0000); //
384 1 docrc16(0x55);
385 1 docrc16(0x07);
386 1 docrc16(0x00);
387 1 docrc16(0x56);
388 1 // read and calculate the read crc
389 1 docrc16(temp1);
390 1 lastcrc16 = docrc16(temp2);
391 1 // crc should now be 0xB001
392 1 if (lastcrc16 != 0xB001)
393 1 {
394 1 ow_reset();
395 1 tx_str("make PIOB Low crc error!");
396 1 }
397 1 else{
398 1 tx_str("make PIOB low crc correct!");
399 1 }
400 1 tx_lfbs();
401 1 delay(5000);
402 1 tx_str("Performing search rom CODE");
403 1 tx_lfbs();
404 1 ow_reset();
405 1 first(TRUE);
406 1 if (ROM_NO[0]==0x12)
407 1 {
408 1 tx_str("conditional search Correct find Ds2406 family ROM code");
409 1 tx_lfbs();
410 1 }
411 1 tx_str("Performing send Match Rom");
412 1 tx_lfbs();
413 1 if(Send_MatchRom())
414 1 {
415 1
416 1 write_byte(0x55); //write status
417 1 write_byte(0x07); //LSB address
418 1 write_byte(0x00); //MSB address
419 1 write_byte(0x0e); //LSB address
420 1 temp1=read_byte();
421 1 temp2=read_byte();
422 1 // crcbit=read_bit();
423 1 setcrc16(0x0000); //
424 1 docrc16(0x55);
425 1 docrc16(0x07);
426 1 docrc16(0x00);
427 1 docrc16(0x0e);
C51 COMPILER V7.06 LEDTEST 11/22/2005 22:07:04 PAGE 8
428 1 // read and calculate the read crc
429 1 docrc16(temp1);
430 1 lastcrc16 = docrc16(temp2);
431 1 // crc should now be 0xB001
432 1 if (lastcrc16 != 0xB001)
433 1 {
434 1 ow_reset();
435 1 tx_str("make PIOA high crc error!");
436 1 }
437 1 else{
438 1 tx_str("make PIOA high crc correct!");
439 1 }
440 1 tx_lfbs();
441 1 }
442 1 break;
443 1 case '7':
444 1 tx_str("make PIOA high start!");
445 1 tx_lfbs();
446 1 ow_reset();
447 1 write_byte(0xCC); //LSB address
448 1 write_byte(0x55); //MSB address
449 1 write_byte(0x07); //LSB address
450 1 write_byte(0x00); //MSB address
451 1 write_byte(0x0e); //LSB address
452 1 temp1=read_byte();
453 1 temp2=read_byte();
454 1 // crcbit=read_bit();
455 1 setcrc16(0x0000); //
456 1 docrc16(0x55);
457 1 docrc16(0x07);
458 1 docrc16(0x00);
459 1 docrc16(0x0e);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -