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

📄 ledindicator.s

📁 ATmega16应用例子
💻 S
字号:
	.module LedIndicator.C
	.area text(rom, con, rel)
	.dbfile E:\ICC_H\SoftExt.H
	.dbfunc e speaData _speaData fV
;              y -> y+4
;              j -> y+0
;              i -> R10
;            len -> R12
;            dat -> y+16
	.even
_speaData::
	xcall push_arg4
	xcall push_gset4
	sbiw R28,8
	ldd R12,y+20
	.dbline -1
	.dbline 116
; /*********************************************************************
; 	微 雪 电 子   WaveShare   http://www.waveShare.net	
; 
; 功能目的:   测试"LedIndicator"模块
; 
; 目标系统:   基于任何AVR单片机
; 
; 应用软件:   ICCAVR                                               
; 
; 版    本:   Version 1.0
; 
; 圆版时间:   2005-03-01
; 
; 开发人员:   SEE
; 
; 说    明:   若用于商业用途,请保留此段文字或注明代码来源 
; 
; 	深 圳 微 雪 电 子 保 留 所 有 的 版 权     
; *********************************************************************/
; 
; /*01010101010101010101010101010101010101010101010101010101010101010101
; ----------------------------------------------------------------------
; 版本更新记录:
; 
; ----------------------------------------------------------------------
; 接入模块: LedBoard
; 接口说明: LedBoard	       M16SmartGuider
; 			 	D0 	 --------     PA0
; 				D1	 --------     PA1
;                         .
; 	                    . 
; 				D7   --------     PA7
; 				L3   --------     PD4
; 				L2   --------     PD5
; 				L1   --------     PD6
; 				L0   --------     PD7
; 				VCC  --------     VCC
; 				GND	 --------     GND	
; 
; ----------------------------------------------------------------------
; 注意事项:
; 		* 
; ----------------------------------------------------------------------
; 10101010101010101010101010101010101010101010101010101010101010101010*/
; 
; #include <iom16v.H>
; #include "E:\ICC_H\CmmICC.H"
; 
; #define LED_BIT_DDR	  DDRB			//数码管 位选
; #define LED_BIT_PORT  PORTB
; #define LED_SEG_DDR	  DDRA 			//数码管 段选
; #define LED_SEG_PORT  PORTA
; 
; /*--------------------------------------------------------------------
; 函数名称:
; 函数功能:
; 注意事项:
; 提示说明:
; 输    入:
; 返    回:
; --------------------------------------------------------------------*/
; void main()
; {
; 	uint8 i;
; 	uint8 ledCode[]={0x88,0xEB,0x92,0xA2,0xE1,0xA4,0x84,0xEA,
; 					 0x80,0xA0,0x40,0x00,0x1C,0x08,0x14,0x54};
; 	LED_BIT_DDR = 0XFF;
; 	LED_BIT_PORT = 0xF0;
; 	LED_SEG_DDR = 0XFF;					 
; 	for(i=0;i<=15;i++)	
; 	{
;  		LED_SEG_PORT = ledCode[i];
; 		delay50ms(10);
; 	}
; }
; }
; }
; }
; }
; }
; }
; }
; }
; }
; }
; }
; }
; }
; }
; }
; }
; }
; }
; }
; }
; }
; }
; }
; }
; }
; }
; }
; }
; }
; }
; }
; }
; }
; }
; }
; }
; }
; }
; }
; }
; }
	.dbline 119
; }
; }
; }
	clr R10
	ldi R20,1
	ldi R21,0
	ldi R22,0
	ldi R23,0
	movw R30,R28
	std z+0,R20
	std z+1,R21
	std z+2,R22
	std z+3,R23
	xjmp L5
L2:
	.dbline 120
	.dbline 121
	movw R30,R28
	ldd R2,z+0
	ldd R3,z+1
	ldd R4,z+2
	ldd R5,z+3
	movw R30,R28
	ldd R6,z+16
	ldd R7,z+17
	ldd R8,z+18
	ldd R9,z+19
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	movw R16,R6
	movw R18,R8
	xcall div32u
	movw R30,R28
	std z+4,R16
	std z+5,R17
	std z+6,R18
	std z+7,R19
	.dbline 122
	ldi R20,10
	ldi R21,0
	ldi R22,0
	ldi R23,0
	movw R30,R28
	ldd R2,z+4
	ldd R3,z+5
	ldd R4,z+6
	ldd R5,z+7
	st -y,R23
	st -y,R22
	st -y,R21
	st -y,R20
	movw R16,R2
	movw R18,R4
	xcall mod32u
	ldi R24,<_dataElem
	ldi R25,>_dataElem
	mov R30,R10
	clr R31
	add R30,R24
	adc R31,R25
	std z+0,R16
	.dbline 123
	movw R30,R28
	ldd R2,z+0
	ldd R3,z+1
	ldd R4,z+2
	ldd R5,z+3
	ldi R20,10
	ldi R21,0
	ldi R22,0
	ldi R23,0
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	movw R16,R20
	movw R18,R22
	xcall empy32u
	movw R30,R28
	std z+0,R16
	std z+1,R17
	std z+2,R18
	std z+3,R19
	.dbline 124
L3:
	.dbline 119
	inc R10
L5:
	.dbline 119
	cp R10,R12
	brsh X0
	xjmp L2
X0:
	.dbline -2
	.dbline 125
; }
; }
; }
; }
; }
; }
L1:
	adiw R28,8
	xcall pop_gset4
	adiw R28,4
	.dbline 0 ; func end
	ret
	.dbsym l y 4 l
	.dbsym l j 0 l
	.dbsym r i 10 c
	.dbsym r len 12 C
	.dbsym l dat 16 l
	.dbend
	.dbfile E:\ICC_H\HardExt.H
	.dbfunc e delay50us _delay50us fV
;              j -> R20
;              t -> R16,R17
	.even
_delay50us::
	xcall push_gset1
	.dbline -1
	.dbline 98
	.dbline 100
	xjmp L10
L7:
	.dbline 101
	clr R20
	xjmp L14
L11:
	.dbline 102
L12:
	.dbline 101
	inc R20
L14:
	.dbline 101
	cpi R20,70
	brlo L11
L8:
	.dbline 100
	subi R16,1
	sbci R17,0
L10:
	.dbline 100
	clr R2
	clr R3
	cp R2,R16
	cpc R3,R17
	brlt L7
	.dbline -2
	.dbline 103
L6:
	xcall pop_gset1
	.dbline 0 ; func end
	ret
	.dbsym r j 20 c
	.dbsym r t 16 I
	.dbend
	.dbfunc e delay50ms _delay50ms fV
;              i -> R20,R21
;              t -> R16,R17
	.even
_delay50ms::
	xcall push_gset1
	.dbline -1
	.dbline 113
	.dbline 115
	xjmp L19
L16:
	.dbline 116
	clr R20
	clr R21
	xjmp L23
L20:
	.dbline 117
L21:
	.dbline 116
	subi R20,255  ; offset = 1
	sbci R21,255
L23:
	.dbline 116
	cpi R20,162
	ldi R30,205
	cpc R21,R30
	brlo L20
L17:
	.dbline 115
	subi R16,1
	sbci R17,0
L19:
	.dbline 115
	clr R2
	clr R3
	cp R2,R16
	cpc R3,R17
	brlt L16
	.dbline -2
	.dbline 118
L15:
	xcall pop_gset1
	.dbline 0 ; func end
	ret
	.dbsym r i 20 i
	.dbsym r t 16 I
	.dbend
	.area lit(rom, con, rel)
L25:
	.byte 136,235
	.byte 146,162
	.byte 225,164
	.byte 132,234
	.byte 128,160
	.byte 64,0
	.byte 28,8
	.byte 20,'T
	.area text(rom, con, rel)
	.dbfile E:\ICC_H\HardExt.H
	.dbfile E:\ProductPro\M16SD\ICCAVR\LedIndicator\LedIndicator.C
	.dbfunc e main _main fV
;        ledCode -> y+0
;              i -> R20
	.even
_main::
	sbiw R28,16
	.dbline -1
	.dbline 63
	.dbline 65
	ldi R24,<L25
	ldi R25,>L25
	movw R30,R28
	ldi R16,16
	ldi R17,0
	st -y,R31
	st -y,R30
	st -y,R25
	st -y,R24
	xcall asgncblk
	.dbline 67
	ldi R24,255
	out 0x17,R24
	.dbline 68
	ldi R24,240
	out 0x18,R24
	.dbline 69
	ldi R24,255
	out 0x1a,R24
	.dbline 70
	clr R20
	xjmp L29
L26:
	.dbline 71
	.dbline 72
	movw R24,R28
	mov R30,R20
	clr R31
	add R30,R24
	adc R31,R25
	ldd R2,z+0
	out 0x1b,R2
	.dbline 73
	ldi R16,10
	ldi R17,0
	xcall _delay50ms
	.dbline 74
L27:
	.dbline 70
	inc R20
L29:
	.dbline 70
	ldi R24,15
	cp R24,R20
	brsh L26
	.dbline -2
	.dbline 75
L24:
	adiw R28,16
	.dbline 0 ; func end
	ret
	.dbsym l ledCode 0 A[16:16]c
	.dbsym r i 20 c
	.dbend
	.area bss(ram, con, rel)
	.dbfile E:\ProductPro\M16SD\ICCAVR\LedIndicator\LedIndicator.C
_dataElem::
	.blkb 6
	.dbfile E:\ICC_H\SoftExt.H
	.dbsym e dataElem _dataElem A[6:6]c

⌨️ 快捷键说明

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