                        .module STEP_MOTOR.C
                        .area text(rom, con, rel)
 0000                   .dbfile ..\..\..\BK-AVR~1\BK-AVR128ÅäÌ×ÊµÑé³ÌÐò\ÊµÑéÊ®~4\STEP_MOTOR.C
                        .area data(ram, con, rel)
 0000                   .dbfile ..\..\..\BK-AVR~1\BK-AVR128ÅäÌ×ÊµÑé³ÌÐò\ÊµÑéÊ®~4\STEP_MOTOR.C
 0000           _flag::
 0000                   .blkb 1
                        .area idata
 0000 00                .byte 0
                        .area data(ram, con, rel)
 0001                   .dbfile ..\..\..\BK-AVR~1\BK-AVR128ÅäÌ×ÊµÑé³ÌÐò\ÊµÑéÊ®~4\STEP_MOTOR.C
 0001                   .dbfile E:\BK-AVR~1\BK-AVR128ÅäÌ×ÊµÑé³ÌÐò\ÊµÑéÊ®~4\STEP_MOTOR.C
 0001                   .dbsym e flag _flag c
                        .area text(rom, con, rel)
 0000                   .dbfile E:\BK-AVR~1\BK-AVR128ÅäÌ×ÊµÑé³ÌÐò\ÊµÑéÊ®~4\STEP_MOTOR.C
 0000                   .dbfunc e main _main fV
                        .even
 0000           _main::
 0000                   .dbline -1
 0000                   .dbline 25
 0000           ; 
 0000           ; /******************************************************************
 0000           ; ²½½øµç»ú²âÊÔÊµÀý £¨±¾²âÊÔ³ÌÐòÊÊÓÃÓÚ28BYJ-48  5VDCÐ¡²½½øµç»ú)
 0000           ; 
 0000           ; ÊµÑéËµÃ÷:    °´K17°´¼ü----²½½øµç»úÕý×ª
 0000           ;              °´K18°´¼ü----²½½øµç»ú·´×ª
 0000           ;  
 0000           ; ±àÒë»·¾³: ICCAVR 
 0000           ; CPUÐÍºÅ:  ATMEGA128A
 0000           ; ¾§ÕñÆµÂÊ: 8MHZ
 0000           ; ÈÕÆÚ£º    20011-3-9
 0000           ; ÁªÏµ·½·¨: MCU¡£2000@163.com 
 0000           ;  ******************************************************************/
 0000           ; 
 0000           ; #include <iom128v.H>
 0000           ; #include <macros.h>
 0000           ; #define uchar unsigned char
 0000           ; #define uint  unsigned int
 0000           ; 
 0000           ; void Delayms(uint MS);
 0000           ; 
 0000           ; uchar flag=0;
 0000           ; 
 0000           ; void  main (void)
 0000           ; {  
 0000                   .dbline 26
 0000           ;       DDRA=0XFF;                   //LED IO¿ÚÉèÎªÊä³ö
 0000 8FEF              ldi R24,255
 0002 8ABB              out 0x1a,R24
 0004                   .dbline 27
 0004           ;         DDRC=0XFF;                   //ÊýÂë¹Ü¶ÎÑ¡ÉèÎªÊä³ö
 0004 84BB              out 0x14,R24
 0006                   .dbline 28
 0006           ;         DDRF |=0X03;                 //LED¼°ÊýÂë¹ÜËø´æIO¿ÚÉèÎªÊä³ö
 0006 80916100          lds R24,97
 000A 8360              ori R24,3
 000C 80936100          sts 97,R24
 0010                   .dbline 29
 0010           ;         PORTF|=0X0E;           
 0010 80916200          lds R24,98
 0014 8E60              ori R24,14
 0016 80936200          sts 98,R24
 001A                   .dbline 30
 001A           ;         PORTA=0XFF;
 001A 8FEF              ldi R24,255
 001C 8BBB              out 0x1b,R24
 001E                   .dbline 31
 001E           ;         PORTC=0XFF;            
 001E 85BB              out 0x15,R24
 0020                   .dbline 32
 0020           ;         PORTF&=0xF1;                 //Ëø´æÊý¾Ý¹Ø±ÕÊýÂë¹Ü     
 0020 80916200          lds R24,98
 0024 817F              andi R24,241
 0026 80936200          sts 98,R24
 002A                   .dbline 34
 002A           ;       
 002A           ;       DDRB=0X1F;  
 002A 8FE1              ldi R24,31
 002C 87BB              out 0x17,R24
 002E                   .dbline 35
 002E           ;         PORTB=0XFF;   
 002E 8FEF              ldi R24,255
 0030 88BB              out 0x18,R24
 0032                   .dbline 38
 0032           ;         
 0032           ;         
 0032           ;         EIMSK|=(1<<INT0)|(1<<INT1);   //´ò¿ªINT0 INT1ÖÐ¶Ï   
 0032 89B7              in R24,0x39
 0034 8360              ori R24,3
 0036 89BF              out 0x39,R24
 0038                   .dbline 39
 0038           ;       SEI();  
 0038 7894              sei
 003A 2DC0              xjmp L3
 003C           L2:
 003C                   .dbline 42
 003C           ;       
 003C           ;         while(1)
 003C           ;       {              
 003C                   .dbline 43
 003C           ;               if(flag)   //Õý×ª
 003C 20900000          lds R2,_flag
 0040 2220              tst R2
 0042 A9F0              breq L5
 0044           X0:
 0044                   .dbline 44
 0044           ;                       {
 0044                   .dbline 45
 0044           ;                              PORTB=0xF7; Delayms(5);
 0044 87EF              ldi R24,247
 0046 88BB              out 0x18,R24
 0048                   .dbline 45
 0048 05E0              ldi R16,5
 004A 10E0              ldi R17,0
 004C 3AD0              xcall _Delayms
 004E                   .dbline 46
 004E           ;                                  PORTB=0XFB; Delayms(5);
 004E 8BEF              ldi R24,251
 0050 88BB              out 0x18,R24
 0052                   .dbline 46
 0052 05E0              ldi R16,5
 0054 10E0              ldi R17,0
 0056 35D0              xcall _Delayms
 0058                   .dbline 47
 0058           ;                                  PORTB=0XFD; Delayms(5);
 0058 8DEF              ldi R24,253
 005A 88BB              out 0x18,R24
 005C                   .dbline 47
 005C 05E0              ldi R16,5
 005E 10E0              ldi R17,0
 0060 30D0              xcall _Delayms
 0062                   .dbline 48
 0062           ;                                  PORTB=0XFE; Delayms(5);   
 0062 8EEF              ldi R24,254
 0064 88BB              out 0x18,R24
 0066                   .dbline 48
 0066 05E0              ldi R16,5
 0068 10E0              ldi R17,0
 006A 2BD0              xcall _Delayms
 006C                   .dbline 49
 006C           ;                   }
 006C 14C0              xjmp L6
 006E           L5:
 006E                   .dbline 51
 006E           ;                       else      //·´×ª
 006E           ;                       {
 006E                   .dbline 52
 006E           ;                                  PORTB=0xFE; Delayms(5);
 006E 8EEF              ldi R24,254
 0070 88BB              out 0x18,R24
 0072                   .dbline 52
 0072 05E0              ldi R16,5
 0074 10E0              ldi R17,0
 0076 25D0              xcall _Delayms
 0078                   .dbline 53
 0078           ;                                  PORTB=0XFD; Delayms(5);
 0078 8DEF              ldi R24,253
 007A 88BB              out 0x18,R24
 007C                   .dbline 53
 007C 05E0              ldi R16,5
 007E 10E0              ldi R17,0
 0080 20D0              xcall _Delayms
 0082                   .dbline 54
 0082           ;                                  PORTB=0XFB; Delayms(5);
 0082 8BEF              ldi R24,251
 0084 88BB              out 0x18,R24
 0086                   .dbline 54
 0086 05E0              ldi R16,5
 0088 10E0              ldi R17,0
 008A 1BD0              xcall _Delayms
 008C                   .dbline 55
 008C           ;                                  PORTB=0XF7; Delayms(5);         
 008C 87EF              ldi R24,247
 008E 88BB              out 0x18,R24
 0090                   .dbline 55
 0090 05E0              ldi R16,5
 0092 10E0              ldi R17,0
 0094 16D0              xcall _Delayms
 0096                   .dbline 56
 0096           ;                       }               
 0096           L6:
 0096                   .dbline 57
 0096           ;               } //while
 0096           L3:
 0096                   .dbline 41
 0096 D2CF              xjmp L2
 0098           X1:
 0098                   .dbline -2
 0098           L1:
 0098                   .dbline 0 ; func end
 0098 0895              ret
 009A                   .dbend
                        .area vector(rom, abs)
                        .org 4
 0004 0C944D00          jmp _int0_INT
                        .area text(rom, con, rel)
 009A                   .dbfile E:\BK-AVR~1\BK-AVR128ÅäÌ×ÊµÑé³ÌÐò\ÊµÑéÊ®~4\STEP_MOTOR.C
 009A                   .dbfunc e int0_INT _int0_INT fV
                        .even
 009A           _int0_INT::
 009A 8A93              st -y,R24
 009C 8FB7              IN R24,63
 009E 8A93              st -y,R24
 00A0                   .dbline -1
 00A0                   .dbline 63
 00A0           ; }
 00A0           ; 
 00A0           ; //Íâ²¿ÖÐ¶Ï0×Ö³ÌÐò
 00A0           ; #pragma interrupt_handler int0_INT:2
 00A0           ; void int0_INT(void)
 00A0           ; {
 00A0                   .dbline 64
 00A0           ;    flag=1;                      //Õý×ª±êÖ¾Î»
 00A0 81E0              ldi R24,1
 00A2 80930000          sts _flag,R24
 00A6                   .dbline -2
 00A6           L7:
 00A6                   .dbline 0 ; func end
 00A6 8991              ld R24,y+
 00A8 8FBF              OUT 63,R24
 00AA 8991              ld R24,y+
 00AC 1895              reti
 00AE                   .dbend
                        .area vector(rom, abs)
                        .org 8
 0008 0C945700          jmp _int1_INT
                        .area text(rom, con, rel)
 00AE                   .dbfile E:\BK-AVR~1\BK-AVR128ÅäÌ×ÊµÑé³ÌÐò\ÊµÑéÊ®~4\STEP_MOTOR.C
 00AE                   .dbfunc e int1_INT _int1_INT fV
                        .even
 00AE           _int1_INT::
 00AE 2A92              st -y,R2
 00B0 2FB6              IN R2,63
 00B2 2A92              st -y,R2
 00B4                   .dbline -1
 00B4                   .dbline 70
 00B4           ; }
 00B4           ; 
 00B4           ; //Íâ²¿ÖÐ¶Ï1×Ö³ÌÐò
 00B4           ; #pragma interrupt_handler int1_INT:3
 00B4           ; void int1_INT(void)
 00B4           ; {
 00B4                   .dbline 71
 00B4           ;    flag=0;                      //·´×ª±êÖ¾Î»
 00B4 2224              clr R2
 00B6 20920000          sts _flag,R2
 00BA                   .dbline -2
 00BA           L8:
 00BA                   .dbline 0 ; func end
 00BA 2990              ld R2,y+
 00BC 2FBE              OUT 63,R2
 00BE 2990              ld R2,y+
 00C0 1895              reti
 00C2                   .dbend
 00C2                   .dbfunc e Delayms _Delayms fV
 00C2           ;              i -> R20,R21
 00C2           ;              j -> R22,R23
 00C2           ;             MS -> R16,R17
                        .even
 00C2           _Delayms::
 00C2 0E940000          xcall push_xgsetF000
 00C6                   .dbline -1
 00C6                   .dbline 82
 00C6           ; }
 00C6           ; 
 00C6           ; /****************************************************
 00C6           ; º¯ÊýÃû³Æ: Delayms
 00C6           ; ¹¦    ÄÜ: ÑÓÊ±Ö¸¶¨ºÁÃë£¨8M¾§Õñ£©
 00C6           ; ²Î    Êý: MS--ÑÓÊ±µÄºÁÃëÊý
 00C6           ; ·µ»ØÖµ  : ÎÞ
 00C6           ; Í¨¹ýÈí¼þ·ÂÕæ·´¸´ÊµÑéµÃµ½µÄÊýÖµ
 00C6           ; /****************************************************/
 00C6           ; void Delayms(uint MS)           
 00C6           ; {
 00C6                   .dbline 84
 00C6           ;      uint i,j;
 00C6           ;      for( i=0;i<MS;i++)
 00C6 4427              clr R20
 00C8 5527              clr R21
 00CA 0BC0              xjmp L13
 00CC           L10:
 00CC                   .dbline 85
 00CC           ;      for(j=0;j<1141;j++);     
 00CC 6627              clr R22
 00CE 7727              clr R23
 00D0 02C0              xjmp L17
 00D2           L14:
 00D2                   .dbline 85
 00D2           L15:
 00D2                   .dbline 85
 00D2 6F5F              subi R22,255  ; offset = 1
 00D4 7F4F              sbci R23,255
 00D6           L17:
 00D6                   .dbline 85
 00D6 6537              cpi R22,117
 00D8 E4E0              ldi R30,4
 00DA 7E07              cpc R23,R30
 00DC D0F3              brlo L14
 00DE           X2:
 00DE           L11:
 00DE                   .dbline 84
 00DE 4F5F              subi R20,255  ; offset = 1
 00E0 5F4F              sbci R21,255
 00E2           L13:
 00E2                   .dbline 84
 00E2 4017              cp R20,R16
 00E4 5107              cpc R21,R17
 00E6 90F3              brlo L10
 00E8           X3:
 00E8                   .dbline -2
 00E8           L9:
 00E8                   .dbline 0 ; func end
 00E8 0C940000          xjmp pop_xgsetF000
 00EC                   .dbsym r i 20 i
 00EC                   .dbsym r j 22 i
 00EC                   .dbsym r MS 16 i
 00EC                   .dbend
 00EC           ; }
