                        .module IR_test.c
                        .area text(rom, con, rel)
 0000                   .dbfile ..\Êµ391D~1\IR_test.c
                        .area data(ram, con, rel)
 0000                   .dbfile ..\Êµ391D~1\IR_test.c
 0000           _IR_BUF::
 0000                   .blkb 2
                        .area idata
 0000 0000              .word 0
                        .area data(ram, con, rel)
 0002                   .dbfile ..\Êµ391D~1\IR_test.c
 0002                   .blkb 2
                        .area idata
 0002 0000              .word 0
                        .area data(ram, con, rel)
 0004                   .dbfile ..\Êµ391D~1\IR_test.c
 0004                   .blkb 2
                        .area idata
 0004 0000              .word 0
                        .area data(ram, con, rel)
 0006                   .dbfile ..\Êµ391D~1\IR_test.c
 0006                   .blkb 2
                        .area idata
 0006 0000              .word 0
                        .area data(ram, con, rel)
 0008                   .dbfile ..\Êµ391D~1\IR_test.c
 0008                   .dbfile E:\BK-AVR128ÅäÌ×ÊµÑé³ÌÐò\Êµ391D~1\IR_test.c
 0008                   .dbsym e IR_BUF _IR_BUF A[8:4]i
                        .area text(rom, con, rel)
 0000                   .dbfile E:\BK-AVR128ÅäÌ×ÊµÑé³ÌÐò\Êµ391D~1\IR_test.c
 0000                   .dbfunc e delay_nus _delay_nus fV
 0000           ;              i -> R20,R21
 0000           ;              n -> R16,R17
                        .even
 0000           _delay_nus::
 0000 4A93              st -y,R20
 0002 5A93              st -y,R21
 0004                   .dbline -1
 0004                   .dbline 11
 0004           ; 
 0004           ; #include <iom128v.h>
 0004           ; #include <macros.h>
 0004           ; 
 0004           ; #define uchar unsigned char
 0004           ; #define uint unsigned int
 0004           ; 
 0004           ; uint IR_BUF[4]={0x00,0x00,0x00,0x00};
 0004           ; 
 0004           ; void delay_nus(unsigned int n)        //N usÑÓÊ±º¯Êý
 0004           ; {
 0004                   .dbline 12
 0004           ;     unsigned int i=0;
 0004                   .dbline 13
 0004           ;     for (i=0;i<n;i++)
 0004 4427              clr R20
 0006 5527              clr R21
 0008 03C0              xjmp L5
 000A           L2:
 000A                   .dbline 14
 000A           ;         asm("nop");
 000A 0000              nop
 000C           L3:
 000C                   .dbline 13
 000C 4F5F              subi R20,255  ; offset = 1
 000E 5F4F              sbci R21,255
 0010           L5:
 0010                   .dbline 13
 0010 4017              cp R20,R16
 0012 5107              cpc R21,R17
 0014 D0F3              brlo L2
 0016           X0:
 0016                   .dbline -2
 0016           L1:
 0016                   .dbline 0 ; func end
 0016 5991              ld R21,y+
 0018 4991              ld R20,y+
 001A 0895              ret
 001C                   .dbsym r i 20 i
 001C                   .dbsym r n 16 i
 001C                   .dbend
 001C                   .dbfunc e delay_nms _delay_nms fV
 001C           ;              j -> R20,R21
 001C           ;              i -> R22,R23
 001C           ;          count -> R16,R17
                        .even
 001C           _delay_nms::
 001C 0E940000          xcall push_xgsetF000
 0020                   .dbline -1
 0020                   .dbline 18
 0020           ; }
 0020           ; 
 0020           ; void delay_nms(unsigned int count)    //N msÑÓÊ±º¯Êý
 0020           ; { 
 0020                   .dbline 20
 0020           ;      unsigned int i,j; 
 0020           ;      for( j=0;j<count;j++ ) 
 0020 4427              clr R20
 0022 5527              clr R21
 0024 0CC0              xjmp L10
 0026           L7:
 0026                   .dbline 21
 0026           ;      { 
 0026                   .dbline 22
 0026           ;        for( i=0;i<999;i++ ) 
 0026 6627              clr R22
 0028 7727              clr R23
 002A 03C0              xjmp L14
 002C           L11:
 002C                   .dbline 23
 002C           ;        { 
 002C                   .dbline 24
 002C           ;           asm("nop"); 
 002C 0000              nop
 002E                   .dbline 25
 002E           ;        } 
 002E           L12:
 002E                   .dbline 22
 002E 6F5F              subi R22,255  ; offset = 1
 0030 7F4F              sbci R23,255
 0032           L14:
 0032                   .dbline 22
 0032 673E              cpi R22,231
 0034 E3E0              ldi R30,3
 0036 7E07              cpc R23,R30
 0038 C8F3              brlo L11
 003A           X1:
 003A                   .dbline 26
 003A           ;      } 
 003A           L8:
 003A                   .dbline 20
 003A 4F5F              subi R20,255  ; offset = 1
 003C 5F4F              sbci R21,255
 003E           L10:
 003E                   .dbline 20
 003E 4017              cp R20,R16
 0040 5107              cpc R21,R17
 0042 88F3              brlo L7
 0044           X2:
 0044                   .dbline -2
 0044           L6:
 0044                   .dbline 0 ; func end
 0044 0C940000          xjmp pop_xgsetF000
 0048                   .dbsym r j 20 i
 0048                   .dbsym r i 22 i
 0048                   .dbsym r count 16 i
 0048                   .dbend
 0048                   .dbfunc e main _main fV
 0048           ;              j -> R20,R21
 0048           ;           data -> R10,R11
 0048           ;              i -> R22,R23
 0048           ;           temp -> R12,R13
                        .even
 0048           _main::
 0048                   .dbline -1
 0048                   .dbline 30
 0048           ; }    
 0048           ; 
 0048           ; void main()
 0048           ; {
 0048                   .dbline 32
 0048           ;     uint   i,j;
 0048           ;     uint   temp=0x00;
 0048 CC24              clr R12
 004A DD24              clr R13
 004C                   .dbline 33
 004C           ;     uint   data=0x00;
 004C AA24              clr R10
 004E BB24              clr R11
 0050                   .dbline 35
 0050           ; 
 0050           ;     DDRA=0xff;             //Êä³ö¡£
 0050 8FEF              ldi R24,255
 0052 8ABB              out 0x1a,R24
 0054                   .dbline 36
 0054           ;     PORTA=0x00;
 0054 2224              clr R2
 0056 2BBA              out 0x1b,R2
 0058                   .dbline 37
 0058           ;     DDRC=0XFF;
 0058 84BB              out 0x14,R24
 005A                   .dbline 38
 005A           ;       PORTC=0XFF;
 005A 85BB              out 0x15,R24
 005C                   .dbline 40
 005C           ;       
 005C           ;       DDRF|=BIT(3)+BIT(1)+BIT(2);
 005C 80916100          lds R24,97
 0060 8E60              ori R24,14
 0062 80936100          sts 97,R24
 0066                   .dbline 41
 0066           ;       PORTF|=BIT(3)+BIT(1)+BIT(2);
 0066 80916200          lds R24,98
 006A 8E60              ori R24,14
 006C 80936200          sts 98,R24
 0070                   .dbline 42
 0070           ;       PORTF&=~(BIT(1)+BIT(2));
 0070 80916200          lds R24,98
 0074 897F              andi R24,249
 0076 80936200          sts 98,R24
 007A                   .dbline 44
 007A           ; 
 007A           ;     DDRD&=~BIT(2);            //ÊäÈë¡£
 007A 8A98              cbi 0x11,2
 007C 83C0              xjmp L17
 007E           L16:
 007E                   .dbline 46
 007E           ;     while(1)
 007E           ;       {
 007E           L19:
 007E                   .dbline 48
 007E           ;     RESET: 
 007E           ;              for( i=0;i<8;i++ )    //**9ms      
 007E 6627              clr R22
 0080 7727              clr R23
 0082 0AC0              xjmp L23
 0084           L20:
 0084                   .dbline 49
 0084           ;            { 
 0084                   .dbline 50
 0084           ;            delay_nms(1); 
 0084 01E0              ldi R16,1
 0086 10E0              ldi R17,0
 0088 C9DF              xcall _delay_nms
 008A                   .dbline 51
 008A           ;            if((PIND&0B00000100)==0B00000100 )       
 008A 80B3              in R24,0x10
 008C 8470              andi R24,4
 008E 8430              cpi R24,4
 0090 09F4              brne L24
 0092           X3:
 0092                   .dbline 52
 0092           ;            goto RESET;    //ÊÇ¼ì²âÔÚ8ºÁÃëÄÚÈç¹û³öÏÖ¸ßµçÆ½¾ÍÍË³ö½âÂë³ÌÐò  
 0092 F5CF              xjmp L19
 0094           L24:
 0094                   .dbline 53
 0094           ;            }      
 0094           L21:
 0094                   .dbline 48
 0094 6F5F              subi R22,255  ; offset = 1
 0096 7F4F              sbci R23,255
 0098           L23:
 0098                   .dbline 48
 0098 6830              cpi R22,8
 009A E0E0              ldi R30,0
 009C 7E07              cpc R23,R30
 009E 90F3              brlo L20
 00A0           X4:
 00A0                   .dbline 55
 00A0           ;            
 00A0           ;                  temp = 8000;         
 00A0 80E4              ldi R24,8000
 00A2 9FE1              ldi R25,31
 00A4 6C01              movw R12,R24
 00A6 03C0              xjmp L27
 00A8           L26:
 00A8                   .dbline 57
 00A8           ;            while( ( (PIND&0B00000100)==0B00000000 ) && (temp!=0) )
 00A8           ;            {temp--;}   
 00A8                   .dbline 57
 00A8 C601              movw R24,R12
 00AA 0197              sbiw R24,1
 00AC 6C01              movw R12,R24
 00AE                   .dbline 57
 00AE           L27:
 00AE                   .dbline 56
 00AE 8299              sbic 0x10,2
 00B0 04C0              rjmp L29
 00B2           X5:
 00B2 CC20              tst R12
 00B4 C9F7              brne L26
 00B6 DD20              tst R13
 00B8 B9F7              brne L26
 00BA           X6:
 00BA           L29:
 00BA                   .dbline 60
 00BA           ;             //    µÈ´ý4.5ms¸ßµçÆ½µÄµ½À´,±Ü¿ª9ºÁÃëµÍµçÆ½Òýµ¼Âö³å 
 00BA           ;                       //    temp--Ðè0.25us, temp=8000¿ÉÊµÏÖ2msÑÓÊ±£¬·ÀÖ¹¸ÉÈÅÂö³åÔì³ÉµÄËÀ»ú¡£ 
 00BA           ;            delay_nus(5412);   //**4.5ms
 00BA 04E2              ldi R16,5412
 00BC 15E1              ldi R17,21
 00BE A0DF              xcall _delay_nus
 00C0                   .dbline 62
 00C0           ;    
 00C0           ;            for( j=0;j<4;j++)
 00C0 4427              clr R20
 00C2 5527              clr R21
 00C4 3DC0              xjmp L33
 00C6           L30:
 00C6                   .dbline 63
 00C6           ;            {
 00C6                   .dbline 64
 00C6           ;                 for( i=0;i<8;i++ ) 
 00C6 6627              clr R22
 00C8 7727              clr R23
 00CA 2BC0              xjmp L37
 00CC           L34:
 00CC                   .dbline 65
 00CC           ;                 {   
 00CC                   .dbline 66
 00CC           ;                            temp = 4000; 
 00CC 80EA              ldi R24,4000
 00CE 9FE0              ldi R25,15
 00D0 6C01              movw R12,R24
 00D2 03C0              xjmp L39
 00D4           L38:
 00D4                   .dbline 68
 00D4           ;                      while( ((PIND&0B00000100)==0B00000000 ) && (temp!=0) )
 00D4           ;                      {temp--;} 
 00D4                   .dbline 68
 00D4 C601              movw R24,R12
 00D6 0197              sbiw R24,1
 00D8 6C01              movw R12,R24
 00DA                   .dbline 68
 00DA           L39:
 00DA                   .dbline 67
 00DA 8299              sbic 0x10,2
 00DC 04C0              rjmp L41
 00DE           X7:
 00DE CC20              tst R12
 00E0 C9F7              brne L38
 00E2 DD20              tst R13
 00E4 B9F7              brne L38
 00E6           X8:
 00E6           L41:
 00E6                   .dbline 70
 00E6           ;    
 00E6           ;                      delay_nus(1002);
 00E6 0AEE              ldi R16,1002
 00E8 13E0              ldi R17,3
 00EA 8ADF              xcall _delay_nus
 00EC                   .dbline 71
 00EC           ;                      if((PIND&0B00000100)==0B00000100 )       //    ¼ì²âµ½¸ßµçÆ½1µÄ»°ËµÃ÷¸ÃÎ»Îª1£¬ÑÓÊ±1ºÁÃëµÈ´ýÂö³å¸ßµçÆ½½áÊø 
 00EC 80B3              in R24,0x10
 00EE 8470              andi R24,4
 00F0 8430              cpi R24,4
 00F2 59F4              brne L42
 00F4           X9:
 00F4                   .dbline 72
 00F4           ;                      { 
 00F4                   .dbline 73
 00F4           ;                      data |= (1<<i);         //    dataH= ~data     dataL= data 
 00F4 01E0              ldi R16,1
 00F6 10E0              ldi R17,0
 00F8 9B01              movw R18,R22
 00FA 0E940000          xcall lsl16
 00FE A02A              or R10,R16
 0100 B12A              or R11,R17
 0102                   .dbline 74
 0102           ;                      delay_nus(1137); 
 0102 01E7              ldi R16,1137
 0104 14E0              ldi R17,4
 0106 7CDF              xcall _delay_nus
 0108                   .dbline 75
 0108           ;                      } 
 0108 0AC0              xjmp L43
 010A           L42:
 010A                   .dbline 76
 010A           ;                      else  data &= ~(1<<i);                           //    ¼ì²âµ½µÍµçÆ½0µÄ»°,ËµÃ÷¸ÃÎ»Îª0£¬¼ÌÐø¼ì²âÏÂÒ»Î»     
 010A 01E0              ldi R16,1
 010C 10E0              ldi R17,0
 010E 9B01              movw R18,R22
 0110 0E940000          xcall lsl16
 0114 1801              movw R2,R16
 0116 2094              com R2
 0118 3094              com R3
 011A A220              and R10,R2
 011C B320              and R11,R3
 011E           L43:
 011E                   .dbline 77
 011E           ;                 }
 011E           L35:
 011E                   .dbline 64
 011E 6F5F              subi R22,255  ; offset = 1
 0120 7F4F              sbci R23,255
 0122           L37:
 0122                   .dbline 64
 0122 6830              cpi R22,8
 0124 E0E0              ldi R30,0
 0126 7E07              cpc R23,R30
 0128 88F2              brlo L34
 012A           X10:
 012A                   .dbline 78
 012A           ;                 IR_BUF[j]=data;
 012A 80E0              ldi R24,<_IR_BUF
 012C 90E0              ldi R25,>_IR_BUF
 012E FA01              movw R30,R20
 0130 EE0F              lsl R30
 0132 FF1F              rol R31
 0134 E80F              add R30,R24
 0136 F91F              adc R31,R25
 0138 B182              std z+1,R11
 013A A082              std z+0,R10
 013C                   .dbline 79
 013C           ;            } 
 013C           L31:
 013C                   .dbline 62
 013C 4F5F              subi R20,255  ; offset = 1
 013E 5F4F              sbci R21,255
 0140           L33:
 0140                   .dbline 62
 0140 4430              cpi R20,4
 0142 E0E0              ldi R30,0
 0144 5E07              cpc R21,R30
 0146 08F4              brsh X14
 0148 BECF              xjmp L30
 014A           X14:
 014A           X11:
 014A                   .dbline 81
 014A           ;    
 014A           ;            if(IR_BUF[2] = ~IR_BUF[3])        //    Ð£Ñé 
 014A 20900600          lds R2,_IR_BUF+6
 014E 30900700          lds R3,_IR_BUF+6+1
 0152 2094              com R2
 0154 3094              com R3
 0156 30920500          sts _IR_BUF+4+1,R3
 015A 20920400          sts _IR_BUF+4,R2
 015E 2220              tst R2
 0160 11F4              brne X12
 0162 3320              tst R3
 0164 29F0              breq L44
 0166           X12:
 0166                   .dbline 82
 0166           ;            { 
 0166                   .dbline 83
 0166           ;            PORTA=IR_BUF[2];       //½âÂëÕýÈ·ºóµÄ¶¯×÷¡£
 0166 2BBA              out 0x1b,R2
 0168                   .dbline 84
 0168           ;            delay_nms(100);
 0168 04E6              ldi R16,100
 016A 10E0              ldi R17,0
 016C 57DF              xcall _delay_nms
 016E                   .dbline 85
 016E           ;            }
 016E 0AC0              xjmp L45
 0170           L44:
 0170                   .dbline 88
 0170           ;            
 0170           ;                  else                         //²»ÕýÈ·Ôò£¬Ê¹Êý¾ÝÓëµØÖ·Îª0¡£
 0170           ;            { 
 0170                   .dbline 89
 0170           ;                  IR_BUF[0]=0x00;
 0170 2224              clr R2
 0172 3324              clr R3
 0174 30920100          sts _IR_BUF+1,R3
 0178 20920000          sts _IR_BUF,R2
 017C                   .dbline 90
 017C           ;            IR_BUF[2]=0x00;
 017C 30920500          sts _IR_BUF+4+1,R3
 0180 20920400          sts _IR_BUF+4,R2
 0184                   .dbline 91
 0184           ;            }       
 0184           L45:
 0184                   .dbline 92
 0184           ;          }// while(1)
 0184           L17:
 0184                   .dbline 45
 0184 7CCF              xjmp L16
 0186           X13:
 0186                   .dbline -2
 0186           L15:
 0186                   .dbline 0 ; func end
 0186 0895              ret
 0188                   .dbsym r j 20 i
 0188                   .dbsym r data 10 i
 0188                   .dbsym r i 22 i
 0188                   .dbsym r temp 12 i
 0188                   .dbend
 0188           ; }
