                        .module EEPROM.c
                        .area text(rom, con, rel)
 0000                   .dbfile ..\..\..\BK-AVR~1\BK-AVR128ÅäÌ×ÊµÑé³ÌÐò\ÊµÑé¾Å~1\EEPROM.c
                        .area data(ram, con, rel)
 0000                   .dbfile ..\..\..\BK-AVR~1\BK-AVR128ÅäÌ×ÊµÑé³ÌÐò\ÊµÑé¾Å~1\EEPROM.c
 0000           _led_discode::
 0000                   .blkb 2
                        .area idata
 0000 C0F9              .byte 192,249
                        .area data(ram, con, rel)
 0002                   .dbfile ..\..\..\BK-AVR~1\BK-AVR128ÅäÌ×ÊµÑé³ÌÐò\ÊµÑé¾Å~1\EEPROM.c
 0002                   .blkb 2
                        .area idata
 0002 A4B0              .byte 164,176
                        .area data(ram, con, rel)
 0004                   .dbfile ..\..\..\BK-AVR~1\BK-AVR128ÅäÌ×ÊµÑé³ÌÐò\ÊµÑé¾Å~1\EEPROM.c
 0004                   .blkb 2
                        .area idata
 0004 9992              .byte 153,146
                        .area data(ram, con, rel)
 0006                   .dbfile ..\..\..\BK-AVR~1\BK-AVR128ÅäÌ×ÊµÑé³ÌÐò\ÊµÑé¾Å~1\EEPROM.c
 0006                   .blkb 2
                        .area idata
 0006 82F8              .byte 130,248
                        .area data(ram, con, rel)
 0008                   .dbfile ..\..\..\BK-AVR~1\BK-AVR128ÅäÌ×ÊµÑé³ÌÐò\ÊµÑé¾Å~1\EEPROM.c
 0008                   .blkb 2
                        .area idata
 0008 8090              .byte 128,144
                        .area data(ram, con, rel)
 000A                   .dbfile ..\..\..\BK-AVR~1\BK-AVR128ÅäÌ×ÊµÑé³ÌÐò\ÊµÑé¾Å~1\EEPROM.c
 000A                   .blkb 1
                        .area idata
 000A FF                .byte 255
                        .area data(ram, con, rel)
 000B                   .dbfile ..\..\..\BK-AVR~1\BK-AVR128ÅäÌ×ÊµÑé³ÌÐò\ÊµÑé¾Å~1\EEPROM.c
 000B                   .dbfile E:\BK-AVR~1\BK-AVR128ÅäÌ×ÊµÑé³ÌÐò\ÊµÑé¾Å~1\EEPROM.c
 000B                   .dbsym e led_discode _led_discode A[11:11]c
                        .area text(rom, con, rel)
 0000                   .dbfile E:\BK-AVR~1\BK-AVR128ÅäÌ×ÊµÑé³ÌÐò\ÊµÑé¾Å~1\EEPROM.c
 0000                   .dbfunc e main _main fV
 0000           ;          E_DAT -> R10
 0000           ;            num -> R20
 0000           ;              m -> R22
                        .even
 0000           _main::
 0000                   .dbline -1
 0000                   .dbline 30
 0000           ; 
 0000           ; /********************************************************
 0000           ; ÊµÑé¾Å:   ÄÚ²¿EEPROM¶ÁÐ´ÊµÑé
 0000           ; ËµÃ÷:     ×ó±ßÊýÂë¹ÜÏÔÊ¾µÄÊÇÐ´ÈëEEPROMµÄÊý¾Ý  
 0000           ;           ÓÒ±ßÊýÂë¹ÜÏÔÊ¾µÄÊÇ¶Á³öEEPROMµÄÊý¾Ý
 0000           ; CPUÐÍºÅ:  ATMEGA128A
 0000           ; Ê±ÖÓ:     Íâ²¿8MHZ
 0000           ; ÈÕÆÚ£º    20011-3-2
 0000           ; ÁªÏµ·½·¨: MCU.2000@163.com 
 0000           ;  ********************************************************/
 0000           ; 
 0000           ; #include<iom128v.h>
 0000           ; #include<macros.h>
 0000           ; 
 0000           ; #define uchar unsigned char
 0000           ; #define uint  unsigned int
 0000           ; 
 0000           ; void delayus(uchar i);
 0000           ; 
 0000           ; void Mcu_IO_Init(void);
 0000           ; 
 0000           ; uchar EE0PROM_read(uint EEPROM_ADDR);
 0000           ; void EEPROM_write(uint EEPROM_ADDR, uchar EEPROM_DAT);
 0000           ; 
 0000           ; //¹²ÑôÊýÂë¹ÜÊý×ÖÂë
 0000           ; uchar led_discode[11]={0xc0,0xf9,0xa4,0xb0,0x99,
 0000           ;                        0x92,0x82,0xf8,0x80,0x90,0xff};     
 0000           ; 
 0000           ; void main (void)
 0000           ; {
 0000                   .dbline 31
 0000           ;       uchar num, m, E_DAT;;
 0000                   .dbline 32
 0000           ;       Mcu_IO_Init();
 0000 3AD0              xcall _Mcu_IO_Init
 0002 37C0              xjmp L3
 0004           L2:
 0004                   .dbline 34
 0004           ;     while(1)
 0004           ;     for(num=0;num<10;num++)
 0004 4427              clr R20
 0006 32C0              xjmp L8
 0008           L5:
 0008                   .dbline 35
 0008           ;       {
 0008                   .dbline 36
 0008           ;     EEPROM_write(0X01, num);
 0008 242F              mov R18,R20
 000A 01E0              ldi R16,1
 000C 10E0              ldi R17,0
 000E 4DD0              xcall _EEPROM_write
 0010                   .dbline 37
 0010           ;     delay_nms(10);
 0010 0AE0              ldi R16,10
 0012 10E0              ldi R17,0
 0014 69D0              xcall _delay_nms
 0016                   .dbline 38
 0016           ;       E_DAT=EE0PROM_read(0x01);
 0016 01E0              ldi R16,1
 0018 10E0              ldi R17,0
 001A 50D0              xcall _EE0PROM_read
 001C A02E              mov R10,R16
 001E                   .dbline 39
 001E           ;       delay_nms(10); 
 001E 0AE0              ldi R16,10
 0020 10E0              ldi R17,0
 0022 62D0              xcall _delay_nms
 0024                   .dbline 40
 0024           ;       for(m=0;m<100;m++)
 0024 6627              clr R22
 0026 1FC0              xjmp L12
 0028           L9:
 0028                   .dbline 41
 0028           ;           {
 0028                   .dbline 42
 0028           ;            PORTA=0X00;
 0028 2224              clr R2
 002A 2BBA              out 0x1b,R2
 002C                   .dbline 43
 002C           ;                PORTC=led_discode[num];
 002C 80E0              ldi R24,<_led_discode
 002E 90E0              ldi R25,>_led_discode
 0030 E42F              mov R30,R20
 0032 FF27              clr R31
 0034 E80F              add R30,R24
 0036 F91F              adc R31,R25
 0038 2080              ldd R2,z+0
 003A 25BA              out 0x15,R2
 003C                   .dbline 44
 003C           ;          PORTA=0x01;                 
 003C 81E0              ldi R24,1
 003E 8BBB              out 0x1b,R24
 0040                   .dbline 45
 0040           ;                delay_nms(2);
 0040 02E0              ldi R16,2
 0042 10E0              ldi R17,0
 0044 51D0              xcall _delay_nms
 0046                   .dbline 47
 0046           ;            
 0046           ;                PORTA=0X00;  
 0046 2224              clr R2
 0048 2BBA              out 0x1b,R2
 004A                   .dbline 48
 004A           ;                PORTC=led_discode[E_DAT];   
 004A 80E0              ldi R24,<_led_discode
 004C 90E0              ldi R25,>_led_discode
 004E EA2D              mov R30,R10
 0050 FF27              clr R31
 0052 E80F              add R30,R24
 0054 F91F              adc R31,R25
 0056 2080              ldd R2,z+0
 0058 25BA              out 0x15,R2
 005A                   .dbline 49
 005A           ;                PORTA=0X80;
 005A 80E8              ldi R24,128
 005C 8BBB              out 0x1b,R24
 005E                   .dbline 50
 005E           ;                delay_nms(2);             
 005E 02E0              ldi R16,2
 0060 10E0              ldi R17,0
 0062 42D0              xcall _delay_nms
 0064                   .dbline 51
 0064           ;                }
 0064           L10:
 0064                   .dbline 40
 0064 6395              inc R22
 0066           L12:
 0066                   .dbline 40
 0066 6436              cpi R22,100
 0068 F8F2              brlo L9
 006A           X0:
 006A                   .dbline 52
 006A           ;     }
 006A           L6:
 006A                   .dbline 34
 006A 4395              inc R20
 006C           L8:
 006C                   .dbline 34
 006C 4A30              cpi R20,10
 006E 08F4              brsh X3
 0070 CBCF              xjmp L5
 0072           X3:
 0072           X1:
 0072           L3:
 0072                   .dbline 33
 0072 C8CF              xjmp L2
 0074           X2:
 0074                   .dbline -2
 0074           L1:
 0074                   .dbline 0 ; func end
 0074 0895              ret
 0076                   .dbsym r E_DAT 10 c
 0076                   .dbsym r num 20 c
 0076                   .dbsym r m 22 c
 0076                   .dbend
 0076                   .dbfunc e Mcu_IO_Init _Mcu_IO_Init fV
                        .even
 0076           _Mcu_IO_Init::
 0076                   .dbline -1
 0076                   .dbline 56
 0076           ; }
 0076           ; //¶Ë¿Ú³õÊ¼»¯³ÌÐò
 0076           ; void Mcu_IO_Init(void)
 0076           ; {
 0076                   .dbline 57
 0076           ;      DDRA=0XFF;             //LED IO¿ÚÉèÎªÊä³ö
 0076 8FEF              ldi R24,255
 0078 8ABB              out 0x1a,R24
 007A                   .dbline 58
 007A           ;        DDRC=0XFF;             //ÊýÂë¹Ü¶ÎÑ¡ÉèÎªÊä³ö
 007A 84BB              out 0x14,R24
 007C                   .dbline 59
 007C           ;        DDRF |=0X0E;           //LED¼°ÊýÂë¹ÜËø´æIO¿ÚÉèÎªÊä³ö
 007C 80916100          lds R24,97
 0080 8E60              ori R24,14
 0082 80936100          sts 97,R24
 0086                   .dbline 60
 0086           ;        PORTF|=0X0E;           
 0086 80916200          lds R24,98
 008A 8E60              ori R24,14
 008C 80936200          sts 98,R24
 0090                   .dbline 61
 0090           ;        PORTA=0XFF;
 0090 8FEF              ldi R24,255
 0092 8BBB              out 0x1b,R24
 0094                   .dbline 62
 0094           ;        PORTC=0XFF;            
 0094 85BB              out 0x15,R24
 0096                   .dbline 63
 0096           ;        PORTF&=0xF7;           //Ëø´æÊý¾Ý¹Ø±ÕLED
 0096 80916200          lds R24,98
 009A 877F              andi R24,247
 009C 80936200          sts 98,R24
 00A0                   .dbline 65
 00A0           ;              
 00A0           ;        PORTA=0X00;            //¹ØÊýÂë¹Ü
 00A0 2224              clr R2
 00A2 2BBA              out 0x1b,R2
 00A4                   .dbline 67
 00A4           ;        
 00A4           ;        DDRB |=0X10;           //PB4ÉèÎªÊä³ö
 00A4 BC9A              sbi 0x17,4
 00A6                   .dbline 68
 00A6           ;        PORTB|=0X10;           //¹Ø±ÕPB4Íâ½ÓµÄLED
 00A6 C49A              sbi 0x18,4
 00A8                   .dbline -2
 00A8           L13:
 00A8                   .dbline 0 ; func end
 00A8 0895              ret
 00AA                   .dbend
 00AA                   .dbfunc e EEPROM_write _EEPROM_write fV
 00AA           ;     EEPROM_DAT -> R18
 00AA           ;    EEPROM_ADDR -> R16,R17
                        .even
 00AA           _EEPROM_write::
 00AA                   .dbline -1
 00AA                   .dbline 77
 00AA           ; }
 00AA           ; 
 00AA           ; /*************************************************************/
 00AA           ; 
 00AA           ; //Ð´Ò»×Ö½ÚÊý¾Ýµ½MCUµÄÄÚ²¿EEPROM
 00AA           ; 
 00AA           ; /*************************************************************/
 00AA           ; void EEPROM_write(uint EEPROM_ADDR, uchar EEPROM_DAT)
 00AA           ; {
 00AA           L15:
 00AA                   .dbline 78
 00AA           ;      while(EECR & (1<<EEWE));
 00AA           L16:
 00AA                   .dbline 78
 00AA E199              sbic 0x1c,1
 00AC FECF              rjmp L15
 00AE           X4:
 00AE                   .dbline 79
 00AE           ;        EEARH = 0X00;
 00AE 2224              clr R2
 00B0 2FBA              out 0x1f,R2
 00B2                   .dbline 80
 00B2           ;        EEARL = EEPROM_ADDR;
 00B2 0EBB              out 0x1e,R16
 00B4                   .dbline 81
 00B4           ;        EEDR = EEPROM_DAT;
 00B4 2DBB              out 0x1d,R18
 00B6                   .dbline 83
 00B6           ;        
 00B6           ;        EECR |= (1<<EEMWE);
 00B6 E29A              sbi 0x1c,2
 00B8                   .dbline 85
 00B8           ;        
 00B8           ;        EECR |= (1<<EEWE);
 00B8 E19A              sbi 0x1c,1
 00BA                   .dbline -2
 00BA           L14:
 00BA                   .dbline 0 ; func end
 00BA 0895              ret
 00BC                   .dbsym r EEPROM_DAT 18 c
 00BC                   .dbsym r EEPROM_ADDR 16 i
 00BC                   .dbend
 00BC                   .dbfunc e EE0PROM_read _EE0PROM_read fc
 00BC           ;    EEPROM_ADDR -> R16,R17
                        .even
 00BC           _EE0PROM_read::
 00BC                   .dbline -1
 00BC                   .dbline 94
 00BC           ; }
 00BC           ; 
 00BC           ; /*************************************************************/
 00BC           ; 
 00BC           ; //´ÓMCUµÄÄÚ²¿EEPROM¶ÁÒ»×Ö½ÚÊý¾Ý
 00BC           ; 
 00BC           ; /*************************************************************/       
 00BC           ; uchar EE0PROM_read(uint EEPROM_ADDR)
 00BC           ; {
 00BC           L19:
 00BC                   .dbline 95
 00BC           ;      while(EECR & (1<<EEWE));
 00BC           L20:
 00BC                   .dbline 95
 00BC E199              sbic 0x1c,1
 00BE FECF              rjmp L19
 00C0           X5:
 00C0                   .dbline 96
 00C0           ;        EEARH = 0X00;
 00C0 2224              clr R2
 00C2 2FBA              out 0x1f,R2
 00C4                   .dbline 97
 00C4           ;        EEARL = EEPROM_ADDR;
 00C4 0EBB              out 0x1e,R16
 00C6                   .dbline 99
 00C6           ;        
 00C6           ;        EECR |= (1<<EERE);
 00C6 E09A              sbi 0x1c,0
 00C8                   .dbline 101
 00C8           ;        
 00C8           ;        return EEDR;
 00C8 0DB3              in R16,0x1d
 00CA                   .dbline -2
 00CA           L18:
 00CA                   .dbline 0 ; func end
 00CA 0895              ret
 00CC                   .dbsym r EEPROM_ADDR 16 i
 00CC                   .dbend
 00CC                   .dbfunc e delay_nus _delay_nus fV
 00CC           ;              i -> R20,R21
 00CC           ;              n -> R16,R17
                        .even
 00CC           _delay_nus::
 00CC 4A93              st -y,R20
 00CE 5A93              st -y,R21
 00D0                   .dbline -1
 00D0                   .dbline 112
 00D0           ; } 
 00D0           ; 
 00D0           ; /*-----------------------------------------------------------------------
 00D0           ; ÑÓÊ±º¯Êý
 00D0           ; ±àÒëÆ÷£ºICC-AVR v6.31A 
 00D0           ; ÈÕÆÚ: 2009-7-30 
 00D0           ; Ä¿±êÐ¾Æ¬ : M128
 00D0           ; Ê±ÖÓ:7.3728Mhz
 00D0           ; -----------------------------------------------------------------------*/
 00D0           ; void delay_nus(unsigned int n)       //N usÑÓÊ±º¯Êý
 00D0           ; {
 00D0                   .dbline 113
 00D0           ;      unsigned int i=0;
 00D0                   .dbline 114
 00D0           ;      for (i=0;i<n;i++)
 00D0 4427              clr R20
 00D2 5527              clr R21
 00D4 03C0              xjmp L26
 00D6           L23:
 00D6                   .dbline 115
 00D6           ;      asm("nop");
 00D6 0000              nop
 00D8           L24:
 00D8                   .dbline 114
 00D8 4F5F              subi R20,255  ; offset = 1
 00DA 5F4F              sbci R21,255
 00DC           L26:
 00DC                   .dbline 114
 00DC 4017              cp R20,R16
 00DE 5107              cpc R21,R17
 00E0 D0F3              brlo L23
 00E2           X6:
 00E2                   .dbline -2
 00E2           L22:
 00E2                   .dbline 0 ; func end
 00E2 5991              ld R21,y+
 00E4 4991              ld R20,y+
 00E6 0895              ret
 00E8                   .dbsym r i 20 i
 00E8                   .dbsym r n 16 i
 00E8                   .dbend
 00E8                   .dbfunc e delay_nms _delay_nms fV
 00E8           ;              i -> R20,R21
 00E8           ;              j -> R22,R23
 00E8           ;              n -> R16,R17
                        .even
 00E8           _delay_nms::
 00E8 0E940000          xcall push_xgsetF000
 00EC                   .dbline -1
 00EC                   .dbline 119
 00EC           ; }
 00EC           ;   
 00EC           ; void delay_nms(unsigned int n)       //N msÑÓÊ±º¯Êý
 00EC           ; {
 00EC                   .dbline 120
 00EC           ;      unsigned int i=0,j=0;
 00EC                   .dbline 120
 00EC 6627              clr R22
 00EE 7727              clr R23
 00F0                   .dbline 121
 00F0           ;      for (i=0;i<n;i++)
 00F0 4427              clr R20
 00F2 5527              clr R21
 00F4 0BC0              xjmp L31
 00F6           L28:
 00F6                   .dbline 122
 00F6           ;      for (j=0;j<1140;j++);
 00F6 6627              clr R22
 00F8 7727              clr R23
 00FA 02C0              xjmp L35
 00FC           L32:
 00FC                   .dbline 122
 00FC           L33:
 00FC                   .dbline 122
 00FC 6F5F              subi R22,255  ; offset = 1
 00FE 7F4F              sbci R23,255
 0100           L35:
 0100                   .dbline 122
 0100 6437              cpi R22,116
 0102 E4E0              ldi R30,4
 0104 7E07              cpc R23,R30
 0106 D0F3              brlo L32
 0108           X7:
 0108           L29:
 0108                   .dbline 121
 0108 4F5F              subi R20,255  ; offset = 1
 010A 5F4F              sbci R21,255
 010C           L31:
 010C                   .dbline 121
 010C 4017              cp R20,R16
 010E 5107              cpc R21,R17
 0110 90F3              brlo L28
 0112           X8:
 0112                   .dbline -2
 0112           L27:
 0112                   .dbline 0 ; func end
 0112 0C940000          xjmp pop_xgsetF000
 0116                   .dbsym r i 20 i
 0116                   .dbsym r j 22 i
 0116                   .dbsym r n 16 i
 0116                   .dbend
 0116           ; }
 0116           ; 
