diff --git a/README.md b/README.md index eee6288..9a47e86 100644 --- a/README.md +++ b/README.md @@ -42,4 +42,33 @@ Tip: stm32_pwm_computer.exe stm32系统时钟(mhz) 期望的PWM频率(khz) ``` -![image-20211227114033164](markdown.assets/README.assets/image-20211227114033164.png) \ No newline at end of file +```powershell +C:\Users\zhaohe\Desktop\stm32_timer_pwm_computer\release>stm32_pwm_computer.exe 168 33 +****************************************************** +* author: 赵贺 * +* e-mail: zhaohe@163.net * +****************************************************** +* +* systemclk : 168.000000 mhz +* expect freq: 33.000000 khz +* +****************************************************** +* APB1: TIM2 TIM3 TIM4 TIM5 TIM6 TIM7 +* TIM12 TIM13 TIM14 +* +* timer_module_clk: 84.000000 mhz +* freq : 33.005895 khz +* period : 0.030298 ms +* prescaler : 0 +* autoreload : 2544 +* +* APB2: TIM1 TIM8 TIM9 TIM10 TIM11 +* +* timer_module_clk: 168.000000 mhz +* freq : 33.005895 khz +* period : 0.030298 ms +* prescaler : 0 +* autoreload : 5089 +****************************************************** +``` + diff --git a/release/stm32_pwm_computer.exe b/release/stm32_pwm_computer.exe index 3ccb889..8d0ba48 100644 Binary files a/release/stm32_pwm_computer.exe and b/release/stm32_pwm_computer.exe differ diff --git a/windows/stm32_pwm_computer.cpp b/windows/stm32_pwm_computer.cpp index 804258d..968dbf8 100644 --- a/windows/stm32_pwm_computer.cpp +++ b/windows/stm32_pwm_computer.cpp @@ -66,8 +66,14 @@ int main(int argc, char const* argv[]) sscanf(argv[1], "%f", &systemclk); sscanf(argv[2], "%f", &expect_freq); - printf("systemclk : %f mhz\n", systemclk); - printf("expect freq: %f khz\n", expect_freq); + printf("******************************************************\n"); + printf("* author: 赵贺 *\n"); + printf("* e-mail: zhaohe@163.net *\n"); + printf("******************************************************\n"); + printf("*\n"); + printf("* systemclk : %f mhz\n", systemclk); + printf("* expect freq: %f khz\n", expect_freq); + printf("*\n"); int32_t infreq = (int32_t)(expect_freq * 1000); timer_config_t timerconfig_apb1; @@ -79,7 +85,8 @@ int main(int argc, char const* argv[]) compute_timer_parameter(&timerconfig_apb2, systemclk, infreq); printf("******************************************************\n"); - printf("* APB1: TIM2 TIM3 TIM4 TIM5 TIM6 TIM7 TIM12 TIM13 TIM14\n"); + printf("* APB1: TIM2 TIM3 TIM4 TIM5 TIM6 TIM7\n"); + printf("* TIM12 TIM13 TIM14 \n"); printf("*\n"); printf("* timer_module_clk: %f mhz\n", systemclk / 2); printf("* freq : %f khz\n", timerconfig_apb1.realfreq / 1000.0); @@ -87,7 +94,6 @@ int main(int argc, char const* argv[]) printf("* prescaler : %d \n", timerconfig_apb1.prescaler); printf("* autoreload : %d \n", timerconfig_apb1.autoreload); printf("*\n"); - printf("**\n"); printf("* APB2: TIM1 TIM8 TIM9 TIM10 TIM11\n"); printf("*\n"); printf("* timer_module_clk: %f mhz\n", systemclk); @@ -95,6 +101,6 @@ int main(int argc, char const* argv[]) printf("* period : %f ms\n", (1.0 / timerconfig_apb2.realfreq * 1000)); printf("* prescaler : %d \n", timerconfig_apb2.prescaler); printf("* autoreload : %d \n", timerconfig_apb2.autoreload); - printf("***\n"); + printf("******************************************************\n"); return 0; } \ No newline at end of file