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

📄 led.s

📁 单片机中的中断处理模块
💻 S
📖 第 1 页 / 共 3 页
字号:
	.dbline 177
;   led_contrl_port |= (1<<4);
	sbi 0x12,4
	.dbline 178
;  }
	xjmp L34
L33:
	.dbline 179
;  else if(data<10)  //比如1.234
	movw R30,R28
	ldd R2,z+22
	ldd R3,z+23
	ldd R4,z+24
	ldd R5,z+25
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	ldi R16,<L38
	ldi R17,>L38
	xcall lpm32
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	xcall cmp32f
	brlt X3
	xjmp L45
X3:
	.dbline 180
;  {
	.dbline 181
;   temp=(data/1);   // 1.234/1 = 1
	movw R30,R28
	ldd R2,z+22
	ldd R3,z+23
	ldd R4,z+24
	ldd R5,z+25
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	ldi R16,<L35
	ldi R17,>L35
	xcall lpm32
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	xcall div32f
	movw R30,R28
	std z+0,R16
	std z+1,R17
	std z+2,R18
	std z+3,R19
	movw R30,R28
	ldd R2,z+0
	ldd R3,z+1
	ldd R4,z+2
	ldd R5,z+3
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	ldi R16,<L39
	ldi R17,>L39
	xcall lpm32
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	xcall cmp32f
	brlt L47
	movw R30,R28
	ldd R2,z+0
	ldd R3,z+1
	ldd R4,z+2
	ldd R5,z+3
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	ldi R16,<L39
	ldi R17,>L39
	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 L48
L47:
	movw R30,R28
	ldd R16,z+0
	ldd R17,z+1
	ldd R18,z+2
	ldd R19,z+3
	xcall fp2int
	movw R10,R16
L48:
	mov R20,R10
	.dbline 182
;   display_one(7,temp);
	mov R18,R20
	ldi R16,7
	xcall _display_one
	.dbline 183
;   led_port &= 0x7F; //点亮对应小数点
	in R24,0x1b
	andi R24,127
	out 0x1b,R24
	.dbline 184
;   delay_ms(6);
	ldi R16,6
	ldi R17,0
	xcall _delay_ms
	.dbline 185
;   led_contrl_port |= (1<<7);
	sbi 0x12,7
	.dbline 187
;   //第一位小数
;   temp2=(data*10);
	ldi R16,<L38
	ldi R17,>L38
	xcall lpm32
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	movw R30,R28
 ; stack offset 4
	ldd R2,z+26
	ldd R3,z+27
	ldd R4,z+28
	ldd R5,z+29
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	xcall empy32f
	movw R30,R28
	std z+4,R16
	std z+5,R17
	std z+6,R18
	std z+7,R19
	movw R30,R28
	ldd R2,z+4
	ldd R3,z+5
	ldd R4,z+6
	ldd R5,z+7
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	ldi R16,<L39
	ldi R17,>L39
	xcall lpm32
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	xcall cmp32f
	brlt L49
	movw R30,R28
	ldd R2,z+4
	ldd R3,z+5
	ldd R4,z+6
	ldd R5,z+7
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	ldi R16,<L39
	ldi R17,>L39
	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 L50
L49:
	movw R30,R28
	ldd R16,z+4
	ldd R17,z+5
	ldd R18,z+6
	ldd R19,z+7
	xcall fp2int
	movw R10,R16
L50:
	movw R22,R10
	.dbline 188
;   temp=temp2%10; // 1.234*10%10 = 2
	ldi R18,10
	ldi R19,0
	movw R16,R22
	xcall mod16u
	mov R20,R16
	.dbline 189
;   display_one(6,temp);
	mov R18,R20
	ldi R16,6
	xcall _display_one
	.dbline 190
;   delay_ms(6);
	ldi R16,6
	ldi R17,0
	xcall _delay_ms
	.dbline 191
;   led_contrl_port |= (1<<6);
	sbi 0x12,6
	.dbline 193
;   //第二位小数
;   temp2=(data*100);
	ldi R16,<L42
	ldi R17,>L42
	xcall lpm32
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	movw R30,R28
 ; stack offset 4
	ldd R2,z+26
	ldd R3,z+27
	ldd R4,z+28
	ldd R5,z+29
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	xcall empy32f
	movw R30,R28
	std z+8,R16
	std z+9,R17
	std z+10,R18
	std z+11,R19
	movw R30,R28
	ldd R2,z+8
	ldd R3,z+9
	ldd R4,z+10
	ldd R5,z+11
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	ldi R16,<L39
	ldi R17,>L39
	xcall lpm32
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	xcall cmp32f
	brlt L51
	movw R30,R28
	ldd R2,z+8
	ldd R3,z+9
	ldd R4,z+10
	ldd R5,z+11
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	ldi R16,<L39
	ldi R17,>L39
	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 L52
L51:
	movw R30,R28
	ldd R16,z+8
	ldd R17,z+9
	ldd R18,z+10
	ldd R19,z+11
	xcall fp2int
	movw R10,R16
L52:
	movw R22,R10
	.dbline 194
;   temp=temp2%10; // 1.234*100%10 = 3
	ldi R18,10
	ldi R19,0
	movw R16,R22
	xcall mod16u
	mov R20,R16
	.dbline 195
;   display_one(5,temp);
	mov R18,R20
	ldi R16,5
	xcall _display_one
	.dbline 196
;   delay_ms(6);
	ldi R16,6
	ldi R17,0
	xcall _delay_ms
	.dbline 197
;   led_contrl_port |= (1<<5);
	sbi 0x12,5
	.dbline 199
;   //第三位小数
;   temp2=(data*1000);
	ldi R16,<L29
	ldi R17,>L29
	xcall lpm32
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	movw R30,R28
 ; stack offset 4
	ldd R2,z+26
	ldd R3,z+27
	ldd R4,z+28
	ldd R5,z+29
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	xcall empy32f
	movw R30,R28
	std z+12,R16
	std z+13,R17
	std z+14,R18
	std z+15,R19
	movw R30,R28
	ldd R2,z+12
	ldd R3,z+13
	ldd R4,z+14
	ldd R5,z+15
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	ldi R16,<L39
	ldi R17,>L39
	xcall lpm32
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	xcall cmp32f
	brlt L53
	movw R30,R28
	ldd R2,z+12
	ldd R3,z+13
	ldd R4,z+14
	ldd R5,z+15
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	ldi R16,<L39
	ldi R17,>L39
	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 L54
L53:
	movw R30,R28
	ldd R16,z+12
	ldd R17,z+13
	ldd R18,z+14
	ldd R19,z+15
	xcall fp2int
	movw R10,R16
L54:
	movw R22,R10
	.dbline 200
;   temp=temp2%10; // 1.234*1000%10 = 4
	ldi R18,10
	ldi R19,0
	movw R16,R22
	xcall mod16u
	mov R20,R16
	.dbline 201
;   display_one(4,temp);
	mov R18,R20
	ldi R16,4
	xcall _display_one
	.dbline 202
;   delay_ms(6);
	ldi R16,6
	ldi R17,0
	xcall _delay_ms
	.dbline 203
;   led_contrl_port |= (1<<4);
	sbi 0x12,4
	.dbline 204
;  }
	xjmp L46
