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

📄 mc_user_interface.ls

📁 STM8S105 BLDC源代码
💻 LS
📖 第 1 页 / 共 3 页
字号:
1718  024d 9093          	ldw	y,x
1719  024f e601          	ld	a,(1,x)
1720  0251 90eb06        	add	a,(6,y)
1721  0254 4a            	dec	a
1722  0255 e701          	ld	(1,x),a
1723                     ; 236 		g_pUserInterface->bSelected_Tab--;
1725                     ; 237 		g_pUserInterface->bSelected_Tab %= g_pUserInterface->bTabsNumber;
1727  0257 90e606        	ld	a,(6,y)
1728  025a 905f          	clrw	y
1729  025c 9097          	ld	yl,a
1730  025e e601          	ld	a,(1,x)
1731  0260 89            	pushw	x
1732  0261 5f            	clrw	x
1733  0262 97            	ld	xl,a
1734  0263 65            	divw	x,y
1735  0264 85            	popw	x
1736  0265 909f          	ld	a,yl
1737  0267 e701          	ld	(1,x),a
1738                     ; 238 		g_pUserInterface->pSelTab = UserInterface_GetSelTab();
1740  0269 cd0000        	call	_UserInterface_GetSelTab
1742  026c 90be05        	ldw	y,_g_pUserInterface
1743  026f 90ef02        	ldw	(2,y),x
1744                     ; 239 		UserInterface_ResetFocus();
1746  0272 cd00dd        	call	_UserInterface_ResetFocus
1748                     ; 240 		return TRUE;
1750  0275 a601          	ld	a,#1
1753  0277 5b01          	addw	sp,#1
1754  0279 81            	ret	
1779                     ; 244 u8 UserInterface_EditField(void)
1779                     ; 245 {
1780                     	switch	.text
1781  027a               _UserInterface_EditField:
1785                     ; 246 	if (g_pUserInterface->bStatus == UI_LOCKED)
1787  027a 92c605        	ld	a,[_g_pUserInterface.w]
1788  027d 4a            	dec	a
1789  027e 2601          	jrne	L727
1790                     ; 247 		return FALSE;
1794  0280 81            	ret	
1795  0281               L727:
1796                     ; 249 	if (g_pUserInterface->bField_Edit == g_pUserInterface->pSelTab->bFieldsNumber)
1798  0281 be05          	ldw	x,_g_pUserInterface
1799  0283 e605          	ld	a,(5,x)
1800  0285 ee02          	ldw	x,(2,x)
1801  0287 f1            	cp	a,(x)
1802  0288 2609          	jrne	L137
1803                     ; 251 		g_pUserInterface->bField_Edit = g_pUserInterface->bField_Focus_Selection;
1805  028a be05          	ldw	x,_g_pUserInterface
1806  028c e604          	ld	a,(4,x)
1807  028e e705          	ld	(5,x),a
1808                     ; 252 		return TRUE;
1810  0290 a601          	ld	a,#1
1813  0292 81            	ret	
1814  0293               L137:
1815                     ; 256 		g_pUserInterface->bField_Edit = g_pUserInterface->pSelTab->bFieldsNumber;
1817  0293 be05          	ldw	x,_g_pUserInterface
1818  0295 ee02          	ldw	x,(2,x)
1819  0297 f6            	ld	a,(x)
1820  0298 be05          	ldw	x,_g_pUserInterface
1821  029a e705          	ld	(5,x),a
1822                     ; 257 		return TRUE;
1824  029c a601          	ld	a,#1
1827  029e 81            	ret	
1913                     ; 261 u8 UserInterface_IncField(EditAction_t act)
1913                     ; 262 {
1914                     	switch	.text
1915  029f               _UserInterface_IncField:
1917  029f 88            	push	a
1918       00000005      OFST:	set	5
1921                     ; 263 	u8 selField = g_pUserInterface->bField_Focus_Selection;
1923  02a0 be05          	ldw	x,_g_pUserInterface
1924  02a2 5205          	subw	sp,#5
1925  02a4 e604          	ld	a,(4,x)
1926  02a6 6b03          	ld	(OFST-2,sp),a
1927                     ; 264 	PField_t pSelField = &(g_pUserInterface->pSelTab->pField[selField]);
1929  02a8 97            	ld	xl,a
1930  02a9 a609          	ld	a,#9
1931  02ab 90be05        	ldw	y,_g_pUserInterface
1932  02ae 90ee02        	ldw	y,(2,y)
1933  02b1 42            	mul	x,a
1934  02b2 90ee01        	ldw	y,(1,y)
1935  02b5 90bf00        	ldw	c_x,y
1936  02b8 72bb0000      	addw	x,c_x
1937  02bc 1f04          	ldw	(OFST-1,sp),x
1938                     ; 266 	switch (pSelField->Size)
1940  02be e604          	ld	a,(4,x)
1942                     ; 295 	default:
1942                     ; 296 		break;
1943  02c0 2710          	jreq	L537
1944  02c2 a002          	sub	a,#2
1945  02c4 2726          	jreq	L737
1946  02c6 4a            	dec	a
1947  02c7 2723          	jreq	L737
1948  02c9 4a            	dec	a
1949  02ca 2720          	jreq	L737
1950  02cc a002          	sub	a,#2
1951  02ce 273c          	jreq	L347
1952  02d0 204a          	jra	L5101
1953  02d2               L537:
1954                     ; 270 			u8 bVal=((PFN_getu8_t)pSelField->pGetValue)();
1956  02d2 ee05          	ldw	x,(5,x)
1957  02d4 fd            	call	(x)
1959  02d5 6b03          	ld	(OFST-2,sp),a
1960                     ; 271 			bVal = (u8)(UserInterface_UpdateField(pSelField->pExtra,(s16)(bVal),act));
1962  02d7 7b06          	ld	a,(OFST+1,sp)
1963  02d9 88            	push	a
1964  02da 7b04          	ld	a,(OFST-1,sp)
1965  02dc 5f            	clrw	x
1966  02dd 97            	ld	xl,a
1967  02de 89            	pushw	x
1968  02df 1e07          	ldw	x,(OFST+2,sp)
1969  02e1 ee07          	ldw	x,(7,x)
1970  02e3 ad3c          	call	_UserInterface_UpdateField
1972  02e5 5b03          	addw	sp,#3
1973  02e7 9f            	ld	a,xl
1974  02e8 6b03          	ld	(OFST-2,sp),a
1975                     ; 272 			((PFN_setu8_t)pSelField->pExtra->pSetValue)(bVal);
1977                     ; 273 			break;
1979  02ea 202a          	jp	L021
1980  02ec               L737:
1981                     ; 278 			s16 hVal=((PFN_gets16_t)pSelField->pGetValue)();
1984                     ; 279 			hVal = (s16)(UserInterface_UpdateField(pSelField->pExtra,hVal,act));
1987                     ; 280 			((PFN_sets16_t)pSelField->pExtra->pSetValue)(hVal);
1990  02ec ee05          	ldw	x,(5,x)
1991  02ee fd            	call	(x)
1992  02ef 1f01          	ldw	(OFST-4,sp),x
1994  02f1 7b06          	ld	a,(OFST+1,sp)
1995  02f3 88            	push	a
1996  02f4 1e02          	ldw	x,(OFST-3,sp)
1997  02f6 89            	pushw	x
1998  02f7 1e07          	ldw	x,(OFST+2,sp)
1999  02f9 ee07          	ldw	x,(7,x)
2000  02fb ad24          	call	_UserInterface_UpdateField
2001  02fd 5b03          	addw	sp,#3
2002  02ff 1f01          	ldw	(OFST-4,sp),x
2004  0301 1604          	ldw	y,(OFST-1,sp)
2005  0303 90ee07        	ldw	y,(7,y)
2006  0306 90fe          	ldw	y,(y)
2007  0308 90fd          	call	(y)
2009                     ; 281 			break;
2011  030a 2010          	jra	L5101
2012                     ; 285 			s16 hVal=((PFN_gets16_t)pSelField->pGetValue)();
2014                     ; 286 			hVal = (s16)(UserInterface_UpdateField(pSelField->pExtra,hVal,act));
2016                     ; 287 			((PFN_sets16_t)pSelField->pExtra->pSetValue)(hVal);
2018                     ; 288 			break;
2020  030c               L347:
2021                     ; 292 			((PFN_setu8_t)pSelField->pExtra->pSetValue)((u8)(!((PFN_getu8_t)pSelField->pGetValue)()));
2023  030c ee05          	ldw	x,(5,x)
2024  030e fd            	call	(x)
2026  030f 4d            	tnz	a
2027  0310 2603          	jrne	L411
2028  0312 4c            	inc	a
2029  0313 2001          	jra	L021
2030  0315               L411:
2031  0315 4f            	clr	a
2032  0316               L021:
2034  0316 1e04          	ldw	x,(OFST-1,sp)
2035  0318 ee07          	ldw	x,(7,x)
2036  031a fe            	ldw	x,(x)
2037  031b fd            	call	(x)
2039                     ; 293 			break;
2041                     ; 295 	default:
2041                     ; 296 		break;
2043  031c               L5101:
2044                     ; 298 	return TRUE;
2046  031c a601          	ld	a,#1
2049  031e 5b06          	addw	sp,#6
2050  0320 81            	ret	
2116                     ; 301 s16 UserInterface_UpdateField(PEditExtraField_t pExtra,s16 hVal,EditAction_t act)
2116                     ; 302 {
2117                     	switch	.text
2118  0321               _UserInterface_UpdateField:
2120  0321 89            	pushw	x
2121  0322 89            	pushw	x
2122       00000002      OFST:	set	2
2125                     ; 304 	if (act == INC_SEL)
2127  0323 7b09          	ld	a,(OFST+7,sp)
2128  0325 2625          	jrne	L3501
2129                     ; 306 		hDelta = pExtra->hMaxValue - pExtra->hInc_decValue;
2131  0327 1603          	ldw	y,(OFST+1,sp)
2132  0329 ee02          	ldw	x,(2,x)
2133  032b 90ee06        	ldw	y,(6,y)
2134  032e 90bf00        	ldw	c_x,y
2135  0331 72b00000      	subw	x,c_x
2136  0335 1f01          	ldw	(OFST-1,sp),x
2137                     ; 307 		if (hVal <= hDelta)
2139  0337 1e07          	ldw	x,(OFST+5,sp)
2140  0339 1301          	cpw	x,(OFST-1,sp)
2141  033b 2c09          	jrsgt	L5501
2142                     ; 309 			hVal += pExtra->hInc_decValue;
2144  033d 1e03          	ldw	x,(OFST+1,sp)
2145  033f ee06          	ldw	x,(6,x)
2146  0341 72fb07        	addw	x,(OFST+5,sp)
2148  0344 2030          	jra	L1601
2149  0346               L5501:
2150                     ; 313 			hVal = pExtra->hMaxValue;
2152  0346 1e03          	ldw	x,(OFST+1,sp)
2153  0348 ee02          	ldw	x,(2,x)
2154  034a 202a          	jra	L1601
2155  034c               L3501:
2156                     ; 318 		hDelta = (pExtra->hMinValue + pExtra->hInc_decValue);
2158  034c 1e03          	ldw	x,(OFST+1,sp)
2159  034e 1603          	ldw	y,(OFST+1,sp)
2160  0350 ee06          	ldw	x,(6,x)
2161  0352 90ee04        	ldw	y,(4,y)
2162  0355 90bf00        	ldw	c_x,y
2163  0358 72bb0000      	addw	x,c_x
2164  035c 1f01          	ldw	(OFST-1,sp),x
2165                     ; 319 		if (hVal >= hDelta)
2167  035e 1e07          	ldw	x,(OFST+5,sp)
2168  0360 1301          	cpw	x,(OFST-1,sp)
2169  0362 2f0e          	jrslt	L3601
2170                     ; 321 			hVal -= pExtra->hInc_decValue;
2172  0364 1603          	ldw	y,(OFST+1,sp)
2173  0366 90ee06        	ldw	y,(6,y)
2174  0369 90bf00        	ldw	c_x,y
2175  036c 72b00000      	subw	x,c_x
2177  0370 2004          	jra	L1601
2178  0372               L3601:
2179                     ; 325 			hVal = pExtra->hMinValue;
2181  0372 1e03          	ldw	x,(OFST+1,sp)
2182  0374 ee04          	ldw	x,(4,x)
2183  0376               L1601:
2184                     ; 328 	return hVal;
2188  0376 5b04          	addw	sp,#4
2189  0378 81            	ret	
2213                     ; 331 void UserInterface_Lock(void)
2213                     ; 332 {
2214                     	switch	.text
2215  0379               _UserInterface_Lock:
2219                     ; 333 	g_pUserInterface->bStatus = UI_LOCKED;
2221  0379 a601          	ld	a,#1
2222  037b 92c705        	ld	[_g_pUserInterface.w],a
2223                     ; 334 }
2226  037e 81            	ret	
2252                     ; 336 void UserInterface_Unlock(void)
2252                     ; 337 {
2253                     	switch	.text
2254  037f               _UserInterface_Unlock:
2258                     ; 338 	g_pUserInterface->bStatus = UI_UNLOCKED;
2260  037f 923f05        	clr	[_g_pUserInterface.w]
2261                     ; 339         bErrorCode = NO_FAULT;
2263  0382 3f00          	clr	L3_bErrorCode
2264                     ; 340 }
2267  0384 81            	ret	
2303                     ; 342 void UserInterface_Fault (u8 ErrorCode)
2303                     ; 343 {
2304                     	switch	.text
2305  0385               _UserInterface_Fault:
2309                     ; 344   bErrorCode = ErrorCode;
2311  0385 b700          	ld	L3_bErrorCode,a
2312                     ; 345 }
2315  0387 81            	ret	
2412                     	switch	.ubsct
2413  0000               _bHWErrorIndex:
2414  0000 00            	ds.b	1
2415                     	xdef	_bHWErrorIndex
2416                     	xdef	_hHWErrorMask
2417  0001               L7_pHWerrorActual_reg:
2418  0001 0000          	ds.b	2
2419  0003               L5_pHWerrorOccurred_reg:
2420  0003 0000          	ds.b	2
2421                     	xdef	_SW_Error_Message
2422                     	xdef	_HW_Error_Message
2423  0005               _g_pUserInterface:
2424  0005 0000          	ds.b	2
2425                     	xdef	_g_pUserInterface
2426                     	xdef	_UserInterface_UpdateField
2427                     	xdef	_UserInterface_GetSelTab
2428                     	xref	_vtimer_TimerElapsed
2429                     	xref	_vtimer_SetTimer
2430                     	xdef	_UserInterface_Fault
2431                     	xdef	_UserInterface_GetErrorMsg
2432                     	xdef	_UserInterface_Unlock
2433                     	xdef	_UserInterface_Lock
2434                     	xdef	_UserInterface_EditField
2435                     	xdef	_UserInterface_IncField
2436                     	xdef	_UserInterface_ChangeTab
2437                     	xdef	_UserInterface_ChangeToTab
2438                     	xdef	_UserInterface_UpDownKey
2439                     	xdef	_UserInterface_DownField
2440                     	xdef	_UserInterface_UpField
2441                     	xdef	_UserInterface_ResetFocus
2442                     	xdef	_UserInterface_Init
2443                     	switch	.const
2444  0078               L322:
2445  0078 4641554c5420  	dc.b	"FAULT CONDITION",0
2446  0088               L312:
2447  0088 4641554c5420  	dc.b	"FAULT OCCURRED",0
2448                     	xref.b	c_x
2468                     	end

⌨️ 快捷键说明

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