- 1
- 2
- 3
- 4
- 5
获得赏金
20.00元PWM波控制占空比 配合示波器显示 PROTEUS+KEIL
资料介绍
PWM波控制占空比,示波器显示
设计思路:
利用PWM的通道输出:
通过循环改变占空比,并通过OLED的屏幕显示CNT的变化
通过示波器真实显示占空比的变化
软件:
KEIL+STM32CUBEMX+PROTEUS平台仿真
电路图设计:

1. 引脚配置

- 开启高速,低速时钟

- 打开TIM2CH1(对应的PA0端口)

- 设置PB6,PB7为OLED数据端口

2. 时钟树配置

利用自带的内部时钟8MHz驱动
3. PWM的占空比变化函数
if(num!=0)
{
__HAL_TIM_SET_COMPARE(&htim2,TIM_CHANNEL_1,PWM_num--);
if(PWM_num==0)
{
num = 0;
}
}else{
__HAL_TIM_SET_COMPARE(&htim2,TIM_CHANNEL_1,PWM_num++);
if(PWM_num == 101)
{
num = 1;
}
OLED_ShowNum(1,2,PWM_num,4);
}
最终效果图


[[OLED#OLED.C]]
[[OLED#OELD.H]]
[[OLED#OELD_FONT.H]]
部分文件列表
| 文件名 | 大小 |
| P8_PWM_Output/ | |
| P8_PWM_Output/P8_PWM_Output/ | |
| P8_PWM_Output/P8_PWM_Output/.mxproject | 7KB |
| P8_PWM_Output/P8_PWM_Output/Core/ | |
| P8_PWM_Output/P8_PWM_Output/Core/Inc/ | |
| P8_PWM_Output/P8_PWM_Output/Core/Inc/gpio.h | 1KB |
| P8_PWM_Output/P8_PWM_Output/Core/Inc/main.h | 2KB |
| P8_PWM_Output/P8_PWM_Output/Core/Inc/OLED.h | 1KB |
| P8_PWM_Output/P8_PWM_Output/Core/Inc/OLED_Font.c | |
| P8_PWM_Output/P8_PWM_Output/Core/Inc/OLED_Font.h | |
| P8_PWM_Output/P8_PWM_Output/Core/Inc/stm32f1xx_hal_conf.h | |
| ... | |
- 21ic小能手打赏了20.00元
最新上传
-
21ic小能手 打赏5.00元 1天前
-
21ic下载 打赏310.00元 1天前
用户:gsy幸运
-
21ic下载 打赏310.00元 1天前
用户:小猫做电路
-
21ic下载 打赏360.00元 1天前
用户:mulanhk
-
21ic下载 打赏230.00元 1天前
用户:江岚
-
21ic下载 打赏230.00元 1天前
用户:潇潇江南
-
21ic下载 打赏210.00元 1天前
用户:zhengdai
-
21ic下载 打赏160.00元 1天前
用户:lanmukk
-
21ic下载 打赏130.00元 1天前
用户:jh03551
-
21ic下载 打赏110.00元 1天前
用户:liqiang9090
-
21ic下载 打赏110.00元 1天前
用户:jh0355
-
21ic小能手 打赏5.00元 1天前
-
21ic小能手 打赏5.00元 1天前
-
21ic小能手 打赏5.00元 1天前
-
21ic小能手 打赏5.00元 1天前
-
21ic下载 打赏20.00元 1天前
用户:w178191520
-
21ic下载 打赏30.00元 1天前
用户:sun2152
-
21ic下载 打赏30.00元 1天前
用户:xuzhen1
-
21ic下载 打赏20.00元 1天前
用户:w993263495
-
21ic下载 打赏15.00元 1天前
用户:kk1957135547
-
21ic下载 打赏15.00元 1天前
用户:eaglexiong
-
21ic下载 打赏15.00元 1天前
用户:w1966891335
-
21ic下载 打赏25.00元 1天前
用户:烟雨
-
21ic下载 打赏75.00元 1天前
用户:有理想666
-
21ic下载 打赏10.00元 1天前
用户:x15580286248
-
21ic下载 打赏40.00元 1天前
用户:xzxbybd
-
21ic下载 打赏10.00元 1天前
-
21ic下载 打赏10.00元 1天前
用户:sfgplj123
-
21ic下载 打赏10.00元 1天前
用户:dadengpao
-
21ic小能手 打赏10.00元 3天前
资料:自己编写的CRC校验工具
-
21ic小能手 打赏5.00元 3天前
-
21ic小能手 打赏10.00元 3天前
-
21ic小能手 打赏10.00元 3天前
-
shenzhenliugang 打赏5.00元 3天前
-
21ic小能手 打赏5.00元 3天前
-
21ic小能手 打赏5.00元 3天前
-
21ic小能手 打赏10.00元 3天前
-
21ic小能手 打赏5.00元 3天前
-
21ic小能手 打赏5.00元 3天前
-
21ic小能手 打赏5.00元 3天前




全部评论(0)