rw_eeprom.s
来自「详细介绍M8两版间通讯」· S 代码 · 共 74 行
S
74 行
.module RW_eeprom.c
.area text(rom, con, rel)
.dbfile G:\Mega8程序\测试MegaOSCCAL\RW_eeprom.c
.dbfunc e rom_write _rom_write fV
; Data -> R18
; Address -> R16,R17
.even
_rom_write::
.dbline -1
.dbline 3
; #include <iom8v.h>
; void rom_write(unsigned int Address,unsigned char Data)
; {
L2:
.dbline 4
L3:
.dbline 4
; while(EECR&(1<<EEWE));
sbic 0x1c,1
rjmp L2
.dbline 5
; EEAR=Address;
out 0x1f,R17
out 0x1e,R16
.dbline 6
; EEDR=Data;
out 0x1d,R18
.dbline 7
; EECR|=(1<<EEMWE);
sbi 0x1c,2
.dbline 8
; EECR|=(1<<EEWE);
sbi 0x1c,1
.dbline -2
L1:
.dbline 0 ; func end
ret
.dbsym r Data 18 c
.dbsym r Address 16 i
.dbend
.dbfunc e rom_read _rom_read fi
; Address -> R16,R17
.even
_rom_read::
.dbline -1
.dbline 11
; }
; unsigned rom_read(unsigned int Address)
; {
L6:
.dbline 12
L7:
.dbline 12
; while(EECR&(1<<EEWE));
sbic 0x1c,1
rjmp L6
.dbline 13
; EEAR=Address;
out 0x1f,R17
out 0x1e,R16
.dbline 14
; EECR|=(1<<EERE);
sbi 0x1c,0
.dbline 15
; return EEDR;
in R16,0x1d
clr R17
.dbline -2
L5:
.dbline 0 ; func end
ret
.dbsym r Address 16 i
.dbend
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?