📄 stm8s_tim1.ls
字号:
1731 ; 559 TIM1_SetIC4Prescaler(TIM1_ICPrescaler);
1733 0284 7b06 ld a,(OFST+6,sp)
1734 0286 cd06a6 call _TIM1_SetIC4Prescaler
1736 0289 L176:
1737 ; 562 }
1740 0289 85 popw x
1741 028a 81 ret
1837 ; 590 void TIM1_PWMIConfig(TIM1_Channel_TypeDef TIM1_Channel,
1837 ; 591 TIM1_ICPolarity_TypeDef TIM1_ICPolarity,
1837 ; 592 TIM1_ICSelection_TypeDef TIM1_ICSelection,
1837 ; 593 TIM1_ICPSC_TypeDef TIM1_ICPrescaler,
1837 ; 594 u8 TIM1_ICFilter)
1837 ; 595 {
1838 switch .text
1839 028b _TIM1_PWMIConfig:
1841 028b 89 pushw x
1842 028c 89 pushw x
1843 00000002 OFST: set 2
1846 ; 596 u8 icpolarity = TIM1_ICPOLARITY_RISING;
1848 ; 597 u8 icselection = TIM1_ICSELECTION_DIRECTTI;
1850 ; 600 assert_param(IS_TIM1_PWMI_CHANNEL_OK(TIM1_Channel));
1852 ; 601 assert_param(IS_TIM1_IC_POLARITY_OK(TIM1_ICPolarity));
1854 ; 602 assert_param(IS_TIM1_IC_SELECTION_OK(TIM1_ICSelection));
1856 ; 603 assert_param(IS_TIM1_IC_PRESCALER_OK(TIM1_ICPrescaler));
1858 ; 606 if (TIM1_ICPolarity != TIM1_ICPOLARITY_FALLING)
1860 028d 9f ld a,xl
1861 028e 4a dec a
1862 028f 2702 jreq L157
1863 ; 608 icpolarity = TIM1_ICPOLARITY_FALLING;
1865 0291 a601 ld a,#1
1867 0293 L157:
1868 ; 612 icpolarity = TIM1_ICPOLARITY_RISING;
1870 0293 6b01 ld (OFST-1,sp),a
1871 ; 616 if (TIM1_ICSelection == TIM1_ICSELECTION_DIRECTTI)
1873 0295 7b07 ld a,(OFST+5,sp)
1874 0297 4a dec a
1875 0298 2604 jrne L557
1876 ; 618 icselection = TIM1_ICSELECTION_INDIRECTTI;
1878 029a a602 ld a,#2
1880 029c 2002 jra L757
1881 029e L557:
1882 ; 622 icselection = TIM1_ICSELECTION_DIRECTTI;
1884 029e a601 ld a,#1
1885 02a0 L757:
1886 02a0 6b02 ld (OFST+0,sp),a
1887 ; 625 if (TIM1_Channel == TIM1_CHANNEL_1)
1889 02a2 7b03 ld a,(OFST+1,sp)
1890 02a4 2626 jrne L167
1891 ; 628 TI1_Config(TIM1_ICPolarity, TIM1_ICSelection,
1891 ; 629 TIM1_ICFilter);
1893 02a6 7b09 ld a,(OFST+7,sp)
1894 02a8 88 push a
1895 02a9 7b08 ld a,(OFST+6,sp)
1896 02ab 97 ld xl,a
1897 02ac 7b05 ld a,(OFST+3,sp)
1898 02ae 95 ld xh,a
1899 02af cd07a1 call L3_TI1_Config
1901 02b2 84 pop a
1902 ; 632 TIM1_SetIC1Prescaler(TIM1_ICPrescaler);
1904 02b3 7b08 ld a,(OFST+6,sp)
1905 02b5 cd067f call _TIM1_SetIC1Prescaler
1907 ; 635 TI2_Config(icpolarity, icselection, TIM1_ICFilter);
1909 02b8 7b09 ld a,(OFST+7,sp)
1910 02ba 88 push a
1911 02bb 7b03 ld a,(OFST+1,sp)
1912 02bd 97 ld xl,a
1913 02be 7b02 ld a,(OFST+0,sp)
1914 02c0 95 ld xh,a
1915 02c1 cd07d1 call L5_TI2_Config
1917 02c4 84 pop a
1918 ; 638 TIM1_SetIC2Prescaler(TIM1_ICPrescaler);
1920 02c5 7b08 ld a,(OFST+6,sp)
1921 02c7 cd068c call _TIM1_SetIC2Prescaler
1924 02ca 2024 jra L367
1925 02cc L167:
1926 ; 643 TI2_Config(TIM1_ICPolarity, TIM1_ICSelection,
1926 ; 644 TIM1_ICFilter);
1928 02cc 7b09 ld a,(OFST+7,sp)
1929 02ce 88 push a
1930 02cf 7b08 ld a,(OFST+6,sp)
1931 02d1 97 ld xl,a
1932 02d2 7b05 ld a,(OFST+3,sp)
1933 02d4 95 ld xh,a
1934 02d5 cd07d1 call L5_TI2_Config
1936 02d8 84 pop a
1937 ; 647 TIM1_SetIC2Prescaler(TIM1_ICPrescaler);
1939 02d9 7b08 ld a,(OFST+6,sp)
1940 02db cd068c call _TIM1_SetIC2Prescaler
1942 ; 650 TI1_Config(icpolarity, icselection, TIM1_ICFilter);
1944 02de 7b09 ld a,(OFST+7,sp)
1945 02e0 88 push a
1946 02e1 7b03 ld a,(OFST+1,sp)
1947 02e3 97 ld xl,a
1948 02e4 7b02 ld a,(OFST+0,sp)
1949 02e6 95 ld xh,a
1950 02e7 cd07a1 call L3_TI1_Config
1952 02ea 84 pop a
1953 ; 653 TIM1_SetIC1Prescaler(TIM1_ICPrescaler);
1955 02eb 7b08 ld a,(OFST+6,sp)
1956 02ed cd067f call _TIM1_SetIC1Prescaler
1958 02f0 L367:
1959 ; 655 }
1962 02f0 5b04 addw sp,#4
1963 02f2 81 ret
2018 ; 673 void TIM1_Cmd(FunctionalState NewState)
2018 ; 674 {
2019 switch .text
2020 02f3 _TIM1_Cmd:
2024 ; 676 assert_param(IS_FUNCTIONALSTATE_OK(NewState));
2026 ; 679 if (NewState != DISABLE)
2028 02f3 4d tnz a
2029 02f4 2705 jreq L3101
2030 ; 681 TIM1->CR1 |= TIM1_CR1_CEN;
2032 02f6 72105250 bset 21072,#0
2035 02fa 81 ret
2036 02fb L3101:
2037 ; 685 TIM1->CR1 &= (u8)(~TIM1_CR1_CEN);
2039 02fb 72115250 bres 21072,#0
2040 ; 687 }
2043 02ff 81 ret
2079 ; 705 void TIM1_CtrlPWMOutputs(FunctionalState NewState)
2079 ; 706 {
2080 switch .text
2081 0300 _TIM1_CtrlPWMOutputs:
2085 ; 708 assert_param(IS_FUNCTIONALSTATE_OK(NewState));
2087 ; 712 if (NewState != DISABLE)
2089 0300 4d tnz a
2090 0301 2705 jreq L5301
2091 ; 714 TIM1->BKR |= TIM1_BKR_MOE;
2093 0303 721e526d bset 21101,#7
2096 0307 81 ret
2097 0308 L5301:
2098 ; 718 TIM1->BKR &= (u8)(~TIM1_BKR_MOE);
2100 0308 721f526d bres 21101,#7
2101 ; 720 }
2104 030c 81 ret
2211 ; 749 void TIM1_ITConfig(TIM1_IT_TypeDef TIM1_IT, FunctionalState NewState)
2211 ; 750 {
2212 switch .text
2213 030d _TIM1_ITConfig:
2215 030d 89 pushw x
2216 00000000 OFST: set 0
2219 ; 752 assert_param(IS_TIM1_IT_OK(TIM1_IT));
2221 ; 753 assert_param(IS_FUNCTIONALSTATE_OK(NewState));
2223 ; 755 if (NewState != DISABLE)
2225 030e 9f ld a,xl
2226 030f 4d tnz a
2227 0310 2706 jreq L7011
2228 ; 758 TIM1->IER |= (u8)TIM1_IT;
2230 0312 9e ld a,xh
2231 0313 ca5254 or a,21076
2233 0316 2006 jra L1111
2234 0318 L7011:
2235 ; 763 TIM1->IER &= (u8)(~(u8)TIM1_IT);
2237 0318 7b01 ld a,(OFST+1,sp)
2238 031a 43 cpl a
2239 031b c45254 and a,21076
2240 031e L1111:
2241 031e c75254 ld 21076,a
2242 ; 765 }
2245 0321 85 popw x
2246 0322 81 ret
2270 ; 783 void TIM1_InternalClockConfig(void)
2270 ; 784 {
2271 switch .text
2272 0323 _TIM1_InternalClockConfig:
2276 ; 786 TIM1->SMCR &= (u8)(~TIM1_SMCR_SMS);
2278 0323 c65252 ld a,21074
2279 0326 a4f8 and a,#248
2280 0328 c75252 ld 21074,a
2281 ; 787 }
2284 032b 81 ret
2401 ; 815 void TIM1_ETRClockMode1Config(TIM1_ExtTRGPSC_TypeDef TIM1_ExtTRGPrescaler,
2401 ; 816 TIM1_ExtTRGPolarity_TypeDef TIM1_ExtTRGPolarity,
2401 ; 817 u8 ExtTRGFilter)
2401 ; 818 {
2402 switch .text
2403 032c _TIM1_ETRClockMode1Config:
2405 032c 89 pushw x
2406 00000000 OFST: set 0
2409 ; 820 assert_param(IS_TIM1_EXT_PRESCALER_OK(TIM1_ExtTRGPrescaler));
2411 ; 821 assert_param(IS_TIM1_EXT_POLARITY_OK(TIM1_ExtTRGPolarity));
2413 ; 824 TIM1_ETRConfig(TIM1_ExtTRGPrescaler, TIM1_ExtTRGPolarity, ExtTRGFilter);
2415 032d 7b05 ld a,(OFST+5,sp)
2416 032f 88 push a
2417 0330 7b02 ld a,(OFST+2,sp)
2418 0332 95 ld xh,a
2419 0333 ad1b call _TIM1_ETRConfig
2421 0335 84 pop a
2422 ; 827 TIM1->SMCR = (u8)((TIM1->SMCR & (u8)(~(TIM1_SMCR_SMS | TIM1_SMCR_TS ))) | (u8)( TIM1_SLAVEMODE_EXTERNAL1 | TIM1_TS_ETRF ));
2424 0336 c65252 ld a,21074
2425 0339 aa77 or a,#119
2426 033b c75252 ld 21074,a
2427 ; 828 }
2430 033e 85 popw x
2431 033f 81 ret
2489 ; 856 void TIM1_ETRClockMode2Config(TIM1_ExtTRGPSC_TypeDef TIM1_ExtTRGPrescaler,
2489 ; 857 TIM1_ExtTRGPolarity_TypeDef TIM1_ExtTRGPolarity,
2489 ; 858 u8 ExtTRGFilter)
2489 ; 859 {
2490 switch .text
2491 0340 _TIM1_ETRClockMode2Config:
2493 0340 89 pushw x
2494 00000000 OFST: set 0
2497 ; 861 assert_param(IS_TIM1_EXT_PRESCALER_OK(TIM1_ExtTRGPrescaler));
2499 ; 862 assert_param(IS_TIM1_EXT_POLARITY_OK(TIM1_ExtTRGPolarity));
2501 ; 865 TIM1_ETRConfig(TIM1_ExtTRGPrescaler, TIM1_ExtTRGPolarity, ExtTRGFilter);
2503 0341 7b05 ld a,(OFST+5,sp)
2504 0343 88 push a
2505 0344 7b02 ld a,(OFST+2,sp)
2506 0346 95 ld xh,a
2507 0347 ad07 call _TIM1_ETRConfig
2509 0349 721c5253 bset 21075,#6
2510 034d 84 pop a
2511 ; 868 TIM1->ETR |= TIM1_ETR_ECE;
2513 ; 869 }
2516 034e 85 popw x
2517 034f 81 ret
2573 ; 897 void TIM1_ETRConfig(TIM1_ExtTRGPSC_TypeDef TIM1_ExtTRGPrescaler,
2573 ; 898 TIM1_ExtTRGPolarity_TypeDef TIM1_ExtTRGPolarity,
2573 ; 899 u8 ExtTRGFilter)
2573 ; 900 {
2574 switch .text
2575 0350 _TIM1_ETRConfig:
2577 0350 89 pushw x
2578 00000000 OFST: set 0
2581 ; 902 TIM1->ETR |= (u8)((u8)TIM1_ExtTRGPrescaler |
2581 ; 903 (u8)TIM1_ExtTRGPolarity |
2581 ; 904 (u8)ExtTRGFilter );
2583 0351 9f ld a,xl
2584 0352 1a01 or a,(OFST+1,sp)
2585 0354 1a05 or a,(OFST+5,sp)
2586 0356 ca5253 or a,21075
2587 0359 c75253 ld 21075,a
2588 ; 905 }
2591 035c 85 popw x
2592 035d 81 ret
2681 ; 934 void TIM1_TIxExternalClockConfig(TIM1_TIxExternalCLK1Source_TypeDef TIM1_TIxExternalCLKSource,
2681 ; 935 TIM1_ICPolarity_TypeDef TIM1_ICPolarity,
2681 ; 936 u8 ICFilter)
2681 ; 937 {
2682 switch .text
2683 035e _TIM1_TIxExternalClockConfig:
2685 035e 89 pushw x
2686 00000000 OFST: set 0
2689 ; 939 assert_param(IS_TIM1_TIXCLK_SOURCE_OK(TIM1_TIxExternalCLKSource));
2691 ; 940 assert_param(IS_TIM1_IC_POLARITY_OK(TIM1_ICPolarity));
2693 ; 941 assert_param(IS_TIM1_IC_FILTER_OK(ICFilter));
2695 ; 944 if (TIM1_TIxExternalCLKSource == TIM1_TIXEXTERNALCLK1SOURCE_TI2)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -