📄 main.lst
字号:
123:main.c **** {
340 .LM30:
341 /* prologue: frame size=0 */
342 /* prologue end (size=0) */
124:main.c **** PORTB |=(1<<SS);
344 .LM31:
345 00a4 C49A sbi 56-0x20,4
125:main.c **** PORTB |=(1<<SCK);
347 .LM32:
348 00a6 C79A sbi 56-0x20,7
126:main.c **** PORTB |=(1<<MOSI);
350 .LM33:
351 00a8 C59A sbi 56-0x20,5
127:main.c **** Delay();
353 .LM34:
354 00aa 0E94 0000 call Delay
128:main.c **** //delay_us(10);
129:main.c **** PORTB &=(~(1<<SS));PORTB &=(~(1<<SS));
356 .LM35:
357 00ae C498 cbi 56-0x20,4
358 00b0 C498 cbi 56-0x20,4
130:main.c **** PORTB &=(~(1<<SCK));PORTB &=(~(1<<SCK));
360 .LM36:
361 00b2 8FE7 ldi r24,lo8(127)
362 00b4 98B3 in r25,56-0x20
363 00b6 9823 and r25,r24
364 00b8 98BB out 56-0x20,r25
365 00ba 98B3 in r25,56-0x20
366 00bc 9823 and r25,r24
367 00be 98BB out 56-0x20,r25
368 /* epilogue: frame size=0 */
369 00c0 0895 ret
370 /* epilogue end (size=1) */
371 /* function Start_spi size 15 (14) */
373 .Lscope5:
376 .global SendByte
378 SendByte:
131:main.c **** }
132:main.c ****
133:main.c **** void SendByte(unsigned char dat)
134:main.c **** {
380 .LM37:
381 /* prologue: frame size=0 */
382 /* prologue end (size=0) */
135:main.c **** SendBit(dat,8); /*发送字节*/
384 .LM38:
385 00c2 68E0 ldi r22,lo8(8)
386 00c4 0E94 0000 call SendBit
387 /* epilogue: frame size=0 */
388 00c8 0895 ret
389 /* epilogue end (size=1) */
390 /* function SendByte size 4 (3) */
392 .Lscope6:
395 .global SENDCOMA
397 SENDCOMA:
136:main.c **** }
137:main.c ****
138:main.c **** void SENDCOMA(unsigned char com)
139:main.c **** {
399 .LM39:
400 /* prologue: frame size=0 */
401 00ca 1F93 push r17
402 /* prologue end (size=1) */
403 00cc 182F mov r17,r24
140:main.c **** Start_spi();
405 .LM40:
406 00ce 0E94 0000 call Start_spi
141:main.c **** SendBit(0X80,4); //*发送设置命令ID=100 0*
408 .LM41:
409 00d2 64E0 ldi r22,lo8(4)
410 00d4 80E8 ldi r24,lo8(-128)
411 00d6 0E94 0000 call SendBit
142:main.c **** SendByte(com); //*发送命令字*
413 .LM42:
414 00da 812F mov r24,r17
415 00dc 0E94 0000 call SendByte
416 /* epilogue: frame size=0 */
417 00e0 1F91 pop r17
418 00e2 0895 ret
419 /* epilogue end (size=2) */
420 /* function SENDCOMA size 13 (10) */
422 .Lscope7:
425 .global SENDCOMB
427 SENDCOMB:
143:main.c **** }
144:main.c ****
145:main.c **** void SENDCOMB(unsigned char adr)
146:main.c **** {
429 .LM43:
430 /* prologue: frame size=0 */
431 00e4 1F93 push r17
432 /* prologue end (size=1) */
433 00e6 182F mov r17,r24
147:main.c **** Start_spi();
435 .LM44:
436 00e8 0E94 0000 call Start_spi
148:main.c **** SendBit(0XA0,3); /*发送写显示RAM 命令ID=101 */
438 .LM45:
439 00ec 63E0 ldi r22,lo8(3)
440 00ee 80EA ldi r24,lo8(-96)
441 00f0 0E94 0000 call SendBit
149:main.c **** SendBit(adr,6); /*指定写入地址*/
443 .LM46:
444 00f4 66E0 ldi r22,lo8(6)
445 00f6 812F mov r24,r17
446 00f8 0E94 0000 call SendBit
447 /* epilogue: frame size=0 */
448 00fc 1F91 pop r17
449 00fe 0895 ret
450 /* epilogue end (size=2) */
451 /* function SENDCOMB size 14 (11) */
453 .Lscope8:
455 .global disp_init
457 disp_init:
150:main.c **** }
151:main.c **** void disp_init(void)
152:main.c **** {
459 .LM47:
460 /* prologue: frame size=0 */
461 0100 CF93 push r28
462 /* prologue end (size=1) */
153:main.c **** unsigned char i;
154:main.c **** SENDCOMA(0X0a); /*禁止WDT溢出标志输出*/
464 .LM48:
465 0102 8AE0 ldi r24,lo8(10)
466 0104 0E94 0000 call SENDCOMA
155:main.c **** SENDCOMA(0X52); //设置偏压,背极数 定义1/3 偏压4背极
468 .LM49:
469 0108 82E5 ldi r24,lo8(82)
470 010a 0E94 0000 call SENDCOMA
156:main.c **** SENDCOMA(0X30); //*使用内部256KRC 振荡器*
472 .LM50:
473 010e 80E3 ldi r24,lo8(48)
474 0110 0E94 0000 call SENDCOMA
157:main.c **** SENDCOMA(0X02); //*启动振荡器*
476 .LM51:
477 0114 82E0 ldi r24,lo8(2)
478 0116 0E94 0000 call SENDCOMA
158:main.c **** SENDCOMA(0X06); //LCDON
480 .LM52:
481 011a 86E0 ldi r24,lo8(6)
482 011c 0E94 0000 call SENDCOMA
159:main.c **** SENDCOMA(0X08);//timer dis
484 .LM53:
485 0120 88E0 ldi r24,lo8(8)
486 0122 0E94 0000 call SENDCOMA
160:main.c **** SENDCOMB(0x00); //*把数据指针指回0 接着写入数据*
488 .LM54:
489 0126 80E0 ldi r24,lo8(0)
490 0128 0E94 0000 call SENDCOMB
491 012c CEE0 ldi r28,lo8(14)
492 .L36:
161:main.c **** for(i=0;i<15;i++) /*写入16 字节数据*/
162:main.c **** {
163:main.c **** SendByte(0x0); /*写入数据*/
494 .LM55:
495 012e 80E0 ldi r24,lo8(0)
496 0130 0E94 0000 call SendByte
498 .LM56:
499 0134 C150 subi r28,lo8(-(-1))
500 0136 C7FF sbrs r28,7
501 0138 FACF rjmp .L36
502 /* epilogue: frame size=0 */
503 013a CF91 pop r28
504 013c 0895 ret
505 /* epilogue end (size=2) */
506 /* function disp_init size 31 (28) */
511 .Lscope9:
513 .global disp_off
515 disp_off:
164:main.c **** }
165:main.c **** }
166:main.c **** void disp_off(void)
167:main.c **** {
517 .LM57:
518 /* prologue: frame size=0 */
519 /* prologue end (size=0) */
168:main.c **** SENDCOMA(0X04);//lcdoff
521 .LM58:
522 013e 84E0 ldi r24,lo8(4)
523 0140 0E94 0000 call SENDCOMA
169:main.c **** SENDCOMA(0X00);//sys dis
525 .LM59:
526 0144 80E0 ldi r24,lo8(0)
527 0146 0E94 0000 call SENDCOMA
528 /* epilogue: frame size=0 */
529 014a 0895 ret
530 /* epilogue end (size=1) */
531 /* function disp_off size 7 (6) */
533 .Lscope10:
535 .global I2C_init
537 I2C_init:
170:main.c **** //SENDCOMA(0X0c);//timer en
171:main.c **** }
172:main.c **** //初始化TWI功能
173:main.c **** /*
174:main.c **** void twi_Init(void)
175:main.c **** {
176:main.c **** TWBR=73;
177:main.c **** }*/
178:main.c **** void I2C_init(void)
179:main.c **** {
539 .LM60:
540 /* prologue: frame size=0 */
541 /* prologue end (size=0) */
180:main.c **** TWBR=2;
543 .LM61:
544 014c 82E0 ldi r24,lo8(2)
545 014e 80B9 out 32-0x20,r24
181:main.c **** TWSR=00;
547 .LM62:
548 0150 11B8 out 33-0x20,__zero_reg__
549 /* epilogue: frame size=0 */
550 0152 0895 ret
551 /* epilogue end (size=1) */
552 /* function I2C_init size 4 (3) */
554 .Lscope11:
558 .global i2c_Write
560 i2c_Write:
182:main.c **** }/*
183:main.c **** void delay_us(int time)//微秒级延时程序
184:main.c **** {
185:main.c **** do
186:main.c **** {
187:main.c **** time--;
188:main.c **** }
189:main.c **** while (time>1);
190:main.c **** }
191:main.c **** void delay_ms(unsigned int time)//毫秒级延时程序
192:main.c **** {
193:main.c **** while(time!=0)
194:main.c **** {
195:main.c **** delay_us(1000);
196:main.c **** time--;
197:main.c **** }
198:main.c **** }*/
199:main.c **** unsigned char i2c_Write(unsigned char Wdata,unsigned char RomAddress)
200:main.c **** {
562 .LM63:
563 /* prologue: frame size=0 */
564 /* prologue end (size=0) */
565 0154 282F mov r18,r24
201:main.c **** Start();//I2C启动
567 .LM64:
568 0156 84EA ldi r24,lo8(-92)
569 0158 86BF out 86-0x20,r24
570 .L42:
202:main.c **** Wait();
572 .LM65:
573 015a 06B6 in __tmp_reg__,86-0x20
574 015c 07FE sbrs __tmp_reg__,7
575 015e FDCF rjmp .L42
203:main.c **** if(TestAck()!=START) return 1;//ACK
577 .LM66:
578 0160 81B1 in r24,33-0x20
579 0162 9927 clr r25
580 0164 887F andi r24,lo8(248)
581 0166 9070 andi r25,hi8(248)
582 0168 0897 sbiw r24,8
583 016a 29F5 brne .L60
204:main.c **** Write8Bit(wr_device_add);//写I2C从器件地址和写方式
585 .LM67:
586 016c 80ED ldi r24,lo8(-48)
587 016e 83B9 out 35-0x20,r24
588 0170 84E8 ldi r24,lo8(-124)
589 0172 86BF out 86-0x20,r24
590 .L46:
205:main.c **** Wait();
592 .LM68:
593 0174 06B6 in __tmp_reg__,86-0x20
594 0176 07FE sbrs __tmp_reg__,7
595 0178 FDCF rjmp .L46
206:main.c **** if(TestAck()!=MT_SLA_ACK) return 1;//ACK
597 .LM69:
598 017a 81B1 in r24,33-0x20
599 017c 9927 clr r25
600 017e 887F andi r24,lo8(248)
601 0180 9070 andi r25,hi8(248)
602 0182 4897 sbiw r24,24
603 0184 C1F4 brne .L60
207:main.c **** Write8Bit(RomAddress);//写24C02的ROM地址
605 .LM70:
606 0186 63B9 out 35-0x20,r22
607 0188 84E8 ldi r24,lo8(-124)
608 018a 86BF out 86-0x20,r24
609 .L50:
208:main.c **** Wait();
611 .LM71:
612 018c 06B6 in __tmp_reg__,86-0x20
613 018e 07FE sbrs __tmp_reg__,7
614 0190 FDCF rjmp .L50
209:main.c **** if(TestAck()!=MT_DATA_ACK) return 1;//ACK
616 .LM72:
617 0192 81B1 in r24,33-0x20
618 0194 9927 clr r25
619 0196 887F andi r24,lo8(248)
620 0198 9070 andi r25,hi8(248)
621 019a 8897 sbiw r24,40
622 019c 61F4 brne .L60
210:main.c **** Write8Bit(Wdata);//写数据到24C02的ROM
624 .LM73:
625 019e 23B9 out 35-0x20,r18
626 01a0 84E8 ldi r24,lo8(-124)
627 01a2 86BF out 86-0x20,r24
628 .L54:
211:main.c **** Wait();
630 .LM74:
631 01a4 06B6 in __tmp_reg__,86-0x20
632 01a6 07FE sbrs __tmp_reg__,7
633 01a8 FDCF rjmp .L54
212:main.c **** if(TestAck()!=MT_DATA_ACK) return 1;//ACK
635 .LM75:
636 01aa 81B1 in r24,33-0x20
637 01ac 9927 clr r25
638 01ae 887F andi r24,lo8(248)
639 01b0 9070 andi r25,hi8(248)
640 01b2 8897 sbiw r24,40
641 01b4 19F0 breq .L57
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -