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

📄 main.lst

📁 我学习AVR的代码例子
💻 LST
📖 第 1 页 / 共 5 页
字号:
 349 0074 0F91      		pop r16
 350 0076 0895      		ret
 351               	/* epilogue end (size=4) */
 352               	/* function SendBit size 31 (24) */
 357               	.Lscope3:
 359               	.global	Start_spi
 361               	Start_spi:
 131:main.c        ****  }
 132:main.c        **** 
 133:main.c        **** void Start_spi(void)
 134:main.c        ****  {
 363               	.LM34:
 364               	/* prologue: frame size=0 */
 365               	/* prologue end (size=0) */
 135:main.c        ****    PORTB |=(1<<SS);
 367               	.LM35:
 368 0078 C49A      		sbi 56-0x20,4
 136:main.c        ****    PORTB |=(1<<SCK);
 370               	.LM36:
 371 007a C79A      		sbi 56-0x20,7
 137:main.c        ****    PORTB |=(1<<MOSI);
 373               	.LM37:
 374 007c C59A      		sbi 56-0x20,5
 138:main.c        ****    Delay();
 376               	.LM38:
 377 007e 0E94 0000 		call Delay
 139:main.c        ****    PORTB &=(~(1<<SS));PORTB &=(~(1<<SS));
 379               	.LM39:
 380 0082 C498      		cbi 56-0x20,4
 381 0084 C498      		cbi 56-0x20,4
 140:main.c        ****    PORTB &=(~(1<<SCK));PORTB &=(~(1<<SCK));
 383               	.LM40:
 384 0086 9FE7      		ldi r25,lo8(127)
 385 0088 88B3      		in r24,56-0x20
 386 008a 8923      		and r24,r25
 387 008c 88BB      		out 56-0x20,r24
 388 008e 88B3      		in r24,56-0x20
 389 0090 8923      		and r24,r25
 390 0092 88BB      		out 56-0x20,r24
 391               	/* epilogue: frame size=0 */
 392 0094 0895      		ret
 393               	/* epilogue end (size=1) */
 394               	/* function Start_spi size 15 (14) */
 396               	.Lscope4:
 399               	.global	SendByte
 401               	SendByte:
 141:main.c        ****  }
 142:main.c        **** 
 143:main.c        **** void SendByte(unsigned char dat)
 144:main.c        ****  {
 403               	.LM41:
 404               	/* prologue: frame size=0 */
 405               	/* prologue end (size=0) */
 145:main.c        ****    SendBit(dat,8); /*发送字节*/
 407               	.LM42:
 408 0096 68E0      		ldi r22,lo8(8)
 409 0098 0E94 0000 		call SendBit
 410               	/* epilogue: frame size=0 */
 411 009c 0895      		ret
 412               	/* epilogue end (size=1) */
 413               	/* function SendByte size 4 (3) */
 415               	.Lscope5:
 418               	.global	SENDCOMA
 420               	SENDCOMA:
 146:main.c        ****  }
 147:main.c        **** 
 148:main.c        **** void SENDCOMA(unsigned char com)
 149:main.c        ****  {
 422               	.LM43:
 423               	/* prologue: frame size=0 */
 424 009e 1F93      		push r17
 425               	/* prologue end (size=1) */
 426 00a0 182F      		mov r17,r24
 150:main.c        ****    Start_spi();
 428               	.LM44:
 429 00a2 0E94 0000 		call Start_spi
 151:main.c        ****    SendBit(0X80,4); //*发送设置命令ID=100 0*
 431               	.LM45:
 432 00a6 64E0      		ldi r22,lo8(4)
 433 00a8 80E8      		ldi r24,lo8(-128)
 434 00aa 0E94 0000 		call SendBit
 152:main.c        ****    SendByte(com); //*发送命令字*
 436               	.LM46:
 437 00ae 812F      		mov r24,r17
 438 00b0 0E94 0000 		call SendByte
 439               	/* epilogue: frame size=0 */
 440 00b4 1F91      		pop r17
 441 00b6 0895      		ret
 442               	/* epilogue end (size=2) */
 443               	/* function SENDCOMA size 13 (10) */
 445               	.Lscope6:
 448               	.global	SENDCOMB
 450               	SENDCOMB:
 153:main.c        ****  }
 154:main.c        **** 
 155:main.c        **** void SENDCOMB(unsigned char adr)
 156:main.c        ****  {
 452               	.LM47:
 453               	/* prologue: frame size=0 */
 454 00b8 1F93      		push r17
 455               	/* prologue end (size=1) */
 456 00ba 182F      		mov r17,r24
 157:main.c        ****    Start_spi();
 458               	.LM48:
 459 00bc 0E94 0000 		call Start_spi
 158:main.c        ****    SendBit(0XA0,3); /*发送写显示RAM 命令ID=101 */
 461               	.LM49:
 462 00c0 63E0      		ldi r22,lo8(3)
 463 00c2 80EA      		ldi r24,lo8(-96)
 464 00c4 0E94 0000 		call SendBit
 159:main.c        ****    SendBit(adr,6); /*指定写入地址*/
 466               	.LM50:
 467 00c8 66E0      		ldi r22,lo8(6)
 468 00ca 812F      		mov r24,r17
 469 00cc 0E94 0000 		call SendBit
 470               	/* epilogue: frame size=0 */
 471 00d0 1F91      		pop r17
 472 00d2 0895      		ret
 473               	/* epilogue end (size=2) */
 474               	/* function SENDCOMB size 14 (11) */
 476               	.Lscope7:
 478               	.global	disp_init
 480               	disp_init:
 160:main.c        ****  } 
 161:main.c        **** void disp_init(void)
 162:main.c        ****  {
 482               	.LM51:
 483               	/* prologue: frame size=1 */
 484 00d4 CF93      		push r28
 485 00d6 DF93      		push r29
 486 00d8 CDB7      		in r28,__SP_L__
 487 00da DEB7      		in r29,__SP_H__
 488 00dc 2197      		sbiw r28,1
 489 00de 0FB6      		in __tmp_reg__,__SREG__
 490 00e0 F894      		cli
 491 00e2 DEBF      		out __SP_H__,r29
 492 00e4 0FBE      		out __SREG__,__tmp_reg__
 493 00e6 CDBF      		out __SP_L__,r28
 494               	/* prologue end (size=10) */
 163:main.c        ****    volatile unsigned char i;
 164:main.c        ****    SENDCOMA(0X0a); /*禁止WDT溢出标志输出*/
 496               	.LM52:
 497 00e8 8AE0      		ldi r24,lo8(10)
 498 00ea 0E94 0000 		call SENDCOMA
 165:main.c        ****    SENDCOMA(0X52); //设置偏压,背极数 定义1/3 偏压4背极
 500               	.LM53:
 501 00ee 82E5      		ldi r24,lo8(82)
 502 00f0 0E94 0000 		call SENDCOMA
 166:main.c        ****    SENDCOMA(0X30); //*使用内部256KRC 振荡器*
 504               	.LM54:
 505 00f4 80E3      		ldi r24,lo8(48)
 506 00f6 0E94 0000 		call SENDCOMA
 167:main.c        ****    SENDCOMA(0X02); //*启动振荡器*    
 508               	.LM55:
 509 00fa 82E0      		ldi r24,lo8(2)
 510 00fc 0E94 0000 		call SENDCOMA
 168:main.c        ****    SENDCOMA(0X06); //LCDON
 512               	.LM56:
 513 0100 86E0      		ldi r24,lo8(6)
 514 0102 0E94 0000 		call SENDCOMA
 169:main.c        ****    SENDCOMA(0X08);//timer dis
 516               	.LM57:
 517 0106 88E0      		ldi r24,lo8(8)
 518 0108 0E94 0000 		call SENDCOMA
 170:main.c        ****    SENDCOMB(0x00); //*把数据指针指回0 接着写入数据*   
 520               	.LM58:
 521 010c 80E0      		ldi r24,lo8(0)
 522 010e 0E94 0000 		call SENDCOMB
 171:main.c        ****    for(i=0;i<15;i++) /*写入16 字节数据*/
 524               	.LM59:
 525 0112 1982      		std Y+1,__zero_reg__
 526 0114 8981      		ldd r24,Y+1
 527 0116 8F30      		cpi r24,lo8(15)
 528 0118 48F4      		brsh .L29
 529               	.L27:
 172:main.c        ****      {
 173:main.c        ****        SendByte(0x0); /*写入数据*/
 531               	.LM60:
 532 011a 80E0      		ldi r24,lo8(0)
 533 011c 0E94 0000 		call SendByte
 535               	.LM61:
 536 0120 8981      		ldd r24,Y+1
 537 0122 8F5F      		subi r24,lo8(-(1))
 538 0124 8983      		std Y+1,r24
 539 0126 8981      		ldd r24,Y+1
 540 0128 8F30      		cpi r24,lo8(15)
 541 012a B8F3      		brlo .L27
 542               	.L29:
 543               	/* epilogue: frame size=1 */
 544 012c 2196      		adiw r28,1
 545 012e 0FB6      		in __tmp_reg__,__SREG__
 546 0130 F894      		cli
 547 0132 DEBF      		out __SP_H__,r29
 548 0134 0FBE      		out __SREG__,__tmp_reg__
 549 0136 CDBF      		out __SP_L__,r28
 550 0138 DF91      		pop r29
 551 013a CF91      		pop r28
 552 013c 0895      		ret
 553               	/* epilogue end (size=9) */
 554               	/* function disp_init size 53 (34) */
 559               	.Lscope8:
 561               	.global	disp_off
 563               	disp_off:
 174:main.c        ****      }
 175:main.c        ****  }
 176:main.c        **** void disp_off(void)
 177:main.c        ****   {
 565               	.LM62:
 566               	/* prologue: frame size=0 */
 567               	/* prologue end (size=0) */
 178:main.c        ****     SENDCOMA(0X04);//lcdoff
 569               	.LM63:
 570 013e 84E0      		ldi r24,lo8(4)
 571 0140 0E94 0000 		call SENDCOMA
 179:main.c        ****     SENDCOMA(0X00);//sys dis
 573               	.LM64:
 574 0144 80E0      		ldi r24,lo8(0)
 575 0146 0E94 0000 		call SENDCOMA
 576               	/* epilogue: frame size=0 */
 577 014a 0895      		ret
 578               	/* epilogue end (size=1) */
 579               	/* function disp_off size 7 (6) */
 581               	.Lscope9:
 583               	.global	adc_init
 585               	adc_init:
 180:main.c        ****     //SENDCOMA(0X0c);//timer en
 181:main.c        ****   }
 182:main.c        **** void adc_init(void)             //ADC初始化
 183:main.c        ****  {
 587               	.LM65:
 588               	/* prologue: frame size=0 */
 589               	/* prologue end (size=0) */
 184:main.c        ****    ADCSRA=0X00;
 591               	.LM66:
 592 014c 16B8      		out 38-0x20,__zero_reg__
 185:main.c        ****    ADMUX=(1<<REFS0);       //选择外部AVCC为基准
 594               	.LM67:
 595 014e 80E4      		ldi r24,lo8(64)
 596 0150 87B9      		out 39-0x20,r24
 186:main.c        ****    ACSR=(1<<ACD);          //关闭模拟比较器
 598               	.LM68:
 599 0152 80E8      		ldi r24,lo8(-128)
 600 0154 88B9      		out 40-0x20,r24
 187:main.c        ****    ADCSRA=(1<<ADEN) | (1<<ADIE) | (1<<ADPS2) | (1<<ADPS0);//32分频
 602               	.LM69:
 603 0156 8DE8      		ldi r24,lo8(-115)
 604 0158 86B9      		out 38-0x20,r24
 605               	/* epilogue: frame size=0 */
 606 015a 0895      		ret
 607               	/* epilogue end (size=1) */
 608               	/* function adc_init size 8 (7) */
 610               	.Lscope10:
 612               	.global	WDT_init
 614               	WDT_init:
 188:main.c        ****  }
 189:main.c        **** void WDT_init(void)
 190:main.c        ****  {
 616               	.LM70:
 617               	/* prologue: frame size=0 */
 618               	/* prologue end (size=0) */
 191:main.c        ****    WDR();
 620               	.LM71:
 621               	/* #APP */
 622 015c A895      		wdr
 192:main.c        ****    WDTCR=0x0e;
 624               	.LM72:
 625               	/* #NOAPP */
 626 015e 8EE0      		ldi r24,lo8(14)
 627 0160 81BD      		out 65-0x20,r24
 628               	/* epilogue: frame size=0 */
 629 0162 0895      		ret
 630               	/* epilogue end (size=1) */
 631               	/* function WDT_init size 5 (4) */
 633               	.Lscope11:
 635               	.global	WDT_off
 637               	WDT_off:
 193:main.c        ****  }/**/
 194:main.c        **** void WDT_off(void)
 195:main.c        ****  {
 639               	.LM73:
 640               	/* prologue: frame size=0 */
 641               	/* prologue end (size=0) */
 196:main.c        ****    WDTCR = (1<<WDTOE) | (1<<WDE);
 643               	.LM74:
 644 0164 88E1      		ldi r24,lo8(24)
 645 0166 81BD      		out 65-0x20,r24
 197:main.c        ****    WDTCR = 0x00;
 647               	.LM75:
 648 0168 11BC      		out 65-0x20,__zero_reg__
 649               	/* epilogue: frame size=0 */
 650 016a 0895      		ret
 651               	/* epilogue end (size=1) */
 652               	/* function WDT_off size 4 (3) */
 654               	.Lscope12:
 656               	.global	I2C_init
 658               	I2C_init:
 198:main.c        ****  }
 199:main.c        **** void I2C_init(void)
 200:main.c        ****  {
 660               	.LM76:
 661               	/* prologue: frame size=0 */
 662               	/* prologue end (size=0) */
 201:main.c        ****    TWBR=2;
 664               	.LM77:
 665 016c 82E0      		ldi r24,lo8(2)
 666 016e 80B9      		out 32-0x20,r24
 202:main.c        ****    TWSR=00;
 668               	.LM78:
 669 0170 11B8      		out 33-0x20,__zero_reg__
 670               	/* epilogue: frame size=0 */
 671 0172 0895      		ret
 672               	/* epilogue end (size=1) */
 673               	/* function I2C_init size 4 (3) */
 675               	.Lscope13:
 678               	.global	delay_us
 680               	delay_us:
 203:main.c        ****  }
 204:main.c        **** void delay_us(int time)//微秒级延时程序
 205:main.c        ****  {     
 682               	.LM79:
 683               	/* prologue: frame size=0 */
 684               	/* prologue end (size=0) */
 685               	.L36:
 206:main.c        ****    do
 207:main.c        **** 	 {
 208:main.c        **** 	   time--;
 687               	.LM80:
 688 0174 0197      		sbiw r24,1
 209:main.c        **** 	 }	
 690               	.LM81:
 691 0176 8230      		cpi r24,2
 692 0178 9105      		cpc r25,__zero_reg__
 693 017a E4F7      		brge .L36
 694               	/* epilogue: frame size=0 */
 695 017c 0895      		ret
 696               	/* epilogue end (size=1) */
 697               	/* function delay_us size 5 (4) */
 699               	.Lscope14:
 702               	.global	delay_ms

⌨️ 快捷键说明

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