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

📄 stm8s_tim1.ls

📁 STM8-触摸例程
💻 LS
📖 第 1 页 / 共 5 页
字号:
1719  0284 7b06          	ld	a,(OFST+6,sp)
1720  0286 cd06a7        	call	_TIM1_SetIC4Prescaler
1722  0289               L176:
1723                     ; 562 }
1726  0289 85            	popw	x
1727  028a 81            	ret	
1823                     ; 590 void TIM1_PWMIConfig(TIM1_Channel_TypeDef TIM1_Channel,
1823                     ; 591                      TIM1_ICPolarity_TypeDef TIM1_ICPolarity,
1823                     ; 592                      TIM1_ICSelection_TypeDef TIM1_ICSelection,
1823                     ; 593                      TIM1_ICPSC_TypeDef TIM1_ICPrescaler,
1823                     ; 594                      u8 TIM1_ICFilter)
1823                     ; 595 {
1824                     	switch	.text
1825  028b               _TIM1_PWMIConfig:
1827  028b 89            	pushw	x
1828  028c 89            	pushw	x
1829       00000002      OFST:	set	2
1832                     ; 596   u8 icpolarity = TIM1_ICPOLARITY_RISING;
1834                     ; 597   u8 icselection = TIM1_ICSELECTION_DIRECTTI;
1836                     ; 600   assert_param(IS_TIM1_PWMI_CHANNEL_OK(TIM1_Channel));
1838                     ; 601   assert_param(IS_TIM1_IC_POLARITY_OK(TIM1_ICPolarity));
1840                     ; 602   assert_param(IS_TIM1_IC_SELECTION_OK(TIM1_ICSelection));
1842                     ; 603   assert_param(IS_TIM1_IC_PRESCALER_OK(TIM1_ICPrescaler));
1844                     ; 606   if (TIM1_ICPolarity != TIM1_ICPOLARITY_FALLING)
1846  028d 7b04          	ld	a,(OFST+2,sp)
1847  028f 4a            	dec	a
1848  0290 2702          	jreq	L157
1849                     ; 608     icpolarity = TIM1_ICPOLARITY_FALLING;
1851  0292 a601          	ld	a,#1
1853  0294               L157:
1854                     ; 612     icpolarity = TIM1_ICPOLARITY_RISING;
1856  0294 6b01          	ld	(OFST-1,sp),a
1857                     ; 616   if (TIM1_ICSelection == TIM1_ICSELECTION_DIRECTTI)
1859  0296 7b07          	ld	a,(OFST+5,sp)
1860  0298 4a            	dec	a
1861  0299 2604          	jrne	L557
1862                     ; 618     icselection = TIM1_ICSELECTION_INDIRECTTI;
1864  029b a602          	ld	a,#2
1866  029d 2002          	jra	L757
1867  029f               L557:
1868                     ; 622     icselection = TIM1_ICSELECTION_DIRECTTI;
1870  029f a601          	ld	a,#1
1871  02a1               L757:
1872  02a1 6b02          	ld	(OFST+0,sp),a
1873                     ; 625   if (TIM1_Channel == TIM1_CHANNEL_1)
1875  02a3 7b03          	ld	a,(OFST+1,sp)
1876  02a5 2626          	jrne	L167
1877                     ; 628     TI1_Config(TIM1_ICPolarity, TIM1_ICSelection,
1877                     ; 629                TIM1_ICFilter);
1879  02a7 7b09          	ld	a,(OFST+7,sp)
1880  02a9 88            	push	a
1881  02aa 7b08          	ld	a,(OFST+6,sp)
1882  02ac 97            	ld	xl,a
1883  02ad 7b05          	ld	a,(OFST+3,sp)
1884  02af 95            	ld	xh,a
1885  02b0 cd07a7        	call	L3_TI1_Config
1887  02b3 84            	pop	a
1888                     ; 632     TIM1_SetIC1Prescaler(TIM1_ICPrescaler);
1890  02b4 7b08          	ld	a,(OFST+6,sp)
1891  02b6 cd0680        	call	_TIM1_SetIC1Prescaler
1893                     ; 635     TI2_Config(icpolarity, icselection, TIM1_ICFilter);
1895  02b9 7b09          	ld	a,(OFST+7,sp)
1896  02bb 88            	push	a
1897  02bc 7b03          	ld	a,(OFST+1,sp)
1898  02be 97            	ld	xl,a
1899  02bf 7b02          	ld	a,(OFST+0,sp)
1900  02c1 95            	ld	xh,a
1901  02c2 cd07d7        	call	L5_TI2_Config
1903  02c5 84            	pop	a
1904                     ; 638     TIM1_SetIC2Prescaler(TIM1_ICPrescaler);
1906  02c6 7b08          	ld	a,(OFST+6,sp)
1907  02c8 cd068d        	call	_TIM1_SetIC2Prescaler
1910  02cb 2024          	jra	L367
1911  02cd               L167:
1912                     ; 643     TI2_Config(TIM1_ICPolarity, TIM1_ICSelection,
1912                     ; 644                TIM1_ICFilter);
1914  02cd 7b09          	ld	a,(OFST+7,sp)
1915  02cf 88            	push	a
1916  02d0 7b08          	ld	a,(OFST+6,sp)
1917  02d2 97            	ld	xl,a
1918  02d3 7b05          	ld	a,(OFST+3,sp)
1919  02d5 95            	ld	xh,a
1920  02d6 cd07d7        	call	L5_TI2_Config
1922  02d9 84            	pop	a
1923                     ; 647     TIM1_SetIC2Prescaler(TIM1_ICPrescaler);
1925  02da 7b08          	ld	a,(OFST+6,sp)
1926  02dc cd068d        	call	_TIM1_SetIC2Prescaler
1928                     ; 650     TI1_Config(icpolarity, icselection, TIM1_ICFilter);
1930  02df 7b09          	ld	a,(OFST+7,sp)
1931  02e1 88            	push	a
1932  02e2 7b03          	ld	a,(OFST+1,sp)
1933  02e4 97            	ld	xl,a
1934  02e5 7b02          	ld	a,(OFST+0,sp)
1935  02e7 95            	ld	xh,a
1936  02e8 cd07a7        	call	L3_TI1_Config
1938  02eb 84            	pop	a
1939                     ; 653     TIM1_SetIC1Prescaler(TIM1_ICPrescaler);
1941  02ec 7b08          	ld	a,(OFST+6,sp)
1942  02ee cd0680        	call	_TIM1_SetIC1Prescaler
1944  02f1               L367:
1945                     ; 655 }
1948  02f1 5b04          	addw	sp,#4
1949  02f3 81            	ret	
2004                     ; 673 void TIM1_Cmd(FunctionalState NewState)
2004                     ; 674 {
2005                     	switch	.text
2006  02f4               _TIM1_Cmd:
2010                     ; 676   assert_param(IS_FUNCTIONALSTATE_OK(NewState));
2012                     ; 679   if (NewState != DISABLE)
2014  02f4 4d            	tnz	a
2015  02f5 2705          	jreq	L3101
2016                     ; 681     TIM1->CR1 |= TIM1_CR1_CEN;
2018  02f7 72105250      	bset	21072,#0
2021  02fb 81            	ret	
2022  02fc               L3101:
2023                     ; 685     TIM1->CR1 &= (u8)(~TIM1_CR1_CEN);
2025  02fc 72115250      	bres	21072,#0
2026                     ; 687 }
2029  0300 81            	ret	
2065                     ; 705 void TIM1_CtrlPWMOutputs(FunctionalState NewState)
2065                     ; 706 {
2066                     	switch	.text
2067  0301               _TIM1_CtrlPWMOutputs:
2071                     ; 708   assert_param(IS_FUNCTIONALSTATE_OK(NewState));
2073                     ; 712   if (NewState != DISABLE)
2075  0301 4d            	tnz	a
2076  0302 2705          	jreq	L5301
2077                     ; 714     TIM1->BKR |= TIM1_BKR_MOE;
2079  0304 721e526d      	bset	21101,#7
2082  0308 81            	ret	
2083  0309               L5301:
2084                     ; 718     TIM1->BKR &= (u8)(~TIM1_BKR_MOE);
2086  0309 721f526d      	bres	21101,#7
2087                     ; 720 }
2090  030d 81            	ret	
2197                     ; 749 void TIM1_ITConfig(TIM1_IT_TypeDef  TIM1_IT, FunctionalState NewState)
2197                     ; 750 {
2198                     	switch	.text
2199  030e               _TIM1_ITConfig:
2201  030e 89            	pushw	x
2202       00000000      OFST:	set	0
2205                     ; 752   assert_param(IS_TIM1_IT_OK(TIM1_IT));
2207                     ; 753   assert_param(IS_FUNCTIONALSTATE_OK(NewState));
2209                     ; 755   if (NewState != DISABLE)
2211  030f 9f            	ld	a,xl
2212  0310 4d            	tnz	a
2213  0311 2706          	jreq	L7011
2214                     ; 758     TIM1->IER |= (u8)TIM1_IT;
2216  0313 9e            	ld	a,xh
2217  0314 ca5254        	or	a,21076
2219  0317 2006          	jra	L1111
2220  0319               L7011:
2221                     ; 763     TIM1->IER &= (u8)(~(u8)TIM1_IT);
2223  0319 7b01          	ld	a,(OFST+1,sp)
2224  031b 43            	cpl	a
2225  031c c45254        	and	a,21076
2226  031f               L1111:
2227  031f c75254        	ld	21076,a
2228                     ; 765 }
2231  0322 85            	popw	x
2232  0323 81            	ret	
2256                     ; 783 void TIM1_InternalClockConfig(void)
2256                     ; 784 {
2257                     	switch	.text
2258  0324               _TIM1_InternalClockConfig:
2262                     ; 786   TIM1->SMCR &= (u8)(~TIM1_SMCR_SMS);
2264  0324 c65252        	ld	a,21074
2265  0327 a4f8          	and	a,#248
2266  0329 c75252        	ld	21074,a
2267                     ; 787 }
2270  032c 81            	ret	
2387                     ; 815 void TIM1_ETRClockMode1Config(TIM1_ExtTRGPSC_TypeDef TIM1_ExtTRGPrescaler,
2387                     ; 816                               TIM1_ExtTRGPolarity_TypeDef TIM1_ExtTRGPolarity,
2387                     ; 817                               u8 ExtTRGFilter)
2387                     ; 818 {
2388                     	switch	.text
2389  032d               _TIM1_ETRClockMode1Config:
2391  032d 89            	pushw	x
2392       00000000      OFST:	set	0
2395                     ; 820   assert_param(IS_TIM1_EXT_PRESCALER_OK(TIM1_ExtTRGPrescaler));
2397                     ; 821   assert_param(IS_TIM1_EXT_POLARITY_OK(TIM1_ExtTRGPolarity));
2399                     ; 824   TIM1_ETRConfig(TIM1_ExtTRGPrescaler, TIM1_ExtTRGPolarity, ExtTRGFilter);
2401  032e 7b05          	ld	a,(OFST+5,sp)
2402  0330 88            	push	a
2403  0331 7b02          	ld	a,(OFST+2,sp)
2404  0333 95            	ld	xh,a
2405  0334 ad1b          	call	_TIM1_ETRConfig
2407  0336 84            	pop	a
2408                     ; 827   TIM1->SMCR = (u8)((TIM1->SMCR & (u8)(~(TIM1_SMCR_SMS | TIM1_SMCR_TS ))) | (u8)(  TIM1_SLAVEMODE_EXTERNAL1 | TIM1_TS_ETRF ));
2410  0337 c65252        	ld	a,21074
2411  033a aa77          	or	a,#119
2412  033c c75252        	ld	21074,a
2413                     ; 828 }
2416  033f 85            	popw	x
2417  0340 81            	ret	
2475                     ; 856 void TIM1_ETRClockMode2Config(TIM1_ExtTRGPSC_TypeDef TIM1_ExtTRGPrescaler,
2475                     ; 857                               TIM1_ExtTRGPolarity_TypeDef TIM1_ExtTRGPolarity,
2475                     ; 858                               u8 ExtTRGFilter)
2475                     ; 859 {
2476                     	switch	.text
2477  0341               _TIM1_ETRClockMode2Config:
2479  0341 89            	pushw	x
2480       00000000      OFST:	set	0
2483                     ; 861   assert_param(IS_TIM1_EXT_PRESCALER_OK(TIM1_ExtTRGPrescaler));
2485                     ; 862   assert_param(IS_TIM1_EXT_POLARITY_OK(TIM1_ExtTRGPolarity));
2487                     ; 865   TIM1_ETRConfig(TIM1_ExtTRGPrescaler, TIM1_ExtTRGPolarity, ExtTRGFilter);
2489  0342 7b05          	ld	a,(OFST+5,sp)
2490  0344 88            	push	a
2491  0345 7b02          	ld	a,(OFST+2,sp)
2492  0347 95            	ld	xh,a
2493  0348 ad07          	call	_TIM1_ETRConfig
2495  034a 721c5253      	bset	21075,#6
2496  034e 84            	pop	a
2497                     ; 868   TIM1->ETR |= TIM1_ETR_ECE;
2499                     ; 869 }
2502  034f 85            	popw	x
2503  0350 81            	ret	
2559                     ; 897 void TIM1_ETRConfig(TIM1_ExtTRGPSC_TypeDef TIM1_ExtTRGPrescaler,
2559                     ; 898                     TIM1_ExtTRGPolarity_TypeDef TIM1_ExtTRGPolarity,
2559                     ; 899                     u8 ExtTRGFilter)
2559                     ; 900 {
2560                     	switch	.text
2561  0351               _TIM1_ETRConfig:
2563  0351 89            	pushw	x
2564       00000000      OFST:	set	0
2567                     ; 902   TIM1->ETR |= (u8)((u8)TIM1_ExtTRGPrescaler |
2567                     ; 903                     (u8)TIM1_ExtTRGPolarity  |
2567                     ; 904                     (u8)ExtTRGFilter          );
2569  0352 9f            	ld	a,xl
2570  0353 1a01          	or	a,(OFST+1,sp)
2571  0355 1a05          	or	a,(OFST+5,sp)
2572  0357 ca5253        	or	a,21075
2573  035a c75253        	ld	21075,a
2574                     ; 905 }
2577  035d 85            	popw	x
2578  035e 81            	ret	
2667                     ; 934 void TIM1_TIxExternalClockConfig(TIM1_TIxExternalCLK1Source_TypeDef TIM1_TIxExternalCLKSource,
2667                     ; 935                                  TIM1_ICPolarity_TypeDef TIM1_ICPolarity,
2667                     ; 936                                  u8 ICFilter)
2667                     ; 937 {
2668                     	switch	.text
2669  035f               _TIM1_TIxExternalClockConfig:
2671  035f 89            	pushw	x
2672       00000000      OFST:	set	0
2675                     ; 939   assert_param(IS_TIM1_TIXCLK_SOURCE_OK(TIM1_TIxExternalCLKSource));
2677                     ; 940   assert_param(IS_TIM1_IC_POLARITY_OK(TIM1_ICPolarity));
2679                     ; 941   assert_param(IS_TIM1_IC_FILTER_OK(ICFilter));
2681                     ; 944   if (TIM1_TIxExternalCLKSource == TIM1_TIXEXTERNALCLK1SOURCE_TI2)
2683  0360 9e            	ld	a,xh

⌨️ 快捷键说明

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