L45:
	.dbline 205
;  else if(data<100)   // 例如12.34
	movw R30,R28
	ldd R2,z+22
	ldd R3,z+23
	ldd R4,z+24
	ldd R5,z+25
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	ldi R16,<L42
	ldi R17,>L42
	xcall lpm32
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	xcall cmp32f
	brlt X4
	xjmp L55
X4:
	.dbline 206
;  {
	.dbline 207
;   temp2=data;
	movw R30,R28
	ldd R2,z+22
	ldd R3,z+23
	ldd R4,z+24
	ldd R5,z+25
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	ldi R16,<L39
	ldi R17,>L39
	xcall lpm32
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	xcall cmp32f
	brlt L57
	movw R30,R28
	ldd R2,z+22
	ldd R3,z+23
	ldd R4,z+24
	ldd R5,z+25
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	ldi R16,<L39
	ldi R17,>L39
	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 L58
L57:
	movw R30,R28
	ldd R16,z+22
	ldd R17,z+23
	ldd R18,z+24
	ldd R19,z+25
	xcall fp2int
	movw R10,R16
L58:
	movw R22,R10
	.dbline 208
;   temp=(temp2/10);   // 12.34/10=1
	ldi R18,10
	ldi R19,0
	movw R16,R22
	xcall div16u
	mov R20,R16
	.dbline 209
;   display_one(7,temp);
	mov R18,R20
	ldi R16,7
	xcall _display_one
	.dbline 210
;   delay_ms(6);
	ldi R16,6
	ldi R17,0
	xcall _delay_ms
	.dbline 211
;   led_contrl_port |= (1<<7);
	sbi 0x12,7
	.dbline 213
;   
;   temp2=data;
	movw R30,R28
	ldd R2,z+22
	ldd R3,z+23
	ldd R4,z+24
	ldd R5,z+25
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	ldi R16,<L39
	ldi R17,>L39
	xcall lpm32
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	xcall cmp32f
	brlt L59
	movw R30,R28
	ldd R2,z+22
	ldd R3,z+23
	ldd R4,z+24
	ldd R5,z+25
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	ldi R16,<L39
	ldi R17,>L39
	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 L60
L59:
	movw R30,R28
	ldd R16,z+22
	ldd R17,z+23
	ldd R18,z+24
	ldd R19,z+25
	xcall fp2int
	movw R10,R16
L60:
	movw R22,R10
	.dbline 214
;   temp=(temp2%10);   // 12.34%10=2
	ldi R18,10
	ldi R19,0
	movw R16,R22
	xcall mod16u
	mov R20,R16
	.dbline 215
;   display_one(6,temp);
	mov R18,R20
	ldi R16,6
	xcall _display_one
	.dbline 216
;   led_port &= 0x7F; //点亮对应小数点
	in R24,0x1b
	andi R24,127
	out 0x1b,R24
	.dbline 217
;   delay_ms(6);
	ldi R16,6
	ldi R17,0
	xcall _delay_ms
	.dbline 218
;   led_contrl_port |= (1<<6);
	sbi 0x12,6
	.dbline 220
;   
;   temp2=(data*10);
	ldi R16,<L38
	ldi R17,>L38
	xcall lpm32
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	movw R30,R28
 ; stack offset 4
	ldd R2,z+26
	ldd R3,z+27
	ldd R4,z+28
	ldd R5,z+29
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	xcall empy32f
	movw R30,R28
	std z+0,R16
	std z+1,R17
	std z+2,R18
	std z+3,R19
	movw R30,R28
	ldd R2,z+0
	ldd R3,z+1
	ldd R4,z+2
	ldd R5,z+3
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	ldi R16,<L39
	ldi R17,>L39
	xcall lpm32
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	xcall cmp32f
	brlt L61
	movw R30,R28
	ldd R2,z+0
	ldd R3,z+1
	ldd R4,z+2
	ldd R5,z+3
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	ldi R16,<L39
	ldi R17,>L39
	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 L62
L61:
	movw R30,R28
	ldd R16,z+0
	ldd R17,z+1
	ldd R18,z+2
	ldd R19,z+3
	xcall fp2int
	movw R10,R16
L62:
	movw R22,R10
	.dbline 221
;   temp=temp2%10; // 12.34*10%10=3
	ldi R18,10
	ldi R19,0
	movw R16,R22
	xcall mod16u
	mov R20,R16
	.dbline 222
;   display_one(5,temp);
	mov R18,R20
	ldi R16,5
	xcall _display_one
	.dbline 223
;   delay_ms(6);
	ldi R16,6
	ldi R17,0
	xcall _delay_ms
	.dbline 224
;   led_contrl_port |= (1<<5);
	sbi 0x12,5
	.dbline 226
;   
;   temp2=(data*100);
	ldi R16,<L42
	ldi R17,>L42
	xcall lpm32
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	movw R30,R28
 ; stack offset 4
	ldd R2,z+26
	ldd R3,z+27
	ldd R4,z+28
	ldd R5,z+29
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	xcall empy32f
	movw R30,R28
	std z+4,R16
	std z+5,R17
	std z+6,R18
	std z+7,R19
	movw R30,R28
	ldd R2,z+4
	ldd R3,z+5
	ldd R4,z+6
	ldd R5,z+7
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	ldi R16,<L39
	ldi R17,>L39
	xcall lpm32
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	xcall cmp32f
	brlt L63
	movw R30,R28
	ldd R2,z+4
	ldd R3,z+5
	ldd R4,z+6
	ldd R5,z+7
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	ldi R16,<L39
	ldi R17,>L39
	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 L64
L63:
	movw R30,R28
	ldd R16,z+4
	ldd R17,z+5
	ldd R18,z+6
	ldd R19,z+7
	xcall fp2int
	movw R10,R16
L64:
	movw R22,R10
	.dbline 227
;   temp=temp2%10;// 12.34*100%10=4
	ldi R18,10
	ldi R19,0
	movw R16,R22
	xcall mod16u
	mov R20,R16
	.dbline 228
;   display_one(0,temp);
	mov R18,R20
	clr R16
	xcall _display_one
	.dbline 229
;   delay_ms(6);
	ldi R16,6
	ldi R17,0
	xcall _delay_ms
	.dbline 230
;   led_contrl_port |= (1<<4);
	sbi 0x12,4
	.dbline 231
;  }
	xjmp L56
L55:
	.dbline 232
;  else if(data<1000)  //比如123.4
	movw R30,R28
	ldd R2,z+22
	ldd R3,z+23
	ldd R4,z+24
	ldd R5,z+25
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	ldi R16,<L29
	ldi R17,>L29
	xcall lpm32
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	xcall cmp32f
	brlt X5
	xjmp L65
X5:
	.dbline 233
;  {
	.dbline 234
;   temp2=data;
	movw R30,R28
	ldd R2,z+22
	ldd R3,z+23
	ldd R4,z+24
	ldd R5,z+25
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	ldi R16,<L39
	ldi R17,>L39
	xcall lpm32
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	xcall cmp32f
	brlt L67
	movw R30,R28
	ldd R2,z+22
	ldd R3,z+23
	ldd R4,z+24
	ldd R5,z+25
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	ldi R16,<L39
	ldi R17,>L39
	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

⌨️ 快捷键说明

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