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

📄 lc.s

📁 ICC-AVR环境,用ATmage16做的LC表
💻 S
📖 第 1 页 / 共 2 页
字号:
	st -y,R18
	st -y,R17
	st -y,R16
	ldi R16,<L31
	ldi R17,>L31
	xcall lpm32
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	movw R30,R28
 ; stack offset 12
	ldd R2,z+14
	ldd R3,z+15
	ldd R4,z+16
	ldd R5,z+17
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	xcall empy32fs
	movw R30,R28
 ; stack offset 12
	ldd R2,z+14
	ldd R3,z+15
	ldd R4,z+16
	ldd R5,z+17
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	xcall empy32fs
	xcall empy32fs
	xcall div32fs
	ldi R16,<L29
	ldi R17,>L29
	xcall lpm32
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	xcall sub32fs
	ldi R16,<L32
	ldi R17,>L32
	xcall lpm32
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	xcall div32f
	movw R30,R28
	std z+6,R16
	std z+7,R17
	std z+8,R18
	std z+9,R19
	movw R30,R28
	ldd R2,z+6
	ldd R3,z+7
	ldd R4,z+8
	ldd R5,z+9
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	ldi R16,<L33
	ldi R17,>L33
	xcall lpm32
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	xcall cmp32f
	brlt L27
	movw R30,R28
	ldd R2,z+6
	ldd R3,z+7
	ldd R4,z+8
	ldd R5,z+9
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	ldi R16,<L33
	ldi R17,>L33
	xcall lpm32
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	xcall sub32f
	xcall fp2int
	movw R24,R16
	subi R24,0  ; offset = 32768
	sbci R25,128
	movw R10,R24
	xjmp L28
L27:
	movw R30,R28
	ldd R16,z+6
	ldd R17,z+7
	ldd R18,z+8
	ldd R19,z+9
	xcall fp2int
	movw R10,R16
L28:
	sts _Cn+1,R11
	sts _Cn,R10
	.dbline 129
; 	
; 	LCD_write_string(3,0,itoa(buf,Cn,10));
	ldi R24,10
	ldi R25,0
	std y+1,R25
	std y+0,R24
	movw R18,R10
	ldi R16,<_buf
	ldi R17,>_buf
	xcall _itoa
	std y+1,R17
	std y+0,R16
	clr R18
	ldi R16,3
	xcall _LCD_write_string
	.dbline 130
; 	LCD_write_char(0,'p');
	ldi R18,112
	ldi R19,0
	clr R16
	clr R17
	xcall _LCD_write_char
	.dbline 131
; 	LCD_write_char(0,'F');
	ldi R18,70
	ldi R19,0
	clr R16
	clr R17
	xcall _LCD_write_char
	.dbline -2
L26:
	adiw R28,10
	xcall pop_gset3
	.dbline 0 ; func end
	ret
	.dbsym l f 2 D
	.dbend
	.dbfunc e calc_Cx _calc_Cx fV
;              f -> y+2
	.even
_calc_Cx::
	xcall push_gset3
	sbiw R28,10
	.dbline -1
	.dbline 136
; 	
; }
; 
; void calc_Cx(void)
; {
	.dbline 137
;  	float f=1/(last_TCNT1*4)*1000000;
	lds R18,_last_TCNT1
	lds R19,_last_TCNT1+1
	ldi R16,4
	ldi R17,0
	xcall empy16s
	movw R18,R16
	ldi R16,1
	ldi R17,0
	xcall div16u
	movw R2,R16
	clr R4
	clr R5
	ldi R20,64
	ldi R21,66
	ldi R22,15
	ldi R23,0
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	movw R16,R20
	movw R18,R22
	xcall empy32s
	xcall long2fp
	movw R30,R28
	std z+2,R16
	std z+3,R17
	std z+4,R18
	std z+5,R19
	.dbline 138
; 	Cx=(1/(39.4384*f*f*L1)-C1)/1000000-Cn;
	ldi R16,<L29
	ldi R17,>L29
	xcall lpm32
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	ldi R16,<L30
	ldi R17,>L30
	xcall lpm32
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	ldi R16,<L31
	ldi R17,>L31
	xcall lpm32
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	movw R30,R28
 ; stack offset 12
	ldd R2,z+14
	ldd R3,z+15
	ldd R4,z+16
	ldd R5,z+17
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	xcall empy32fs
	movw R30,R28
 ; stack offset 12
	ldd R2,z+14
	ldd R3,z+15
	ldd R4,z+16
	ldd R5,z+17
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	xcall empy32fs
	xcall empy32fs
	xcall div32fs
	ldi R16,<L29
	ldi R17,>L29
	xcall lpm32
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	xcall sub32fs
	ldi R16,<L32
	ldi R17,>L32
	xcall lpm32
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	xcall div32fs
	ldi R16,<L37
	ldi R17,>L37
	xcall lpm32
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	lds R16,_Cn
	lds R17,_Cn+1
	lsr R17
	ror R16
	xcall int2fp
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	xcall empy32fs
	lds R16,_Cn
	lds R17,_Cn+1
	andi R16,1
	andi R17,0
	xcall int2fp
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	xcall add32fs
	xcall sub32f
	movw R30,R28
	std z+6,R16
	std z+7,R17
	std z+8,R18
	std z+9,R19
	movw R30,R28
	ldd R2,z+6
	ldd R3,z+7
	ldd R4,z+8
	ldd R5,z+9
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	ldi R16,<L33
	ldi R17,>L33
	xcall lpm32
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	xcall cmp32f
	brlt L35
	movw R30,R28
	ldd R2,z+6
	ldd R3,z+7
	ldd R4,z+8
	ldd R5,z+9
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	ldi R16,<L33
	ldi R17,>L33
	xcall lpm32
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	xcall sub32f
	xcall fp2int
	movw R24,R16
	subi R24,0  ; offset = 32768
	sbci R25,128
	movw R10,R24
	xjmp L36
L35:
	movw R30,R28
	ldd R16,z+6
	ldd R17,z+7
	ldd R18,z+8
	ldd R19,z+9
	xcall fp2int
	movw R10,R16
L36:
	sts _Cx+1,R11
	sts _Cx,R10
	.dbline 140
; 	
; 	LCD_write_string(3,1,itoa(buf,Cn,10));
	ldi R24,10
	ldi R25,0
	std y+1,R25
	std y+0,R24
	lds R18,_Cn
	lds R19,_Cn+1
	ldi R16,<_buf
	ldi R17,>_buf
	xcall _itoa
	std y+1,R17
	std y+0,R16
	ldi R18,1
	ldi R16,3
	xcall _LCD_write_string
	.dbline 141
; 	LCD_write_char(0,'p');
	ldi R18,112
	ldi R19,0
	clr R16
	clr R17
	xcall _LCD_write_char
	.dbline 142
; 	LCD_write_char(0,'F');
	ldi R18,70
	ldi R19,0
	clr R16
	clr R17
	xcall _LCD_write_char
	.dbline -2
L34:
	adiw R28,10
	xcall pop_gset3
	.dbline 0 ; func end
	ret
	.dbsym l f 2 D
	.dbend
	.dbfunc e calc_Lx _calc_Lx fV
;              f -> y+2
	.even
_calc_Lx::
	xcall push_gset3
	sbiw R28,10
	.dbline -1
	.dbline 147
; }
; 
; 
; void calc_Lx(void)
; {
	.dbline 148
; 	float f=1/(last_TCNT1*4)*1000000;
	lds R18,_last_TCNT1
	lds R19,_last_TCNT1+1
	ldi R16,4
	ldi R17,0
	xcall empy16s
	movw R18,R16
	ldi R16,1
	ldi R17,0
	xcall div16u
	movw R2,R16
	clr R4
	clr R5
	ldi R20,64
	ldi R21,66
	ldi R22,15
	ldi R23,0
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	movw R16,R20
	movw R18,R22
	xcall empy32s
	xcall long2fp
	movw R30,R28
	std z+2,R16
	std z+3,R17
	std z+4,R18
	std z+5,R19
	.dbline 149
; 	Lx=1/(39.4384*f*f*(C1+Cn*1000000));
	ldi R16,<L29
	ldi R17,>L29
	xcall lpm32
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	ldi R16,<L31
	ldi R17,>L31
	xcall lpm32
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	movw R30,R28
 ; stack offset 8
	ldd R2,z+10
	ldd R3,z+11
	ldd R4,z+12
	ldd R5,z+13
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	xcall empy32fs
	movw R30,R28
 ; stack offset 8
	ldd R2,z+10
	ldd R3,z+11
	ldd R4,z+12
	ldd R5,z+13
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	xcall empy32fs
	lds R2,_Cn
	lds R3,_Cn+1
	clr R4
	clr R5
	ldi R20,64
	ldi R21,66
	ldi R22,15
	ldi R23,0
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	movw R16,R20
	movw R18,R22
	xcall empy32s
	ldi R20,1
	ldi R21,0
	ldi R22,0
	ldi R23,0
	add R16,R20
	adc R17,R21
	adc R18,R22
	adc R19,R23
	xcall long2fp
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	xcall empy32fs
	xcall div32f
	movw R30,R28
	std z+6,R16
	std z+7,R17
	std z+8,R18
	std z+9,R19
	movw R30,R28
	ldd R2,z+6
	ldd R3,z+7
	ldd R4,z+8
	ldd R5,z+9
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	ldi R16,<L33
	ldi R17,>L33
	xcall lpm32
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	xcall cmp32f
	brlt L39
	movw R30,R28
	ldd R2,z+6
	ldd R3,z+7
	ldd R4,z+8
	ldd R5,z+9
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	ldi R16,<L33
	ldi R17,>L33
	xcall lpm32
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	xcall sub32f
	xcall fp2int
	movw R24,R16
	subi R24,0  ; offset = 32768
	sbci R25,128
	movw R10,R24
	xjmp L40
L39:
	movw R30,R28
	ldd R16,z+6
	ldd R17,z+7
	ldd R18,z+8
	ldd R19,z+9
	xcall fp2int
	movw R10,R16
L40:
	sts _Lx+1,R11
	sts _Lx,R10
	.dbline 151
; 	
; 	LCD_write_string(3,1,itoa(buf,Cn,10));
	ldi R24,10
	ldi R25,0
	std y+1,R25
	std y+0,R24
	lds R18,_Cn
	lds R19,_Cn+1
	ldi R16,<_buf
	ldi R17,>_buf
	xcall _itoa
	std y+1,R17
	std y+0,R16
	ldi R18,1
	ldi R16,3
	xcall _LCD_write_string
	.dbline 152
; 	LCD_write_char(0,'u');
	ldi R18,117
	ldi R19,0
	clr R16
	clr R17
	xcall _LCD_write_char
	.dbline 153
; 	LCD_write_char(0,'H');
	ldi R18,72
	ldi R19,0
	clr R16
	clr R17
	xcall _LCD_write_char
	.dbline -2
L38:
	adiw R28,10
	xcall pop_gset3
	.dbline 0 ; func end
	ret
	.dbsym l f 2 D
	.dbend
	.dbfunc e delay_nus _delay_nus fV
;              n -> R16
	.even
_delay_nus::
	.dbline -1
	.dbline 158
; }
; 
; /*--------------------------------延时函数--------------------------------*/
; void delay_nus(unsigned char n)       //N us延时函数
; {
	xjmp L43
L42:
	.dbline 160
	.dbline 161
	nop
	.dbline 162
L43:
	.dbline 159
; 	while (--n)
	mov R24,R16
	subi R24,1
	mov R16,R24
	tst R24
	brne L42
	.dbline -2
L41:
	.dbline 0 ; func end
	ret
	.dbsym r n 16 c
	.dbend
	.dbfunc e delay_1ms _delay_1ms fV
;              i -> R16
;              j -> R18
	.even
_delay_1ms::
	.dbline -1
	.dbline 166
; 	{
; 		asm("nop");
; 	}
; }
; 
; void delay_1ms(void)                 //1ms延时函数
; {
	.dbline 167
; 	unsigned char i=10,j=100;
	ldi R16,10
	.dbline 167
	ldi R18,100
	xjmp L47
L49:
	.dbline 170
	nop
L50:
	.dbline 169
	mov R24,R18
	subi R24,1
	mov R18,R24
	tst R24
	brne L49
L47:
	.dbline 168
; 	while (--i)
	mov R24,R16
	subi R24,1
	mov R16,R24
	tst R24
	brne L50
	.dbline -2
L45:
	.dbline 0 ; func end
	ret
	.dbsym r i 16 c
	.dbsym r j 18 c
	.dbend
	.dbfunc e delay_nms _delay_nms fV
;              n -> R20
	.even
_delay_nms::
	xcall push_gset1
	mov R20,R16
	.dbline -1
	.dbline 174
; 		while (--j)
; 			asm("nop");
; }
; 
; void delay_nms(unsigned char n)       //N ms延时函数
; {
	xjmp L54
L53:
	.dbline 176
	xcall _delay_1ms
L54:
	.dbline 175
; 	while (--n)
	mov R24,R20
	subi R24,1
	mov R20,R24
	tst R24
	brne L53
	.dbline -2
L52:
	xcall pop_gset1
	.dbline 0 ; func end
	ret
	.dbsym r n 20 c
	.dbend
	.area bss(ram, con, rel)
	.dbfile E:\资料文件\MCU\myLC\LC.c
_Cn::
	.blkb 2
	.dbsym e Cn _Cn i
_Lx::
	.blkb 2
	.dbsym e Lx _Lx i
_Cx::
	.blkb 2
	.dbsym e Cx _Cx i
_last_TCNT1::
	.blkb 2
	.dbsym e last_TCNT1 _last_TCNT1 i
	.area lit(rom, con, rel)
L37:
	.word 0x0,0x4000
L33:
	.word 0x0,0x4700
L32:
	.word 0x2400,0x4974
L31:
	.word 0xc0ec,0x421d
L30:
	.word 0x0,0x42c8
L29:
	.word 0x0,0x3f80
	.area data(ram, con, rel)
	.dbfile E:\资料文件\MCU\myLC\LC.c
L23:
	.blkb 7
	.area idata
	.byte 'T,'C,'N,'T,49,61,0
	.area data(ram, con, rel)
	.dbfile E:\资料文件\MCU\myLC\LC.c

⌨️ 快捷键说明

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