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

📄 hd_support.s

📁 全场地位系统:小车静止或移动过程中码盘进行全场定位,用的是avr单片机
💻 S
📖 第 1 页 / 共 2 页
字号:
	ldi R24,1
	ldi R25,0
	ldi R26,0
	ldi R27,0
	lds R4,_g_lCounterR+2
	lds R5,_g_lCounterR+2+1
	lds R2,_g_lCounterR
	lds R3,_g_lCounterR+1
	add R2,R24
	adc R3,R25
	adc R4,R26
	adc R5,R27
	sts _g_lCounterR+1,R3
	sts _g_lCounterR,R2
	sts _g_lCounterR+2+1,R5
	sts _g_lCounterR+2,R4
	.dbline 178
L9:
	.dbline 178
	.dbline -2
L7:
	.dbline 0 ; func end
	ld R0,y+
	out 0x3f,R0
	ld R27,y+
	ld R26,y+
	ld R25,y+
	ld R24,y+
	ld R19,y+
	ld R18,y+
	ld R17,y+
	ld R16,y+
	ld R5,y+
	ld R4,y+
	ld R3,y+
	ld R2,y+
	ld R1,y+
	ld R0,y+
	reti
	.dbend
	.dbfunc e PCINT1_ISR _PCINT1_ISR fV
	.even
_PCINT1_ISR::
	st -y,R0
	st -y,R1
	st -y,R2
	st -y,R3
	st -y,R4
	st -y,R5
	st -y,R16
	st -y,R17
	st -y,R18
	st -y,R19
	st -y,R24
	st -y,R25
	st -y,R26
	st -y,R27
	in R0,0x3f
	st -y,R0
	.dbline -1
	.dbline 188
