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

📄 24cxxmain.s

📁 EEPROM读写程序: 先向EEPROM写入一幅图片数据
💻 S
📖 第 1 页 / 共 2 页
字号:
	.byte 0,0
	.byte 192,0
	.byte 0,0
	.byte 0,0
	.byte 0,8
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 0,12
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 0,12
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.dbfile E:\学习专区\AVR专区\个人创作区\AVR单片机开发平台\EEPROM读写演示程序\24CxxMain.c
	.dbsym e pic _pic A[1024:64:16]kc
	.area text(rom, con, rel)
	.dbfile E:\学习专区\AVR专区\个人创作区\AVR单片机开发平台\EEPROM读写演示程序\24CxxMain.c
	.dbfunc e main _main fV
;              y -> R14,R15
;              x -> R22,R23
;              w -> R20,R21
;              n -> y+18
;          w_buf -> y+2
;              i -> R10,R11
;              j -> R12,R13
	.even
_main::
	sbiw R28,20
	.dbline -1
	.dbline 84
; /****************************************************************
;        实验名称:EEPROM读写演示程序
; 	       作者: 王晓波
; 		   晶振:内部   8M
; 	   接线方法:
; 	        1.PC0,PC1分别接EEPROM的SCL,SDA
; 			2.PA0-PA4分别接128*64显示屏的CS,SID,CLK,PSB,BJ.
; 	  使用说明:
; 	        先向EEPROM写入一幅图片数据,然后从EEPROM中读取,并
; 			在128*64显示屏显示出来。
; *****************************************************************/
; #include<iom16v.h>
; #include<macros.h>
; #define uchar unsigned char 
; #define uint unsigned int
; const uchar pic[64][16]={
;        //128*64图片
; 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
; 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
; 0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xE0,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
; 0x00,0x00,0x00,0x00,0x00,0x00,0x0E,0x00,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
; 0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,
; 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,
; 0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,
; 0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x79,0xC0,0x18,0x00,0x00,0x00,0x00,0x00,0x00,
; 0x00,0x00,0x00,0x00,0x00,0x02,0x01,0xC0,0x38,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,
; 0x00,0x00,0x00,0x00,0x00,0x04,0x06,0x00,0x0C,0x04,0x00,0x00,0x00,0x00,0x00,0x00,
; 0x00,0x00,0x00,0x00,0x00,0x0C,0x08,0x08,0x03,0x02,0x00,0x00,0x00,0x00,0x00,0x00,
; 0x00,0x00,0x00,0x00,0x00,0x08,0x10,0x38,0x01,0x83,0x00,0x00,0x00,0x00,0x00,0x00,
; 0x00,0x00,0x00,0x00,0x00,0x18,0x20,0x78,0x00,0xC1,0x00,0x00,0x00,0x00,0x00,0x00,
; 0x00,0x00,0x00,0x00,0x00,0x10,0x40,0x78,0x00,0x41,0x80,0x00,0x00,0x00,0x00,0x00,
; 0x00,0x00,0x00,0x00,0x00,0x30,0x43,0x78,0x00,0x20,0x80,0x00,0x00,0x00,0x00,0x00,
; 0x00,0x00,0x00,0x00,0x00,0x20,0x8F,0x7B,0xE0,0x30,0x80,0x00,0x00,0x00,0x00,0x00,
; 0x00,0x00,0x00,0x00,0x00,0x20,0x9F,0x7B,0xC0,0x10,0x40,0x00,0x00,0x00,0x00,0x00,
; 0x00,0x00,0x00,0x00,0x00,0x21,0x9F,0x7B,0xDC,0x10,0x40,0x00,0x00,0x00,0x00,0x00,
; 0x00,0x00,0x00,0x00,0x00,0x61,0x1F,0x7B,0xFF,0x18,0x40,0x00,0x00,0x00,0x00,0x00,
; 0x00,0x00,0x00,0x00,0x00,0x41,0x1F,0x7B,0xDF,0x08,0x40,0x00,0x00,0x00,0x00,0x00,
; 0x00,0x00,0x00,0x00,0x00,0x41,0x1F,0x7B,0xDF,0x08,0x00,0x00,0x00,0x00,0x00,0x00,
; 0x00,0x00,0x00,0x00,0x00,0x40,0x1F,0x7B,0xDF,0x08,0x00,0x00,0x00,0x00,0x00,0x00,
; 0x00,0x00,0x00,0x00,0x00,0x40,0x1F,0x7B,0xDF,0x08,0x40,0x00,0x00,0x00,0x00,0x00,
; 0x00,0x00,0x00,0x00,0x00,0x41,0x1F,0x7B,0xDF,0x08,0x40,0x00,0x00,0x00,0x00,0x00,
; 0x00,0x00,0x00,0x00,0x00,0x61,0x1F,0x7B,0xDF,0x08,0x40,0x00,0x00,0x00,0x00,0x00,
; 0x00,0x00,0x00,0x00,0x00,0x61,0x1F,0x3F,0x9F,0x18,0x40,0x00,0x00,0x00,0x00,0x00,
; 0x00,0x00,0x00,0x00,0x00,0x20,0x9F,0x3F,0x9F,0x10,0x40,0x00,0x00,0x00,0x00,0x00,
; 0x00,0x00,0x00,0x00,0x00,0x20,0x8F,0x0F,0x1F,0x10,0xC0,0x00,0x00,0x00,0x00,0x00,
; 0x00,0x00,0x00,0x00,0x00,0x30,0xCF,0x80,0x3E,0x20,0x80,0x00,0x00,0x00,0x00,0x00,
; 0x00,0x00,0x00,0x00,0x00,0x10,0x47,0xC0,0x7E,0x20,0x80,0x00,0x00,0x00,0x00,0x00,
; 0x00,0x00,0x00,0x00,0x00,0x10,0x23,0xE0,0xFC,0x41,0x00,0x00,0x00,0x00,0x00,0x00,
; 0x00,0x00,0x00,0x00,0x00,0x18,0x30,0xFF,0xE0,0xC1,0x00,0x00,0x00,0x00,0x00,0x00,
; 0x00,0x00,0x00,0x00,0x00,0x0C,0x18,0x3F,0xC1,0x82,0x00,0x00,0x00,0x00,0x00,0x00,
; 0x00,0x00,0x00,0x00,0x00,0x04,0x0C,0x00,0x03,0x06,0x00,0x00,0x00,0x00,0x00,0x00,
; 0x00,0x00,0x00,0x00,0x00,0x02,0x03,0x00,0x0C,0x04,0x00,0x00,0x00,0x00,0x00,0x00,
; 0x00,0x00,0x00,0x00,0x00,0x01,0x00,0xE0,0x70,0x08,0x00,0x00,0x00,0x00,0x00,0x00,
; 0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x03,0xC0,0x10,0x00,0x00,0x00,0x00,0x00,0x00,
; 0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,
; 0x00,0x60,0x00,0x00,0x00,0x00,0x30,0x00,0x01,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,
; 0x00,0x20,0x00,0x00,0x00,0x00,0x1C,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
; 0x00,0x60,0x80,0x00,0x00,0x00,0x07,0x80,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
; 0x00,0x41,0xC0,0x00,0x00,0x00,0x00,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
; 0x03,0xC7,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x00,
; 0x01,0xE7,0xC0,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0xE0,0x00,0x64,0x00,0x10,0x00,
; 0x03,0xE7,0xC0,0x00,0x00,0x01,0xE0,0x00,0x00,0x03,0xE0,0x02,0x6C,0x00,0x1F,0x00,
; 0x03,0xEF,0x00,0x00,0x00,0x79,0xC0,0x00,0x00,0x07,0xFE,0x03,0x08,0x01,0x3D,0x80,
; 0x07,0xEF,0x00,0x00,0x00,0x79,0xC0,0x00,0x00,0x07,0xFE,0x01,0xF8,0x03,0xE0,0x80,
; 0x1F,0xE7,0x80,0x29,0xC0,0x31,0xB0,0x04,0x00,0x07,0xF8,0x03,0xFE,0x07,0x80,0x80,
; 0x3F,0xE5,0x80,0x3F,0xC0,0x7B,0x00,0x06,0x00,0x1F,0xF8,0x0F,0xFE,0x07,0x8E,0x80,
; 0x3F,0xE5,0x81,0xFD,0x80,0x71,0x80,0x02,0x00,0xF1,0xF0,0x0F,0x98,0x0F,0x18,0x00,
; 0x0B,0xC5,0x81,0x34,0x00,0xF0,0x80,0x02,0x00,0xC1,0xE0,0x1F,0xC0,0x1E,0x38,0x00,
; 0x03,0xC4,0x80,0x20,0x00,0x71,0xC0,0x00,0x00,0x01,0x80,0x0A,0x80,0x0F,0x7C,0x00,
; 0x03,0xC4,0x00,0x21,0x00,0x79,0xC0,0x07,0xC0,0x01,0xC0,0x00,0x80,0x0B,0x78,0x00,
; 0x03,0xC4,0x00,0x01,0x00,0x71,0xC0,0x7F,0xC0,0x00,0xC0,0x00,0xC0,0x09,0x38,0x00,
; 0x03,0xC4,0x00,0x01,0x00,0xF9,0xC0,0x78,0x00,0x01,0xC0,0x00,0x60,0x08,0x60,0xC0,
; 0x07,0xC4,0x00,0x03,0x01,0xA0,0xC0,0x00,0x00,0x03,0xF0,0x01,0xF8,0x0C,0x40,0x60,
; 0x1F,0xC4,0x00,0x02,0x01,0x00,0x00,0x00,0x00,0x03,0xF0,0x03,0xE0,0x06,0x0D,0xE0,
; 0x1B,0x44,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x03,0xC0,0x03,0xE0,0x06,0x07,0x80,
; 0x00,0x0C,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x03,0xC0,0x03,0xC0,0x00,0x00,0x00,
; 0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,
; 0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
; 0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
; 0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
; 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
; } ;  
; void main()
; {
	.dbline 85
;  	 uint n=0;
	clr R0
	clr R1
	std y+19,R1
	std y+18,R0
	.dbline 91
; 	 uchar w_buf[16];
; 	 uint i,j;
; 	 uchar *w;
; 	 uint x;
; 	 uint y;
; 	 w=w_buf;
	movw R20,R28
	subi R20,254  ; offset = 2
	sbci R21,255
	.dbline 92
; 	 port_init();
	xcall _port_init
	.dbline 93
; 	 twi_init();  //twi初始化
	xcall _twi_init
	.dbline 94
; 	 LCMInit();
	xcall _LCMInit
	.dbline 95
; 	 LCMDelay(100) ;
	ldi R16,100
	ldi R17,0
	xcall _LCMDelay
	.dbline 96
; 	 LCMDisplayString(2,1,"EEPROM读写操作");
	ldi R24,<L2
	ldi R25,>L2
	std y+1,R25
	std y+0,R24
	ldi R18,1
	ldi R19,0
	ldi R16,2
	ldi R17,0
	xcall _LCMDisplayString
	.dbline 97
; 	 LCMDisplayString(3,2,"演示程序");
	ldi R24,<L3
	ldi R25,>L3
	std y+1,R25
	std y+0,R24
	ldi R18,2
	ldi R19,0
	ldi R16,3
	ldi R17,0
	xcall _LCMDisplayString
	.dbline 99
; 	 //先向EEPROM写入数据
; 	 for (i=0;i<64;i++)
	clr R10
	clr R11
	xjmp L7
L4:
	.dbline 100
; 	 {
	.dbline 101
;  	  	 for (j=0;j<16;j++)
	clr R12
	clr R13
	xjmp L11
L8:
	.dbline 102
	ldi R16,16
	ldi R17,0
	movw R18,R10
	xcall empy16s
	movw R2,R16
	ldi R24,<_pic
	ldi R25,>_pic
	add R2,R24
	adc R3,R25
	movw R30,R12
	add R30,R2
	adc R31,R3
	lpm R30,Z
	movw R24,R28
	adiw R24,2
	movw R26,R12
	add R26,R24
	adc R27,R25
	st x,R30
L9:
	.dbline 101
	movw R24,R12
	adiw R24,1
	movw R12,R24
L11:
	.dbline 101
	movw R24,R12
	cpi R24,16
	ldi R30,0
	cpc R25,R30
	brlo L8
	.dbline 103
	movw R20,R28
	subi R20,254  ; offset = 2
	sbci R21,255
	.dbline 104
	ldi R16,16
	ldi R17,0
	movw R18,R10
	xcall empy16s
	movw R22,R16
	.dbline 105
	ldi R24,16
	ldi R25,0
	movw R14,R24
	.dbline 106
	std y+1,R15
	std y+0,R14
	movw R18,R22
	movw R16,R20
	xcall _wt24c
	.dbline 107
	ldi R16,50
	ldi R17,0
	xcall _LCMDelay
	.dbline 108
	ldd R24,y+18
	ldd R25,y+19
	adiw R24,1
	std y+19,R25
	std y+18,R24
	.dbline 109
	ldi R24,<L12
	ldi R25,>L12
	std y+1,R25
	std y+0,R24
	ldi R18,3
	ldi R19,0
	ldi R16,2
	ldi R17,0
	xcall _LCMDisplayString
	.dbline 110
	ldi R24,<L13
	ldi R25,>L13
	std y+1,R25
	std y+0,R24
	ldi R18,4
	ldi R19,0
	ldi R16,2
	ldi R17,0
	xcall _LCMDisplayString
	.dbline 111
	ldi R16,100
	ldi R17,0
	ldd R18,y+18
	ldd R19,y+19
	xcall empy16s
	ldi R18,6
	ldi R19,0
	xcall lsr16
	std y+1,R17
	std y+0,R16
	ldi R18,4
	ldi R19,0
	ldi R16,6
	ldi R17,0
	xcall _LCMDisplayNummber
	.dbline 112
L5:
	.dbline 99
	movw R24,R10
	adiw R24,1
	movw R10,R24
L7:
	.dbline 99
	movw R24,R10
	cpi R24,64
	ldi R30,0
	cpc R25,R30
	brsh X0
	xjmp L4
X0:
	.dbline 113
; 		 w_buf[j]=pic[i][j];
; 		 w=w_buf;
; 		 x=i*16;
; 		 y=16;
; 		 wt24c(w,x,y);	
;  		 LCMDelay(50);
; 		 n++;
;   		LCMDisplayString(2,3,"正在写入数据:");
;   		LCMDisplayString(2,4,"已完成     %");
;   		LCMDisplayNummber(6,4,n*100/64);
;       }
;  	LCMDelay(500) ;
	ldi R16,500
	ldi R17,1
	xcall _LCMDelay
	.dbline 114
; 	LCMInit();
	xcall _LCMInit
	.dbline 115
; 	LCMDelay(100) ;
	ldi R16,100
	ldi R17,0
	xcall _LCMDelay
	.dbline 116
; 	LCMDisplayString(2,2,"正在读取数据:");
	ldi R24,<L14
	ldi R25,>L14
	std y+1,R25
	std y+0,R24
	ldi R18,2
	ldi R19,0
	ldi R16,2
	ldi R17,0
	xcall _LCMDisplayString
	.dbline 117
; 	LCMDisplayString(4,4,">");
	ldi R24,<L15
	ldi R25,>L15
	std y+1,R25
	std y+0,R24
	ldi R18,4
	ldi R19,0
	ldi R16,4
	ldi R17,0
	xcall _LCMDisplayString
	.dbline 118
; 	LCMDelay(500) ;
	ldi R16,500
	ldi R17,1
	xcall _LCMDelay
	.dbline 119
; 	LCMDisplayString(4,4,"> >");
	ldi R24,<L16
	ldi R25,>L16
	std y+1,R25
	std y+0,R24
	ldi R18,4
	ldi R19,0
	ldi R16,4
	ldi R17,0
	xcall _LCMDisplayString
	.dbline 120
; 	LCMDelay(500) ;
	ldi R16,500
	ldi R17,1
	xcall _LCMDelay
	.dbline 121
; 	LCMDisplayString(4,4,"> > >");
	ldi R24,<L17
	ldi R25,>L17
	std y+1,R25
	std y+0,R24
	ldi R18,4
	ldi R19,0
	ldi R16,4
	ldi R17,0
	xcall _LCMDisplayString
	.dbline 122
; 	LCMDelay(500) ;
	ldi R16,500
	ldi R17,1
	xcall _LCMDelay
	.dbline 124
; 	//从EEPROM中读取数据,在128*64液晶屏上显示。
; 	LCMInit();
	xcall _LCMInit
	.dbline 125
; 	LCMDelay(100) ;
	ldi R16,100
	ldi R17,0
	xcall _LCMDelay
	.dbline 126
; 	LCMDisplayPicture(0);
	clr R16
	clr R17
	xcall _LCMDisplayPicture
	.dbline -2
L1:
	adiw R28,20
	.dbline 0 ; func end
	ret
	.dbsym r y 14 i
	.dbsym r x 22 i
	.dbsym r w 20 pc
	.dbsym l n 18 i
	.dbsym l w_buf 2 A[16:16]c
	.dbsym r i 10 i
	.dbsym r j 12 i
	.dbend
	.area data(ram, con, rel)
	.dbfile E:\学习专区\AVR专区\个人创作区\AVR单片机开发平台\EEPROM读写演示程序\24CxxMain.c
L17:
	.blkb 6
	.area idata
	.byte 62,32,62,32,62,0
	.area data(ram, con, rel)
	.dbfile E:\学习专区\AVR专区\个人创作区\AVR单片机开发平台\EEPROM读写演示程序\24CxxMain.c
L16:
	.blkb 4
	.area idata
	.byte 62,32,62,0
	.area data(ram, con, rel)
	.dbfile E:\学习专区\AVR专区\个人创作区\AVR单片机开发平台\EEPROM读写演示程序\24CxxMain.c
L15:
	.blkb 2
	.area idata
	.byte 62,0
	.area data(ram, con, rel)
	.dbfile E:\学习专区\AVR专区\个人创作区\AVR单片机开发平台\EEPROM读写演示程序\24CxxMain.c
L14:
	.blkb 14
	.area idata
	.byte 213,253,212,218,182,193,200,161,202,253,190,221,58,0
	.area data(ram, con, rel)
	.dbfile E:\学习专区\AVR专区\个人创作区\AVR单片机开发平台\EEPROM读写演示程序\24CxxMain.c
L13:
	.blkb 13
	.area idata
	.byte 210,209,205,234,179,201,32,32,32,32,32,37,0
	.area data(ram, con, rel)
	.dbfile E:\学习专区\AVR专区\个人创作区\AVR单片机开发平台\EEPROM读写演示程序\24CxxMain.c
L12:
	.blkb 14
	.area idata
	.byte 213,253,212,218,208,180,200,235,202,253,190,221,58,0
	.area data(ram, con, rel)
	.dbfile E:\学习专区\AVR专区\个人创作区\AVR单片机开发平台\EEPROM读写演示程序\24CxxMain.c
L3:
	.blkb 9
	.area idata
	.byte 209,221,202,190,179,204,208,242,0
	.area data(ram, con, rel)
	.dbfile E:\学习专区\AVR专区\个人创作区\AVR单片机开发平台\EEPROM读写演示程序\24CxxMain.c
L2:
	.blkb 15
	.area idata
	.byte 'E,'E,'P,'R,'O,'M,182,193,208,180,178,217,215,247,0
	.area data(ram, con, rel)
	.dbfile E:\学习专区\AVR专区\个人创作区\AVR单片机开发平台\EEPROM读写演示程序\24CxxMain.c

⌨️ 快捷键说明

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