单片机开发资料光盘-双龙-686M.zip
源代码在线查看: readwriteeeprom.s
.module ReadWriteEEPROM.c
.area text
.dbfile E:\grc\licc\例子10.3.3\ReadWriteEEPROM.c
.dbfunc s main _main fI
; temp -> R20
; i -> R20
.even
_main::
.dbline 7{
; // These work for devices with more than 256 bytes of EEPROM
; //int EEPROMwrite( int location, unsigned char);
; //unsigned char EEPROMread( int);
; #include
; #include
; void main(void)
; {
.dbline 8
; unsigned char temp =0xaa,i;
ldi R20,170
.dbline 9
; EEPROMwrite(0x20,temp); /* 写E2PROM 地址0x20 */
mov R18,R20
ldi R16,32
ldi R17,0
rcall _EEPROMwrite
.dbline 10
; i=EEPROMread(0x20); /* 读E2PROM 地址 0x20 */
ldi R16,32
ldi R17,0
rcall _EEPROMread
mov R20,R16
.dbline 11
; i++;
inc R20
.dbline 12
; EEPROMwrite(0x30,i);
mov R18,R20
ldi R16,48
ldi R17,0
rcall _EEPROMwrite
.dbline 13}
; }
L1:
ret
.dbsym r temp 20 c
.dbsym r i 20 c