资源简介

在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个文件信息

评论

共有 条评论