⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rteeprom.lis

📁 AVR系列单片机ATMEGA64开发的LED显示屏程序 内容包括ATMEGA64大部分资源的初始化程序
💻 LIS
字号:
                        .module rteeprom.c
                        .area text(rom, con, rel)
 0000                   .dbfile C:\DOCUME~1\11111\桌面\13个费显MEGA64\重显MEGA64\rteeprom.c
 0000                   .dbfunc e RTEEPROMReady _RTEEPROMReady fc
                        .even
 0000           _RTEEPROMReady::
 0000                   .dbline -1
 0000                   .dbline 5
 0000           ; #include <include.h>
 0000           ; // function to test if the EEPROM is ready for a read or write operation
 0000           ; // returns non zero if ready, zero if not ready 
 0000           ; unsigned char RTEEPROMReady(void)
 0000           ; {
 0000                   .dbline 6
 0000           ;       return !(EECR & 0x02);
 0000 E199              sbic 0x1c,1
 0002 03C0              rjmp L3
 0004 01E0              ldi R16,1
 0006 10E0              ldi R17,0
 0008 02C0              xjmp L4
 000A           L3:
 000A 0027              clr R16
 000C 1127              clr R17
 000E           L4:
 000E                   .dbline -2
 000E           L2:
 000E                   .dbline 0 ; func end
 000E 0895              ret
 0010                   .dbend
 0010                   .dbfunc e RTEEPROMwrite _RTEEPROMwrite fV
 0010           ;      savedSREG -> R20
 0010           ;       databyte -> R20
 0010           ;       location -> R22,R23
                        .even
 0010           _RTEEPROMwrite::
 0010 0E940000          xcall push_gset2
 0014 422F              mov R20,R18
 0016 B801              movw R22,R16
 0018                   .dbline -1
 0018                   .dbline 15
 0018           ; }
 0018           ; 
 0018           ; 
 0018           ; 
 0018           ; // function to initiate an EEPROM write
 0018           ; // writes the specified data byte to the specified location
 0018           ; // this will fail if the EEPROM is not ready!
 0018           ; void RTEEPROMwrite(int location, unsigned char databyte)
 0018           ; {
 0018                   .dbline 17
 0018           ;       unsigned char savedSREG;
 0018           ;       EEAR = location;                                                                // set address
 0018 7FBB              out 0x1f,R23
 001A 6EBB              out 0x1e,R22
 001C                   .dbline 18
 001C           ;       EEDR = databyte;                                                                // set data     
 001C 4DBB              out 0x1d,R20
 001E                   .dbline 19
 001E           ;       savedSREG = SREG;                                                               // keep setting so it can be restored
 001E 4FB7              in R20,0x3f
 0020                   .dbline 20
 0020           ;       CLI();                                                                                                  // disable interrupts
 0020 F894              cli
 0022                   .dbline 21
 0022           ;       EECR |= BIT(EEMWE);                                                     // set "write enable" bit
 0022 E29A              sbi 0x1c,2
 0024                   .dbline 22
 0024           ;       EECR |= BIT(EEWE);                                                      // set "write" bit
 0024 E19A              sbi 0x1c,1
 0026                   .dbline 23
 0026           ;       SREG = savedSREG;                                                               // restore SREG
 0026 4FBF              out 0x3f,R20
 0028                   .dbline 24
 0028           ;       EEAR = 0;
 0028 2224              clr R2
 002A 3324              clr R3
 002C 3FBA              out 0x1f,R3
 002E 2EBA              out 0x1e,R2
 0030           L6:
 0030                   .dbline 25
 0030           L7:
 0030                   .dbline 25
 0030           ;       while(!RTEEPROMReady());
 0030 E7DF              xcall _RTEEPROMReady
 0032 0023              tst R16
 0034 E9F3              breq L6
 0036                   .dbline -2
 0036           L5:
 0036 0E940000          xcall pop_gset2
 003A                   .dbline 0 ; func end
 003A 0895              ret
 003C                   .dbsym r savedSREG 20 c
 003C                   .dbsym r databyte 20 c
 003C                   .dbsym r location 22 I
 003C                   .dbend
 003C                   .dbfunc e RTEEPROMread _RTEEPROMread fc
 003C           ;       location -> R16,R17
                        .even
 003C           _RTEEPROMread::
 003C                   .dbline -1
 003C                   .dbline 34
 003C           ; }
 003C           ; 
 003C           ; 
 003C           ; 
 003C           ; // function to read from the EEPROM
 003C           ; // reads a byte from the specified location
 003C           ; // this will fail if the EEPROM is not ready!
 003C           ; unsigned char RTEEPROMread(int location)
 003C           ; {
 003C                   .dbline 35
 003C           ;       EEAR = location;                                                                // set address
 003C 1FBB              out 0x1f,R17
 003E 0EBB              out 0x1e,R16
 0040                   .dbline 36
 0040           ;       EECR |= BIT(EERE);                                                      // set "read enable" bit
 0040 E09A              sbi 0x1c,0
 0042                   .dbline 37
 0042           ;       EEAR = 0;
 0042 2224              clr R2
 0044 3324              clr R3
 0046 3FBA              out 0x1f,R3
 0048 2EBA              out 0x1e,R2
 004A                   .dbline 38
 004A           ;       return (EEDR);
 004A 0DB3              in R16,0x1d
 004C                   .dbline -2
 004C           L9:
 004C                   .dbline 0 ; func end
 004C 0895              ret
 004E                   .dbsym r location 16 I
 004E                   .dbend

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -