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

📄 numled.s

📁 双龙公司mega8芯片ad转换程序例程。
💻 S
字号:
	.module numled.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 E:\icc\iccavr\mega8\mega8\ADC\numled.c
	.dbsym e seg_table _seg_table A[16:16]kc
	.area data(ram, con, rel)
	.dbfile E:\icc\iccavr\mega8\mega8\ADC\numled.c
_led_buff::
	.blkb 2
	.area idata
	.byte 0,0
	.area data(ram, con, rel)
	.dbfile E:\icc\iccavr\mega8\mega8\ADC\numled.c
	.blkb 2
	.area idata
	.byte 0,0
	.area data(ram, con, rel)
	.dbfile E:\icc\iccavr\mega8\mega8\ADC\numled.c
	.dbsym e led_buff _led_buff A[4:4]c
	.area text(rom, con, rel)
	.dbfile E:\icc\iccavr\mega8\mega8\ADC\numled.c
	.dbfunc e delay_us _delay_us fV
;           time -> R16,R17
	.even
_delay_us::
	.dbline -1
	.dbline 15
; /*******************************************/
; /*            广州天河双龙电子公司         */
; /*            http://www.sl.com.cn         */
; /*              数码LED驱动程序            */
; /*            作者:ntzwq@wx88.net          */
; /*                2002年5月11日            */
; /*   目标MCU:MEGA8   晶振:内部RC(INT) 8MHZ */
; /*******************************************/
; #include<iom8v.h> 
; 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_us(int time)
; 	 {     
L2:
	.dbline 17
;   	  do
; 	  	{
	.dbline 18
; 		 time--;
	subi R16,1
	sbci R17,0
	.dbline 19
; 		}	
L3:
	.dbline 20
;   	  while (time>1);
	ldi R24,1
	ldi R25,0
	cp R24,R16
	cpc R25,R17
	brlt L2
	.dbline -2
	.dbline 21
; 	 }	  
L1:
	.dbline 0 ; func end
	ret
	.dbsym r time 16 I
	.dbend
	.dbfunc e delay_ms _delay_ms fV
;           time -> R20,R21
	.even
_delay_ms::
	rcall push_gset1
	movw R20,R16
	.dbline -1
	.dbline 24
; /*	  		    毫秒级延时程序			*/	 
; void delay_ms(unsigned int time)
; 	 {
	rjmp L7
L6:
	.dbline 26
	.dbline 27
	ldi R16,1000
	ldi R17,3
	rcall _delay_us
	.dbline 28
	subi R20,1
	sbci R21,0
	.dbline 29
L7:
	.dbline 25
; 	  while(time!=0)
	cpi R20,0
	cpc R20,R21
	brne L6
X0:
	.dbline -2
	.dbline 30
; 	  	  {		
; 		   delay_us(1000);
; 		   time--;
; 		  }
; 	 }					
L5:
	rcall pop_gset1
	.dbline 0 ; func end
	ret
	.dbsym r time 20 i
	.dbend
	.dbfunc e display _display fV
;              i -> R20
	.even
_display::
	rcall push_gset1
	.dbline -1
	.dbline 32
; void display(void)
; 	 {
	.dbline 34
; 	  unsigned char i;
; 	  DDRB=0xff;
	ldi R24,255
	out 0x17,R24
	.dbline 35
; 	  PORTB=0xff;
	out 0x18,R24
	.dbline 36
; 	  DDRD|=0xf0;
	in R24,0x11
	ori R24,240
	out 0x11,R24
	.dbline 37
; 	  PORTD|=0xf0;
	in R24,0x12
	ori R24,240
	out 0x12,R24
	.dbline 38
; 	  for(i=0;i<4;i++)
	clr R20
	rjmp L13
L10:
	.dbline 39
	.dbline 40
	ldi R24,<_led_buff
	ldi R25,>_led_buff
	mov R30,R20
	clr R31
	add R30,R24
	adc R31,R25
	ldd R2,z+0
	out 0x18,R2
	.dbline 41
	mov R17,R20
	subi R17,252    ; addi 4
	ldi R16,1
	rcall lsl8
	mov R2,R16
	com R2
	in R3,0x12
	and R3,R2
	out 0x12,R3
	.dbline 42
	ldi R16,1
	ldi R17,0
	rcall _delay_ms
	.dbline 43
	in R24,0x12
	ori R24,240
	out 0x12,R24
	.dbline 44
L11:
	.dbline 38
	inc R20
L13:
	.dbline 38
	cpi R20,4
	brlo L10
	.dbline -2
	.dbline 45
; 	  	 {		  
; 		  PORTB=led_buff[i];
; 		  PORTD&=~(1<<(i+4));
; 		  delay_ms(1);
; 		  PORTD|=0xf0;
; 		 }
; 	 }
L9:
	rcall pop_gset1
	.dbline 0 ; func end
	ret
	.dbsym r i 20 c
	.dbend

⌨️ 快捷键说明

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