; }
; 
; /***********************************************************
; *   函数说明:PCINT1中断处理程序                           *
; *   输入:    无                                           *
; *   输出:    无                                           *
; *   调用函数:INSERT_PCINT1_ISR_CODE                       *
; ***********************************************************/
; void PCINT1_ISR(void)
; {
	.dbline 189
;     INSERT_PCINT1_ISR_CODE
	sei
	.dbline 189
	.dbline 189
	in R24,0x6
	lsr R24
	lsr R24
	lsr R24
	andi R24,1
	in R25,0x9
	lsr R25
	lsr R25
	andi R25,1
	cp R25,R24
	brne L11
X2:
	.dbline 189
	.dbline 189
	ldi R24,1
	ldi R25,0
	ldi R26,0
	ldi R27,0
	lds R4,_g_lCounterL+2
	lds R5,_g_lCounterL+2+1
	lds R2,_g_lCounterL
	lds R3,_g_lCounterL+1
	sub R2,R24
	sbc R3,R25
	sbc R4,R26
	sbc R5,R27
	sts _g_lCounterL+1,R3
	sts _g_lCounterL,R2
	sts _g_lCounterL+2+1,R5
	sts _g_lCounterL+2,R4
	.dbline 189
	rjmp L12
L11:
	.dbline 189
	.dbline 189
	ldi R24,1
	ldi R25,0
	ldi R26,0
	ldi R27,0
	lds R4,_g_lCounterL+2
	lds R5,_g_lCounterL+2+1
	lds R2,_g_lCounterL
	lds R3,_g_lCounterL+1
	add R2,R24
	adc R3,R25
	adc R4,R26
	adc R5,R27
	sts _g_lCounterL+1,R3
	sts _g_lCounterL,R2
	sts _g_lCounterL+2+1,R5
	sts _g_lCounterL+2,R4
	.dbline 189
L12:
	.dbline 189
	.dbline -2
L10:
	.dbline 0 ; func end
	ld R0,y+
	out 0x3f,R0
	ld R27,y+
	ld R26,y+
	ld R25,y+
	ld R24,y+
	ld R19,y+
	ld R18,y+
	ld R17,y+
	ld R16,y+
	ld R5,y+
	ld R4,y+
	ld R3,y+
	ld R2,y+
	ld R1,y+
	ld R0,y+
	reti
	.dbend
	.dbfunc e PCINT0_ISR _PCINT0_ISR fV
	.even
_PCINT0_ISR::
	st -y,R0
	st -y,R1
	st -y,R2
	st -y,R3
	st -y,R4
	st -y,R5
	st -y,R16
	st -y,R17
	st -y,R18
	st -y,R19
	st -y,R24
	st -y,R25
	st -y,R26
	st -y,R27
	in R0,0x3f
	st -y,R0
	.dbline -1
	.dbline 199
; }
; 
; /***********************************************************
; *   函数说明:PCINT0中断处理程序                           *
; *   输入:    无                                           *
; *   输出:    无                                           *
; *   调用函数:INSERT_PCINT0_ISR_CODE                       *
; ***********************************************************/
; void PCINT0_ISR(void)
; {
	.dbline 200
;     INSERT_PCINT0_ISR_CODE
	sei
	.dbline 200
	.dbline 200
	in R24,0x3
	andi R24,1
	in R25,0x9
	lsr R25
	lsr R25
	lsr R25
	andi R25,1
	cp R25,R24
	brne L14
X3:
	.dbline 200
	.dbline 200
	ldi R24,1
	ldi R25,0
	ldi R26,0
	ldi R27,0
	lds R4,_g_lCounterR+2
	lds R5,_g_lCounterR+2+1
	lds R2,_g_lCounterR
	lds R3,_g_lCounterR+1
	add R2,R24
	adc R3,R25
	adc R4,R26
	adc R5,R27
	sts _g_lCounterR+1,R3
	sts _g_lCounterR,R2
	sts _g_lCounterR+2+1,R5
	sts _g_lCounterR+2,R4
	.dbline 200
	rjmp L15
L14:
	.dbline 200
	.dbline 200
	ldi R24,1
	ldi R25,0
	ldi R26,0
	ldi R27,0
	lds R4,_g_lCounterR+2
	lds R5,_g_lCounterR+2+1
	lds R2,_g_lCounterR
	lds R3,_g_lCounterR+1
	sub R2,R24
	sbc R3,R25
	sbc R4,R26
	sbc R5,R27
	sts _g_lCounterR+1,R3
	sts _g_lCounterR,R2
	sts _g_lCounterR+2+1,R5
	sts _g_lCounterR+2,R4
	.dbline 200
L15:
	.dbline 200
	.dbline -2
L13:
	.dbline 0 ; func end
	ld R0,y+
	out 0x3f,R0
	ld R27,y+
	ld R26,y+
	ld R25,y+
	ld R24,y+
	ld R19,y+
	ld R18,y+
	ld R17,y+
	ld R16,y+
	ld R5,y+
	ld R4,y+
	ld R3,y+
	ld R2,y+
	ld R1,y+
	ld R0,y+
	reti
	.dbend
	.dbfunc s Timer0_INIT _Timer0_INIT fV
	.even
_Timer0_INIT:
	.dbline -1
	.dbline 210
; }
; 
; /***********************************************************
; *   函数声明:定时器0初始化函数                            *
; *   输入:    无                                           *
; *   输出:    无                                           *
; *   调用函数:无                                           *
; ***********************************************************/
; static void Timer0_INIT(void)
; {
	.dbline 211
;     TCCR0B = 0x00; //stop
	clr R2
	out 0x25,R2
	.dbline 212
;     TCNT0 = 0x06; //set count
	ldi R24,6
	out 0x26,R24
	.dbline 213
;     TCCR0A = 0x00; 
	out 0x24,R2
	.dbline 214
;     TCCR0B = 0x03; //start timer
	ldi R24,3
	out 0x25,R24
	.dbline -2
L16:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e Timer0_OVF_ISR _Timer0_OVF_ISR fV
	.even
_Timer0_OVF_ISR::
	st -y,R0
	st -y,R1
	st -y,R2
	st -y,R3
	st -y,R4
	st -y,R5
	st -y,R6
	st -y,R7
	st -y,R8
	st -y,R9
	st -y,R16
	st -y,R17
	st -y,R18
	st -y,R19
	st -y,R24
	st -y,R25
	st -y,R26
	st -y,R27
	st -y,R30
	st -y,R31
	in R0,0x3f
	st -y,R0
	.dbline -1
	.dbline 224
; }
; 
; /***********************************************************
; *   函数声明:定时器0溢出中断处理程序                      *
; *   输入:    无                                           *
; *   输出:    无                                           *
; *   调用函数:INSERT_TIMER0_OVF_ISR_CODE                   *
; ***********************************************************/
; void Timer0_OVF_ISR(void)
; {
	.dbline 225
;     TCNT0 = 0x06;
	ldi R24,6
	out 0x26,R24
	.dbline 226
;     INSERT_TIMER0_OVF_ISR_CODE
	sei
	.dbline 226
	rcall _Insert_Timer0_OVF_ISR_Code
	.dbline -2
L17:
	.dbline 0 ; func end
	ld R0,y+
	out 0x3f,R0
	ld R31,y+
	ld R30,y+
	ld R27,y+
	ld R26,y+
	ld R25,y+
	ld R24,y+
	ld R19,y+
	ld R18,y+
	ld R17,y+
	ld R16,y+
	ld R9,y+
	ld R8,y+
	ld R7,y+
	ld R6,y+
	ld R5,y+
	ld R4,y+
	ld R3,y+
	ld R2,y+
	ld R1,y+
	ld R0,y+
	reti
	.dbend
	.dbfunc s SPI_INIT _SPI_INIT fV
	.even
_SPI_INIT:
	.dbline -1
	.dbline 236
; }
; 
; /***********************************************************
; *   函数说明:SPI初始化函数                                *
; *   输入:    无                                           *
; *   输出:    无                                           *
; *   调用函数:无                                           *
; ***********************************************************/
; static void SPI_INIT(void)
; {
	.dbline 237
;     SPCR = 0xFE; //setup SPI
	ldi R24,254
	out 0x2c,R24
	.dbline 238
;     SPSR = 0x00; //setup SPI
	clr R2
	out 0x2d,R2
	.dbline -2
L18:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e SPI_STC_ISR _SPI_STC_ISR fV
	.even
_SPI_STC_ISR::
	st -y,R2
	st -y,R24
	st -y,R25
	st -y,R30
	st -y,R31
	in R2,0x3f
	st -y,R2
	.dbline -1
	.dbline 248
; }
; 
; /***********************************************************
; *   函数说明:SPI发送完成中断                              *
; *   输入:    无                                           *
; *   输出:    无                                           *
; *   调用函数:INSERT_SPI_STC_ISR_CODE                      *
; ***********************************************************/
; void SPI_STC_ISR(void)
; {
	.dbline 249
;     INSERT_SPI_STC_ISR_CODE
	sei
	.dbline 249
	.dbline 249
	ldi R24,<_g_chReceiveBuffer
	ldi R25,>_g_chReceiveBuffer
	lds R30,_g_chSPICounter
	clr R31
	add R30,R24
	adc R31,R25
	in R2,0x2e
	std z+0,R2
	.dbline 249
	lds R24,_g_chSPICounter
	subi R24,255    ; addi 1
	sts _g_chSPICounter,R24
	.dbline 249
	cpi R24,17
	brne L20
X4:
	.dbline 249
	.dbline 249
	clr R2
	sts _g_chSPICounter,R2
	.dbline 249
	in R24,0x5
	ori R24,4
	out 0x5,R24
	.dbline 249
	rjmp L21
L20:
	.dbline 249
	.dbline 249
	ldi R24,<_g_chSendBuffer
	ldi R25,>_g_chSendBuffer
	lds R30,_g_chSPICounter
	clr R31
	add R30,R24
	adc R31,R25
	ldd R2,z+0
	out 0x2e,R2
	.dbline 249
L21:
	.dbline 249
	.dbline -2
L19:
	.dbline 0 ; func end
	ld R2,y+
	out 0x3f,R2
	ld R31,y+
	ld R30,y+
	ld R25,y+
	ld R24,y+
	ld R2,y+
	reti
	.dbend
; }

⌨️ 快捷键说明

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