📄 access.lst
字号:
288 1
289 1 bIIC_SDA = 0;
290 1 BitDly();
291 1
292 1 bIIC_SCL = 1;
293 1 BitDly();
294 1
295 1 bIIC_SDA = 1;
C51 COMPILER V6.20c ACCESS 04/15/2004 12:59:25 PAGE 6
296 1 BitDly();
297 1
298 1 #else
MCU_WriteI2cSda(_LOW);
BitDly();
MCU_WriteI2cScl(_HIGH);
BitDly();
MCU_WriteI2cSda(_HIGH);
BitDly();
#endif
308 1 }
309
310 unsigned char RTDGetByte(void)
311 {
312 1 #if (PARALLEL_PORT)
bRTD_SCLK = 1;
bRTD_SCLK = 0;
r0 = bRTD_SDIO_0;
r1 = bRTD_SDIO_1;
r2 = bRTD_SDIO_2;
r3 = bRTD_SDIO_3;
bRTD_SCLK = 1;
bRTD_SCLK = 0;
r4 = bRTD_SDIO_0;
r5 = bRTD_SDIO_1;
r6 = bRTD_SDIO_2;
r7 = bRTD_SDIO_3;
bRTD_SCLK = 1;
/*
bRTD_SCLK = 1;
bRTD_SCLK = 0;
Reg = P0 & 0x0f;
bRTD_SCLK = 1;
bRTD_SCLK = 0;
Reg = Reg | ((P0 & 0x0f) << 4);
bRTD_SCLK = 1;
*/
#else // Serial port
347 1
348 1 bRTD_SCLK = 1;
349 1 bRTD_SCLK = 0;
350 1 r0 = bRTD_SDIO_0;
351 1
352 1 bRTD_SCLK = 1;
353 1 bRTD_SCLK = 0;
354 1 r1 = bRTD_SDIO_0;
355 1
356 1 bRTD_SCLK = 1;
357 1 bRTD_SCLK = 0;
C51 COMPILER V6.20c ACCESS 04/15/2004 12:59:25 PAGE 7
358 1 r2 = bRTD_SDIO_0;
359 1
360 1 bRTD_SCLK = 1;
361 1 bRTD_SCLK = 0;
362 1 r3 = bRTD_SDIO_0;
363 1
364 1 bRTD_SCLK = 1;
365 1 bRTD_SCLK = 0;
366 1 r4 = bRTD_SDIO_0;
367 1
368 1 bRTD_SCLK = 1;
369 1 bRTD_SCLK = 0;
370 1 r5 = bRTD_SDIO_0;
371 1
372 1 bRTD_SCLK = 1;
373 1 bRTD_SCLK = 0;
374 1 r6 = bRTD_SDIO_0;
375 1
376 1 bRTD_SCLK = 1;
377 1 bRTD_SCLK = 0;
378 1 r7 = bRTD_SDIO_0;
379 1
380 1 bRTD_SCLK = 1;
381 1
382 1 #endif
383 1
384 1 return Reg;
385 1 }
386
387 void RTDSendByte(unsigned char send)
388 {
389 1 #if (PARALLEL_PORT)
bRTD_SDIO_0 = (bit)(send & 0x01);
bRTD_SDIO_1 = (bit)(send & 0x02);
bRTD_SDIO_2 = (bit)(send & 0x04);
bRTD_SDIO_3 = (bit)(send & 0x08);
bRTD_SCLK = 1;
bRTD_SCLK = 0;
bRTD_SDIO_0 = (bit)(send & 0x10);
bRTD_SDIO_1 = (bit)(send & 0x20);
bRTD_SDIO_2 = (bit)(send & 0x40);
bRTD_SDIO_3 = (bit)(send & 0x80);
bRTD_SCLK = 1;
bRTD_SCLK = 0;
bRTD_SDIO_0 = 1;
bRTD_SDIO_1 = 1;
bRTD_SDIO_2 = 1;
bRTD_SDIO_3 = 1;
bRTD_SCLK = 1;
/*
unsigned char ucTemp;
ucTemp = P0 & 0xf0;
P0 = ucTemp | (send & 0x0f);
bRTD_SCLK = 1;
bRTD_SCLK = 0;
C51 COMPILER V6.20c ACCESS 04/15/2004 12:59:25 PAGE 8
P0 = ucTemp | (send >> 4);
bRTD_SCLK = 1;
bRTD_SCLK = 0;
P0 = ucTemp | 0x0f;
bRTD_SCLK = 1;
*/
#else //serial port
430 1
431 1 bRTD_SDIO_0 = (bit)(send & 0x01);
432 1 bRTD_SCLK = 1;
433 1 bRTD_SCLK = 0;
434 1
435 1 bRTD_SDIO_0 = (bit)(send & 0x02);
436 1 bRTD_SCLK = 1;
437 1 bRTD_SCLK = 0;
438 1
439 1 bRTD_SDIO_0 = (bit)(send & 0x04);
440 1 bRTD_SCLK = 1;
441 1 bRTD_SCLK = 0;
442 1
443 1 bRTD_SDIO_0 = (bit)(send & 0x08);
444 1 bRTD_SCLK = 1;
445 1 bRTD_SCLK = 0;
446 1
447 1 bRTD_SDIO_0 = (bit)(send & 0x10);
448 1 bRTD_SCLK = 1;
449 1 bRTD_SCLK = 0;
450 1
451 1 bRTD_SDIO_0 = (bit)(send & 0x20);
452 1 bRTD_SCLK = 1;
453 1 bRTD_SCLK = 0;
454 1
455 1 bRTD_SDIO_0 = (bit)(send & 0x40);
456 1 bRTD_SCLK = 1;
457 1 bRTD_SCLK = 0;
458 1
459 1 bRTD_SDIO_0 = (bit)(send & 0x80);
460 1 bRTD_SCLK = 1;
461 1 bRTD_SCLK = 0;
462 1
463 1 bRTD_SDIO_0 = 1;
464 1 bRTD_SCLK = 1;
465 1
466 1 #endif
467 1 }
468
469 void RTDSendAddr(unsigned char addr, unsigned char rd, unsigned char inc) // rd : 0 - Write, 1 - Read
470 {
471 1 #if (PARALLEL_PORT)
RTDSendByte(addr);
bRTD_SDIO_0 = (bit)(rd & 0x01);
bRTD_SDIO_1 = (bit)(inc & 0x01);
bRTD_SCLK = 0;
bRTD_SDIO_0 = 1;
bRTD_SDIO_1 = 1;
C51 COMPILER V6.20c ACCESS 04/15/2004 12:59:25 PAGE 9
bRTD_SCLK = 1;
#else // Serial port
485 1
486 1 RTDSendByte(addr);
487 1
488 1 bRTD_SDIO_0 = (bit)(rd & 0x01);
489 1 bRTD_SCLK = 0;
490 1
491 1 bRTD_SDIO_0 = (bit)(inc & 0x01);
492 1 bRTD_SCLK = 1;
493 1 bRTD_SCLK = 0;
494 1
495 1 bRTD_SDIO_0 = 1;
496 1
497 1 #endif
498 1 }
499
500 void RTDSendStop(void)
501 {
502 1 bRTD_SCLK = 0;
503 1 bRTD_SCLK = 1;
504 1 bRTD_SCSB = 1;
505 1 }
506
507 void RTDRead(unsigned char index, unsigned char count, unsigned char inc)
508 {
509 1 if (count)
510 1 {
511 2 bRTD_SCSB = 0;
512 2
513 2 RTDSendAddr(index, 1, inc);
514 2
515 2 index = 0;
516 2 do
517 2 {
518 3 Data[index++] = RTDGetByte();
519 3 }
520 2 while (--count);
521 2
522 2 RTDSendStop();
523 2 }
524 1 }
525
526 void RTDWrite(unsigned char data *array)
527 {
528 1 unsigned char len, m;
529 1
530 1 do
531 1 {
532 2 if (0 == (array[0] & 0xfc)) return;
533 2
534 2 len = array[0] - 3;
535 2 array = array + 1;
536 2
537 2 bRTD_SCSB = 0;
538 2
539 2 if (BURST == array[0])
540 2 {
541 3 RTDSendAddr(array[1], 0, N_INC);
542 3
543 3 array = array + 2;
C51 COMPILER V6.20c ACCESS 04/15/2004 12:59:25 PAGE 10
544 3 m = array[0];
545 3
546 3 do
547 3 {
548 4 RTDSendByte(m);
549 4 }
550 3 while (--len);
551 3
552 3 array = array + 1;
553 3 }
554 2 else
555 2 {
556 3 RTDSendAddr(array[1], 0, array[0]);
557 3
558 3 array = array + 2;
559 3 do
560 3 {
561 4 RTDSendByte(*array++);
562 4 }
563 3 while (--len);
564 3 }
565 2
566 2 RTDSendStop();
567 2 }
568 1 while (1);
569 1 }
570
571 void RTDCodeW(unsigned char code *array)
572 {
573 1 unsigned char len, m;
574 1
575 1 do
576 1 {
577 2 if (0 == (array[0] & 0xfc)) return;
578 2
579 2 len = array[0] - 3;
580 2 array = array + 1;
581 2
582 2 bRTD_SCSB = 0;
583 2
584 2 if (BURST == array[0])
585 2 {
586 3 RTDSendAddr(array[1], 0, N_INC);
587 3
588 3 array = array + 2;
589 3 m = array[0];
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -