资源简介
是我改的官方开发板的例子,是用的103RCT6,加入这一部分调程序的时候是相当方便的直接USB供电,还能串口打印
代码片段和文件信息
#include “stm32f10x.h“
#include “pwm.h“
static void TIM2_GPIO_Config(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2ENABLE); //TIM2~7都挂载在APB1上
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOAENABLE); //GPIO都挂载在APB2上
GPIO_InitStructure.GPIO_Pin=GPIO_Pin_1;
GPIO_InitStructure.GPIO_Mode=GPIO_Mode_AF_PP;
GPIO_InitStructure.GPIO_Speed=GPIO_Speed_50MHz;
GPIO_Init(GPIOA&GPIO_InitStructure);
}
static void TIM2_Mode_Config(void)
{
u16 CCR1_Val=750;
TIM_TimebaseInitTypeDef TIM_TimebaseStructure;
TIM_OCInitTypeDef TIM_OCInitStructure;
/* Time base configuration */
TIM_TimebaseStructure.TIM_Period = 999; //当定时器从0计数到999,即为1000次,为一个定时周期
TIM_TimebaseStructure.TIM_Prescaler = 0; //设置预分频:不预分频,即为72MHz
TIM_TimebaseStructure.TIM_ClockDivision = TIM_CKD_DIV1 ; //设置时钟分频系数:不分频
TIM_TimebaseStructure.TIM_CounterMode = TIM_CounterMode_Up; //向上计数模式
TIM_TimebaseInit(TIM2 &TIM_TimebaseStructure);
/* PWM1 Mode configuration: Channel2 */
TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM1; //配置为PWM模式1
TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable;
TIM_OCInitStructure.TIM_Pulse = CCR1_Val; //设置跳变值,当计数器计数到这个值时,电平发生跳变
TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_High; //当定时器计数值小于CCR1_Val时为高电平
TIM_OC2Init(TIM2 &TIM_OCInitStructure); //使能通道3
TIM_OC2PreloadConfig(TIM2 TIM_OCPreload_Enable);
TIM_ARRPreloadConfig(TIM2 ENABLE); // 使能TIM2重载寄存器ARR
/* TIM3 enable counter */
TIM_Cmd(TIM2 ENABLE); //使能定时器2
}
void TIM2_PWM_Init(void)
{
TIM2_GPIO_Config();
TIM2_Mode_Config();
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 3533 2014-05-22 23:34 RCT6_USB_UART\RCT6_USB_UART\list\core_cm3.crf
文件 95 2014-05-22 23:34 RCT6_USB_UART\RCT6_USB_UART\list\core_cm3.d
文件 10288 2014-05-22 23:34 RCT6_USB_UART\RCT6_USB_UART\list\core_cm3.o
文件 19 2014-05-20 22:53 RCT6_USB_UART\RCT6_USB_UART\list\ExtDll.iex
文件 370932 2014-05-22 23:34 RCT6_USB_UART\RCT6_USB_UART\list\hw_config.crf
文件 2300 2014-05-22 23:34 RCT6_USB_UART\RCT6_USB_UART\list\hw_config.d
文件 411016 2014-05-22 23:34 RCT6_USB_UART\RCT6_USB_UART\list\hw_config.o
文件 383 2014-05-22 23:34 RCT6_USB_UART\RCT6_USB_UART\list\hw_config.__i
文件 366269 2014-05-22 23:34 RCT6_USB_UART\RCT6_USB_UART\list\main.crf
文件 2017 2014-05-22 23:34 RCT6_USB_UART\RCT6_USB_UART\list\main.d
文件 403100 2014-05-22 23:34 RCT6_USB_UART\RCT6_USB_UART\list\main.o
文件 357 2014-05-22 23:34 RCT6_USB_UART\RCT6_USB_UART\list\main.__i
文件 348340 2014-05-22 23:34 RCT6_USB_UART\RCT6_USB_UART\list\misc.crf
文件 1492 2014-05-22 23:34 RCT6_USB_UART\RCT6_USB_UART\list\misc.d
文件 379068 2014-05-22 23:34 RCT6_USB_UART\RCT6_USB_UART\list\misc.o
文件 366 2014-05-22 23:34 RCT6_USB_UART\RCT6_USB_UART\list\misc.__i
文件 348060 2014-05-22 23:34 RCT6_USB_UART\RCT6_USB_UART\list\pwm.crf
文件 1441 2014-05-22 23:34 RCT6_USB_UART\RCT6_USB_UART\list\pwm.d
文件 379192 2014-05-22 23:34 RCT6_USB_UART\RCT6_USB_UART\list\pwm.o
文件 353 2014-05-22 23:34 RCT6_USB_UART\RCT6_USB_UART\list\pwm.__i
文件 75 2014-05-14 01:21 RCT6_USB_UART\RCT6_USB_UART\list\startup_stm32f10x_hd.d
文件 6768 2014-05-14 01:21 RCT6_USB_UART\RCT6_USB_UART\list\startup_stm32f10x_hd.o
文件 361 2014-05-10 10:22 RCT6_USB_UART\RCT6_USB_UART\list\STM32.plg
文件 355509 2014-05-22 23:34 RCT6_USB_UART\RCT6_USB_UART\list\stm32f10x_adc.crf
文件 1789 2014-05-22 23:34 RCT6_USB_UART\RCT6_USB_UART\list\stm32f10x_adc.d
文件 393164 2014-05-22 23:34 RCT6_USB_UART\RCT6_USB_UART\list\stm32f10x_adc.o
文件 402 2014-05-22 23:34 RCT6_USB_UART\RCT6_USB_UART\list\stm32f10x_adc.__i
文件 349280 2014-05-22 23:34 RCT6_USB_UART\RCT6_USB_UART\list\stm32f10x_bkp.crf
文件 1789 2014-05-22 23:34 RCT6_USB_UART\RCT6_USB_UART\list\stm32f10x_bkp.d
文件 381376 2014-05-22 23:34 RCT6_USB_UART\RCT6_USB_UART\list\stm32f10x_bkp.o
............此处省略263个文件信息
- 上一篇:gcc-2.8.1.tar.bz2
- 下一篇:商务日语脱口说.pdf
相关资源
- BASCOM-AVR的例程
-
win em
bedded compact 2013开发教程 - comport.rar
- jlleeQuartus_2.rar
- AFoundationinDigitalCommunication.pdf
- www.163pan.com__格林财务管理系统3.8含注
- HSM USB Serial Driver ver 3.1.4
- Wireless Communications Over Rapidly Time-Vary
- UVCUSB Video Class规范
- DATACOM solution
- Anderson J D Jr Computational Fluid Dynamics T
- rtl8188eu_USB_linux.tar.gz
- USB视频采集卡驱动
- 4位和8位,8运算,QUARTUS简易处理器
- QuartusII官方教程-中文版.pdf
- polycom content+ip双流软件
- COMPUTABILITY An introduction to recursive fun
- verilog hdl vhdl实用100个 quartus 2 仿真 源
- win10 USB转串口驱动 PL2303
- DCOM自动配置及OPCClient相关文件
- Building+an+Optimizing+Compiler.pdf
- Performance by Design: Computer Capacity Plann
- ecommerce-data.zip
- USB Type-C™ and Power Delivery DisplayPort A
- 云计算英文版Cloud Computing
- 计算神经学教材 Theoretical Neuroscience
- 各种USB转USART驱动
- A Comprehensive Guide to Digital Electronics a
- js 批量 压缩
- Oviyam-2.7.4开源Web DICOM浏览器
评论
共有 条评论