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

📄 lcd_lat.lst

📁 ICC LCD波形显示子程序,采用MEGA128单片机
💻 LST
📖 第 1 页 / 共 3 页
字号:
(0204)             else {y=y+1;err=err-d_x;}
    04E5 01C7      MOVW	R24,R14
    04E6 9601      ADIW	R24,1
    04E7 017C      MOVW	R14,R24
    04E8 1A66      SUB	R6,R22
    04E9 0A77      SBC	R7,R23
(0205)             draw_point(x,y,1);
    04EA E081      LDI	R24,1
    04EB 8388      STD	Y+0,R24
    04EC 2D2E      MOV	R18,R14
    04ED 2D0C      MOV	R16,R12
    04EE 926F      PUSH	R6
    04EF 927F      PUSH	R7
    04F0 DE7F      RCALL	_draw_point
    04F1 907F      POP	R7
    04F2 906F      POP	R6
    04F3 8809      LDD	R0,Y+17
    04F4 881A      LDD	R1,Y+18
    04F5 14E0      CP	R14,R0
    04F6 04F1      CPC	R15,R1
    04F7 F691      BNE	0x04CA
(0206)             }
(0207)         }    
    04F8 9621      ADIW	R28,1
    04F9 940E05F5  CALL	pop_gset5
    04FB 9624      ADIW	R28,4
    04FC 9508      RET
(0208)  }
(0209)                           
(0210) /***********************************************/
(0211) /*液晶初始化程序
(0212) 输入数据:无
(0213) 输出:无
(0214) 修改时间:2007-5-26
(0215) /**********************************************/	  	    	   
(0216) void lcm_init(void)
(0217)      {
(0218) 	  wr_com(0x30);
_lcm_init:
    04FD E300      LDI	R16,0x30
    04FE DE06      RCALL	_wr_com
(0219) 	  delay(80);
    04FF E500      LDI	R16,0x50
    0500 E010      LDI	R17,0
    0501 DDDE      RCALL	_delay
(0220) 	  wr_com(0x30);
    0502 E300      LDI	R16,0x30
    0503 DE01      RCALL	_wr_com
(0221) 	  delay(80);
    0504 E500      LDI	R16,0x50
    0505 E010      LDI	R17,0
    0506 DDD9      RCALL	_delay
(0222) 	  wr_com(0x0c);
    0507 E00C      LDI	R16,0xC
    0508 DDFC      RCALL	_wr_com
(0223) 	  delay(80);
    0509 E500      LDI	R16,0x50
    050A E010      LDI	R17,0
    050B DDD4      RCALL	_delay
(0224) 	  wr_com(0x01);
    050C E001      LDI	R16,1
    050D DDF7      RCALL	_wr_com
(0225) 	  delay(80);
    050E E500      LDI	R16,0x50
    050F E010      LDI	R17,0
    0510 DDCF      RCALL	_delay
(0226) 	  wr_com(0x60);
    0511 E600      LDI	R16,0x60
    0512 DDF2      RCALL	_wr_com
(0227) 	  delay(80);
    0513 E500      LDI	R16,0x50
    0514 E010      LDI	R17,0
    0515 DDCA      RCALL	_delay
(0228) 	  clear_all();
    0516 D001      RCALL	_clear_all
    0517 9508      RET
(0229) 	  }
(0230) void clear_all(void)
(0231)      {
(0232) 	  wr_com(0x01);//清屏
_clear_all:
    0518 E001      LDI	R16,1
    0519 DDEB      RCALL	_wr_com
(0233) 	  delay(80);
    051A E500      LDI	R16,0x50
    051B E010      LDI	R17,0
    051C DDC3      RCALL	_delay
(0234) 	  wr_com(0x34);//清屏
    051D E304      LDI	R16,0x34
    051E DDE6      RCALL	_wr_com
(0235) 	  delay(80);
    051F E500      LDI	R16,0x50
    0520 E010      LDI	R17,0
    0521 DDBE      RCALL	_delay
(0236) 	  wr_com(0x30);//清屏
    0522 E300      LDI	R16,0x30
    0523 DDE1      RCALL	_wr_com
(0237) 	  delay(80);
    0524 E500      LDI	R16,0x50
    0525 E010      LDI	R17,0
    0526 DDB9      RCALL	_delay
    0527 9508      RET
(0238) 	  }
(0239) //*******************整行显示******************/
(0240) void display(void)
(0241)      {
(0242) 	  wr_com(0x80);
_display:
    0528 E800      LDI	R16,0x80
    0529 DDDB      RCALL	_wr_com
    052A C00F      RJMP	0x053A
(0243) 	  while(*line1!=0x00)
(0244) 	       {
(0245) 		    wr_date(*line1);
    052B 91E005B7  LDS	R30,line1
    052D 91F005B8  LDS	R31,line1+1
    052F 8100      LDD	R16,Z+0
    0530 DDED      RCALL	_wr_date
(0246) 			line1++;
    0531 918005B7  LDS	R24,line1
    0533 919005B8  LDS	R25,line1+1
    0535 9601      ADIW	R24,1
    0536 939005B8  STS	line1+1,R25
    0538 938005B7  STS	line1,R24
    053A 91E005B7  LDS	R30,line1
    053C 91F005B8  LDS	R31,line1+1
    053E 8020      LDD	R2,Z+0
    053F 2022      TST	R2
    0540 F751      BNE	0x052B
(0247) 		    }
(0248) 	 wr_com(0x90);
    0541 E900      LDI	R16,0x90
    0542 DDC2      RCALL	_wr_com
    0543 C00F      RJMP	0x0553
(0249) 	 while(*line2!=0x00)
(0250) 	       {
(0251) 		    wr_date(*line2);
    0544 91E005B5  LDS	R30,line2
    0546 91F005B6  LDS	R31,line2+1
    0548 8100      LDD	R16,Z+0
    0549 DDD4      RCALL	_wr_date
(0252) 			line2++;
    054A 918005B5  LDS	R24,line2
    054C 919005B6  LDS	R25,line2+1
    054E 9601      ADIW	R24,1
    054F 939005B6  STS	line2+1,R25
    0551 938005B5  STS	line2,R24
    0553 91E005B5  LDS	R30,line2
    0555 91F005B6  LDS	R31,line2+1
    0557 8020      LDD	R2,Z+0
    0558 2022      TST	R2
    0559 F751      BNE	0x0544
(0253) 		    }
(0254) 	 wr_com(0x88);
    055A E808      LDI	R16,0x88
    055B DDA9      RCALL	_wr_com
    055C C00F      RJMP	0x056C
(0255) 	 while(*line3!=0x00)
(0256) 	       {
(0257) 		    wr_date(*line3);
    055D 91E005B3  LDS	R30,line3
    055F 91F005B4  LDS	R31,line3+1
    0561 8100      LDD	R16,Z+0
    0562 DDBB      RCALL	_wr_date
(0258) 			line3++;
    0563 918005B3  LDS	R24,line3
    0565 919005B4  LDS	R25,line3+1
    0567 9601      ADIW	R24,1
    0568 939005B4  STS	line3+1,R25
    056A 938005B3  STS	line3,R24
    056C 91E005B3  LDS	R30,line3
    056E 91F005B4  LDS	R31,line3+1
    0570 8020      LDD	R2,Z+0
    0571 2022      TST	R2
    0572 F751      BNE	0x055D
(0259) 		    }  	
(0260) 	 wr_com(0x9d);
    0573 E90D      LDI	R16,0x9D
    0574 DD90      RCALL	_wr_com
    0575 C00F      RJMP	0x0585
(0261) 	 while(*line4>=0&&*line4<=60)
(0262) 	       {
(0263) 		    wr_date(*line4);
    0576 91E005B1  LDS	R30,line4
    0578 91F005B2  LDS	R31,line4+1
    057A 8100      LDD	R16,Z+0
    057B DDA2      RCALL	_wr_date
(0264) 			line4++;
    057C 918005B1  LDS	R24,line4
    057E 919005B2  LDS	R25,line4+1
    0580 9601      ADIW	R24,1
    0581 939005B2  STS	line4+1,R25
    0583 938005B1  STS	line4,R24
    0585 91E005B1  LDS	R30,line4
    0587 91F005B2  LDS	R31,line4+1
    0589 8020      LDD	R2,Z+0
    058A 2433      CLR	R3
    058B 2D82      MOV	R24,R2
    058C 3080      CPI	R24,0
    058D F018      BCS	0x0591
    058E E38C      LDI	R24,0x3C
    058F 1582      CP	R24,R2
    0590 F728      BCC	0x0576
    0591 9508      RET
(0265) 		    }  									
(0266) 	 }
(0267) 
(0268) /************************系统初始化start*****************/	
(0269) void system_init(void)
(0270)      {
(0271) 	  line1="";
_system_init:
    0592 EB80      LDI	R24,0xB0
    0593 E095      LDI	R25,5
    0594 939005B8  STS	line1+1,R25
    0596 938005B7  STS	line1,R24
(0272) 	  line2="";
    0598 939005B6  STS	line2+1,R25
    059A 938005B5  STS	line2,R24
(0273) 	  line3="";
    059C 939005B4  STS	line3+1,R25
    059E 938005B3  STS	line3,R24
(0274) 	  line4="";
    05A0 EB80      LDI	R24,0xB0
    05A1 E095      LDI	R25,5
    05A2 939005B2  STS	line4+1,R25
    05A4 938005B1  STS	line4,R24
(0275) 	  lcm_init();
    05A6 DF56      RCALL	_lcm_init
    05A7 9508      RET
_ad_handler:
  cSREG                --> R16
  addata               --> R18
    05A8 922A      ST	R2,-Y
    05A9 923A      ST	R3,-Y
    05AA 930A      ST	R16,-Y
    05AB 932A      ST	R18,-Y
    05AC 933A      ST	R19,-Y
    05AD B62F      IN	R2,0x3F
    05AE 922A      ST	R2,-Y
FILE: D:\icc_work\LCD波形显示\AD.c
(0001) //ICC-AVR application builder : 2007-5-23 20:55:56
(0002) // Target : M128
(0003) // Crystal: 16.000Mhz
(0004) #include <iom128v.h>
(0005) #include <macros.h>
(0006) #include "all.h"
(0007) #define uchar unsigned char 
(0008) #define uint unsigned int 
(0009) #pragma interrupt_handler ad_handler:22
(0010) void ad_handler(void)
(0011) {
(0012)  	  static unsigned char i;
(0013) 	  int addata;
(0014)       char cSREG;
(0015)       cSREG=SREG;
    05AF B70F      IN	R16,0x3F
(0016)       _CLI();
    05B0 94F8      BCLR	7
(0017)       addata=ADCH;
    05B1 B125      IN	R18,0x05
    05B2 2733      CLR	R19
(0018) 	  addata = addata<<8;
    05B3 2F32      MOV	R19,R18
    05B4 2722      CLR	R18
(0019) 	  addata |=ADCL;
    05B5 B024      IN	R2,0x04
    05B6 2433      CLR	R3
    05B7 2922      OR	R18,R2
    05B8 2933      OR	R19,R3
(0020)       ADCSRA |=BIT(ADSC);  //第7位是ad使能位;
    05B9 9A36      SBI	0x06,6
(0021) //	  return addata;
(0022) 	  _NOP();
    05BA 0000      NOP
(0023)       _SEI();
    05BB 9478      BSET	7
(0024)       SREG=cSREG;
    05BC BF0F      OUT	0x3F,R16
    05BD 9029      LD	R2,Y+
    05BE BE2F      OUT	0x3F,R2
    05BF 9139      LD	R19,Y+
    05C0 9129      LD	R18,Y+
    05C1 9109      LD	R16,Y+
    05C2 9039      LD	R3,Y+
    05C3 9029      LD	R2,Y+
    05C4 9518      RETI
FILE: D:\icc_work\LCD波形显示\cpu_init.c
(0001) //ICC-AVR application builder : 2007-5-23 20:55:56
(0002) // Target : M128
(0003) // Crystal: 16.000Mhz
(0004) #include <iom128v.h>
(0005) #include <macros.h>
(0006) #include "all.h"
(0007) #define uchar unsigned char 
(0008) #define uint unsigned int 
(0009) void port_init(void)
(0010) {
(0011)  PORTA = 0x00;
_port_init:
    05C5 2422      CLR	R2
    05C6 BA2B      OUT	0x1B,R2
(0012)  DDRA  = 0x00;
    05C7 BA2A      OUT	0x1A,R2
(0013)  PORTB = 0x00;
    05C8 BA28      OUT	0x18,R2
(0014)  DDRB  = 0xff;
    05C9 EF8F      LDI	R24,0xFF
    05CA BB87      OUT	0x17,R24
(0015)  PORTC = 0x00; //m103 output only
    05CB BA25      OUT	0x15,R2
(0016)  DDRC  = 0x00;
    05CC BA24      OUT	0x14,R2
(0017)  PORTD = 0x00;
    05CD BA22      OUT	0x12,R2
(0018)  DDRD  = 0x00;
    05CE BA21      OUT	0x11,R2
(0019)  PORTE = 0x00;
    05CF B823      OUT	0x03,R2
(0020)  DDRE  = 0x00;
    05D0 B822      OUT	0x02,R2
(0021)  PORTF = 0x00;
    05D1 92200062  STS	0x62,R2
(0022)  DDRF  = 0x00;
    05D3 92200061  STS	0x61,R2
(0023)  PORTG = 0x00;
    05D5 92200065  STS	0x65,R2
(0024)  DDRG  = 0x00;
    05D7 92200064  STS	0x64,R2
    05D9 9508      RET
(0025) }
(0026) 
(0027) //call this routine to initialize all peripherals
(0028) void init_devices(void)
(0029) {
(0030)  //stop errant interrupts until set up
(0031)  CLI(); //disable all interrupts
_init_devices:
    05DA 94F8      BCLR	7
(0032)  XDIV  = 0x00; //xtal divider
    05DB 2422      CLR	R2
    05DC BE2C      OUT	0x3C,R2
(0033)  XMCRA = 0x00; //external memory
    05DD 9220006D  STS	0x6D,R2
(0034)  port_init();
    05DF DFE5      RCALL	_port_init
(0035)  system_init();
    05E0 940E0592  CALL	_system_init
(0036)   
(0037)  MCUCR = 0x00;
    05E2 2422      CLR	R2
    05E3 BE25      OUT	0x35,R2
(0038)  EICRA = 0x00; //extended ext ints
    05E4 9220006A  STS	0x6A,R2
(0039)  EICRB = 0x00; //extended ext ints
    05E6 BE2A      OUT	0x3A,R2
(0040)  EIMSK = 0x00;
    05E7 BE29      OUT	0x39,R2
(0041)  TIMSK = 0x00; //timer interrupt sources
    05E8 BE27      OUT	0x37,R2
(0042)  ETIMSK = 0x00; //extended timer interrupt sources
    05E9 9220007D  STS	0x7D,R2
(0043)  SEI(); //re-enable interrupts
FILE: <library>
    05EB 9478      BSET	7
    05EC 9508      RET
push_arg4:
    05ED 933A      ST	R19,-Y
    05EE 932A      ST	R18,-Y
push_arg2:
    05EF 931A      ST	R17,-Y
    05F0 930A      ST	R16,-Y
    05F1 9508      RET
pop_gset2:
    05F2 E0E2      LDI	R30,2
    05F3 940C0604  JMP	pop
pop_gset5:
    05F5 27EE      CLR	R30
    05F6 940C0604  JMP	pop
push_gset5:
    05F8 92FA      ST	R15,-Y
    05F9 92EA      ST	R14,-Y
push_gset4:
    05FA 92DA      ST	R13,-Y
    05FB 92CA      ST	R12,-Y
push_gset3:
    05FC 92BA      ST	R11,-Y
    05FD 92AA      ST	R10,-Y
push_gset2:
    05FE 937A      ST	R23,-Y
    05FF 936A      ST	R22,-Y
push_gset1:
    0600 935A      ST	R21,-Y
    0601 934A      ST	R20,-Y
    0602 9508      RET
pop_gset1:
    0603 E0E1      LDI	R30,1
pop:
    0604 9149      LD	R20,Y+
    0605 9159      LD	R21,Y+
    0606 FDE0      SBRC	R30,0
    0607 9508      RET
    0608 9169      LD	R22,Y+
    0609 9179      LD	R23,Y+
    060A FDE1      SBRC	R30,1
    060B 9508      RET
    060C 90A9      LD	R10,Y+
    060D 90B9      LD	R11,Y+
    060E FDE2      SBRC	R30,2
    060F 9508      RET
    0610 90C9      LD	R12,Y+
    0611 90D9      LD	R13,Y+
    0612 FDE3      SBRC	R30,3
    0613 9508      RET
    0614 90E9      LD	R14,Y+
    0615 90F9      LD	R15,Y+
    0616 9508      RET

⌨️ 快捷键说明

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