双龙AVR-MEGA128开发板的配套源码。

源代码在线查看: led_128.s

软件大小: 3563 K
上传用户: ccdn2615
关键词: AVR-MEGA 128 开发板 源码
下载地址: 免注册下载 普通下载 VIP

相关代码

					.module led_128.c
					.area lit(rom, con, rel)
				_seg_table::
					.byte 192,249
					.byte 164,176
					.byte 153,146
					.byte 130,248
					.byte 128,144
					.byte 136,131
					.byte 198,161
					.byte 134,142
					.dbfile D:\jtag_test\led_128.c
					.dbsym s seg_table _seg_table A[16:16]c
					.area data(ram, con, rel)
					.dbfile D:\jtag_test\led_128.c
				_led_buff::
					.blkb 2
					.area idata
					.byte 0,0
					.area data(ram, con, rel)
					.dbfile D:\jtag_test\led_128.c
					.blkb 2
					.area idata
					.byte 0,0
					.area data(ram, con, rel)
					.dbfile D:\jtag_test\led_128.c
					.dbsym s led_buff _led_buff A[4:4]c
					.area text(rom, con, rel)
					.dbfile D:\jtag_test\led_128.c
					.dbfunc s delay_1ms _delay_1ms fI
				;              i -> R16,R17
					.even
				_delay_1ms::
					.dbline -1
					.dbline 7
				; #include 
				; #define xtal 16
				; const unsigned char seg_table[16]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,
				; 0x82,0xf8,0x80,0x90,0x88,0x83,0xc6,0xa1,0x86,0x8e};
				; unsigned char led_buff[4]={0,0,0,0};	  
				; void delay_1ms(void)
				; 	 {
					.dbline 9
				; 	  unsigned int i;
				;  	  for(i=1;i					ldi R16,1
					ldi R17,0
					xjmp L5
				L2:
					.dbline 10
				L3:
					.dbline 9
					subi R16,255  ; offset = 1
					sbci R17,255
				L5:
					.dbline 9
					cpi R16,238
					ldi R30,8
					cpc R17,R30
					brlo L2
					.dbline -2
					.dbline 11
				;       	; 
				; 	 }
				L1:
					.dbline 0 ; func end
					ret
					.dbsym r i 16 i
					.dbfunc s led_display _led_display fI
				;              i -> R20
					.even
				_led_display::
					xcall push_gset1
					.dbline -1
					.dbline 22
				; /*void delay_ms(unsigned int n)
				; 	 {
				;  	  unsigned int i=0;
				;    	  while(i				;    	  		{
				; 			 delay_1ms();
				; 			 i++;
				;    			}
				; 	 }*/
				; void led_display(void)
				; 	 {
					.dbline 24
				; 	  unsigned char i;
				; 	  DDRA=0xff;
					ldi R24,255
					out 0x1a,R24
					.dbline 25
				; 	  PORTA=0xff;
					out 0x1b,R24
					.dbline 26
				; 	  DDRC|=0xf0;
					in R24,0x14
					ori R24,240
					out 0x14,R24
					.dbline 27
				; 	  PORTC|=0xf0;
					in R24,0x15
					ori R24,240
					out 0x15,R24
					.dbline 28
				; 	  for(i=0;i					clr R20
					xjmp L10
				L7:
					.dbline 29
					.dbline 30
					ldi R24,					ldi R25,>_led_buff
					mov R30,R20
					clr R31
					add R30,R24
					adc R31,R25
					ldd R2,z+0
					out 0x1b,R2
					.dbline 31
					mov R17,R20
					subi R17,252    ; addi 4
					ldi R16,1
					xcall lsl8
					mov R2,R16
					com R2
					in R3,0x15
					and R3,R2
					out 0x15,R3
					.dbline 32
					xcall _delay_1ms
					.dbline 33
					in R24,0x15
					ori R24,240
					out 0x15,R24
					.dbline 34
				L8:
					.dbline 28
					inc R20
				L10:
					.dbline 28
					cpi R20,4
					brlo L7
					.dbline -2
					.dbline 35
				; 	  	 {		  
				; 		  PORTA=led_buff[i];
				; 		  PORTC&=~(1				; 		  delay_1ms();
				; 		  PORTC|=0xf0;
				; 		 }
				; 	 }
				L6:
					xcall pop_gset1
					.dbline 0 ; func end
					ret
					.dbsym r i 20 c
					.dbfunc s led_fill _led_fill fI
				;              i -> R20
				;          index -> R16
					.even
				_led_fill::
					xcall push_gset1
					.dbline -1
					.dbline 37
				; void led_fill(unsigned char index)
				; 	 {	 
					.dbline 39
				; 	  unsigned char i;
				; 	  for(i=0;i					clr R20
					xjmp L15
				L12:
					.dbline 40
					.dbline 41
					mov R2,R20
					clr R3
					mov R30,R16
					clr R31
					add R30,R2
					adc R31,R3
					ldi R24,					ldi R25,>_seg_table
					add R30,R24
					adc R31,R25
					lpm R30,Z
					ldi R24,					ldi R25,>_led_buff
					mov R26,R20
					clr R27
					add R26,R24
					adc R27,R25
					st x,R30
					.dbline 42
				L13:
					.dbline 39
					inc R20
				L15:
					.dbline 39
					cpi R20,4
					brlo L12
					.dbline -2
					.dbline 43
				; 	     {
				; 		  led_buff[i]=seg_table[index+i];
				; 		 }
				; 	 }	 
				L11:
					xcall pop_gset1
					.dbline 0 ; func end
					ret
					.dbsym r i 20 c
					.dbsym r index 16 c
					.dbfunc s main _main fI
				;              j -> R20
				;              i -> R22
					.even
				_main::
					.dbline -1
					.dbline 45
				; void main(void)
				; 	 {
					xjmp L18
				L17:
					.dbline 48
				; 	  unsigned char i,j;
				; 	  while(1)
				; 	  	   {
					.dbline 49
				; 		    for(j=0;j					clr R20
					xjmp L23
				L20:
					.dbline 50
				; 				{
					.dbline 51
				; 		    	 led_fill(4*j);
					ldi R24,4
					mul R24,R20
					movw R16,R0
					xcall _led_fill
					.dbline 52
				; 				 for(i=0;i					clr R22
					xjmp L27
				L24:
					.dbline 53
					xcall _led_display
				L25:
					.dbline 52
					inc R22
				L27:
					.dbline 52
					cpi R22,200
					brlo L24
					.dbline 54
				L21:
					.dbline 49
					inc R20
				L23:
					.dbline 49
					cpi R20,4
					brlo L20
					.dbline 55
				L18:
					.dbline 47
					xjmp L17
				X0:
					.dbline -2
					.dbline 56
				; 			     	led_display();
				; 				} 
				; 		   }
				; 	 }
				L16:
					.dbline 0 ; func end
					ret
					.dbsym r j 20 c
					.dbsym r i 22 c
							

相关资源