資源簡介
在STM8S003單片機上,用定時器2產生一個PWM波,用定時器輸入捕獲功能,測量該PWM波的周期,并通過串口將捕獲的周期發送出來。

代碼片段和文件信息
#include?“bsp.h“
#include?“stdio.h“
void?main(?void?)
{
????char?str[10]?=?{0};
????char?str1[10]?=?{0};
????BSP_Initializes();
????while(?1?)
????{
????????if(?IsOk_Flag?)
????????{
????????????IsOk_Flag?=?0;
????????????sprintf(?str?“%ld“?(?u32?)cycle?);
????????????UART1_Printf(?str?);
????????????UART1_Printf(?“us???“?);
????????????sprintf(?str1?“%d“?frequency?);
????????????UART1_Printf(?str1?);
????????????UART1_Printf(?“Hz\r\n“?);
????????}
????}
}
/*斷言函數:它的作用是在編程的過程中為程序提供參數檢查*/
#ifdef?USE_FULL_ASSERT
void?assert_failed(?u8*?file?u32?line?)
{
????/*?User?can?add?his?own?implementation?to?report?the?file?name?and?line?number
????ex:?printf(“Wrong?parameters?value:?file?%s?on?line?%d\r\n“?file?line)?*/
????/*?Infinite?loop?*/
????while(?1?)
????{
????}
}
#endif
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????853??2018-01-26?10:07??STM8S_Input_Capture\App\main.c
?????文件????????852??2018-01-26?09:47??STM8S_Input_Capture\App\main.c.orig
?????文件???????4957??2018-01-20?15:33??STM8S_Input_Capture\App\stm8s_conf.h
?????文件??????14864??2018-01-26?08:57??STM8S_Input_Capture\App\stm8s_it.c
?????文件??????14859??2018-01-26?08:46??STM8S_Input_Capture\App\stm8s_it.c.orig
?????文件???????5951??2014-10-22?00:31??STM8S_Input_Capture\App\stm8s_it.h
?????文件???????1987??2018-01-24?09:34??STM8S_Input_Capture\Bsp\adc.c
?????文件???????1909??2018-01-24?09:26??STM8S_Input_Capture\Bsp\adc.c.orig
?????文件????????442??2018-01-24?09:35??STM8S_Input_Capture\Bsp\adc.h
?????文件????????438??2018-01-24?09:31??STM8S_Input_Capture\Bsp\adc.h.orig
?????文件????????505??2018-01-26?09:09??STM8S_Input_Capture\Bsp\bsp.c
?????文件????????507??2018-01-26?09:09??STM8S_Input_Capture\Bsp\bsp.c.orig
?????文件????????769??2018-01-25?09:42??STM8S_Input_Capture\Bsp\bsp.h
?????文件???????1319??2018-01-26?10:07??STM8S_Input_Capture\Bsp\capture.c
?????文件???????1323??2018-01-26?09:55??STM8S_Input_Capture\Bsp\capture.c.orig
?????文件????????206??2018-01-26?09:08??STM8S_Input_Capture\Bsp\capture.h
?????文件????????202??2018-01-26?08:56??STM8S_Input_Capture\Bsp\capture.h.orig
?????文件???????2313??2018-01-20?17:13??STM8S_Input_Capture\Bsp\delay.c
?????文件????????376??2018-01-20?17:16??STM8S_Input_Capture\Bsp\delay.h
?????文件????????668??2018-01-22?14:21??STM8S_Input_Capture\Bsp\key.c
?????文件????????618??2018-01-22?14:23??STM8S_Input_Capture\Bsp\key.h
?????文件????????137??2018-01-22?14:02??STM8S_Input_Capture\Bsp\led.c
?????文件????????524??2018-01-20?16:39??STM8S_Input_Capture\Bsp\led.h
?????文件???????3226??2018-01-25?16:50??STM8S_Input_Capture\Bsp\pwm_capture.c
?????文件????????155??2018-01-25?16:50??STM8S_Input_Capture\Bsp\pwm_capture.h
?????文件???????3149??2018-01-24?16:34??STM8S_Input_Capture\Bsp\tim1_pwm.c
?????文件????????129??2018-01-24?11:39??STM8S_Input_Capture\Bsp\tim1_pwm.h
?????文件????????755??2018-01-26?10:06??STM8S_Input_Capture\Bsp\tim2_pwm.c
?????文件???????1193??2018-01-26?08:40??STM8S_Input_Capture\Bsp\tim2_pwm.c.orig
?????文件????????109??2018-01-26?08:57??STM8S_Input_Capture\Bsp\tim2_pwm.h
............此處省略226個文件信息
- 上一篇:STM32無刷無感電機驅動
- 下一篇:STM8S003 IAR環境庫函數模擬串口
評論
共有 條評論