文件名称:Output-PWM-from-PA0
- 所属分类:
- 单片机(51,AVR,MSP430等)
- 资源属性:
- [C/C++] [源码]
- 上传时间:
- 2012-11-26
- 文件大小:
- 215kb
- 下载次数:
- 0次
- 提 供 者:
- serg*****
- 相关连接:
- 无
- 下载说明:
- 别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容均来自于网络,请自行研究使用
实现从PA.0输出一个占空比可变的PWM波,开发环境:keil uvision4 -extern volatile u16 Pulse
u8 Flag_60ms
int main()
{
RCC_Configuration()
GPIO_Configuration()
TIM_PWMConfiguration()
NVIC_Configuration()
TIM_ToggleConfiguration()
GPIO_SetBits(GPIOA,GPIO_Pin_0)
USART1_Configuration()
SysTick_Configuration()
while(1)
{
if(Flag_60ms == 1)
{
Flag_60ms = 0
TIM2->CCR2= PID_calculate(&Control_left,Pulse)
}
}
}
u8 Flag_60ms
int main()
{
RCC_Configuration()
GPIO_Configuration()
TIM_PWMConfiguration()
NVIC_Configuration()
TIM_ToggleConfiguration()
GPIO_SetBits(GPIOA,GPIO_Pin_0)
USART1_Configuration()
SysTick_Configuration()
while(1)
{
if(Flag_60ms == 1)
{
Flag_60ms = 0
TIM2->CCR2= PID_calculate(&Control_left,Pulse)
}
}
}
(系统自动生成,下载前可以参看下载内容)
下载文件列表
Output PWM from PA0\List\test.plg
...................\Rvmak\PWM_out.opt.bak
...................\.....\PWM_out.Uv2.bak
...................\.....\PWM_out.uvopt
...................\.....\PWM_out.uvproj
...................\.....\PWM_out_Target 1.dep
...................\Src\AD.c
...................\...\AD.h
...................\...\delay.c
...................\...\delay.h
...................\...\GPIO.c
...................\...\GPIO.h
...................\...\INT.c
...................\...\main.c
...................\...\NVIC.c
...................\...\NVIC.h
...................\...\PID.C
...................\...\PID.H
...................\...\RCC.c
...................\...\RCC.h
...................\...\stmlib\core_cm3.c
...................\...\......\core_cm3.h
...................\...\......\misc.c
...................\...\......\misc.h
...................\...\......\StartUp\startup_stm32f10x_hd.s
...................\...\......\.......\startup_stm32f10x_ld.s
...................\...\......\.......\startup_stm32f10x_md.s
...................\...\......\stm32f10x.h
...................\...\......\stm32f10x_adc.c
...................\...\......\stm32f10x_adc.h
...................\...\......\stm32f10x_bkp.c
...................\...\......\stm32f10x_bkp.h
...................\...\......\stm32f10x_can.c
...................\...\......\stm32f10x_can.h
...................\...\......\stm32f10x_conf.h
...................\...\......\stm32f10x_crc.c
...................\...\......\stm32f10x_crc.h
...................\...\......\stm32f10x_dac.c
...................\...\......\stm32f10x_dac.h
...................\...\......\stm32f10x_dbgmcu.c
...................\...\......\stm32f10x_dbgmcu.h
...................\...\......\stm32f10x_dma.c
...................\...\......\stm32f10x_dma.h
...................\...\......\stm32f10x_exti.c
...................\...\......\stm32f10x_exti.h
...................\...\......\stm32f10x_flash.c
...................\...\......\stm32f10x_flash.h
...................\...\......\stm32f10x_fsmc.c
...................\...\......\stm32f10x_fsmc.h
...................\...\......\stm32f10x_gpio.c
...................\...\......\stm32f10x_gpio.h
...................\...\......\stm32f10x_i2c.c
...................\...\......\stm32f10x_i2c.h
...................\...\......\stm32f10x_iwdg.c
...................\...\......\stm32f10x_iwdg.h
...................\...\......\stm32f10x_pwr.c
...................\...\......\stm32f10x_pwr.h
...................\...\......\stm32f10x_rcc.c
...................\...\......\stm32f10x_rcc.h
...................\...\......\stm32f10x_rtc.c
...................\...\......\stm32f10x_rtc.h
...................\...\......\stm32f10x_sdio.c
...................\...\......\stm32f10x_sdio.h
...................\...\......\stm32f10x_spi.c
...................\...\......\stm32f10x_spi.h
...................\...\......\stm32f10x_tim.c
...................\...\......\stm32f10x_tim.h
...................\...\......\stm32f10x_usart.c
...................\...\......\stm32f10x_usart.h
...................\...\......\stm32f10x_wwdg.c
...................\...\......\stm32f10x_wwdg.h
...................\...\......\system_stm32f10x.c
...................\...\......\system_stm32f10x.h
...................\...\SysTick.c
...................\...\SysTick.h
...................\...\TIM.c
...................\...\TIM.h
...................\...\USART.c
...................\...\USART.h
...................\...\stmlib\StartUp
...................\...\stmlib
...................\List
...................\Rvmak
...................\Src
Output PWM from PA0
...................\Rvmak\PWM_out.opt.bak
...................\.....\PWM_out.Uv2.bak
...................\.....\PWM_out.uvopt
...................\.....\PWM_out.uvproj
...................\.....\PWM_out_Target 1.dep
...................\Src\AD.c
...................\...\AD.h
...................\...\delay.c
...................\...\delay.h
...................\...\GPIO.c
...................\...\GPIO.h
...................\...\INT.c
...................\...\main.c
...................\...\NVIC.c
...................\...\NVIC.h
...................\...\PID.C
...................\...\PID.H
...................\...\RCC.c
...................\...\RCC.h
...................\...\stmlib\core_cm3.c
...................\...\......\core_cm3.h
...................\...\......\misc.c
...................\...\......\misc.h
...................\...\......\StartUp\startup_stm32f10x_hd.s
...................\...\......\.......\startup_stm32f10x_ld.s
...................\...\......\.......\startup_stm32f10x_md.s
...................\...\......\stm32f10x.h
...................\...\......\stm32f10x_adc.c
...................\...\......\stm32f10x_adc.h
...................\...\......\stm32f10x_bkp.c
...................\...\......\stm32f10x_bkp.h
...................\...\......\stm32f10x_can.c
...................\...\......\stm32f10x_can.h
...................\...\......\stm32f10x_conf.h
...................\...\......\stm32f10x_crc.c
...................\...\......\stm32f10x_crc.h
...................\...\......\stm32f10x_dac.c
...................\...\......\stm32f10x_dac.h
...................\...\......\stm32f10x_dbgmcu.c
...................\...\......\stm32f10x_dbgmcu.h
...................\...\......\stm32f10x_dma.c
...................\...\......\stm32f10x_dma.h
...................\...\......\stm32f10x_exti.c
...................\...\......\stm32f10x_exti.h
...................\...\......\stm32f10x_flash.c
...................\...\......\stm32f10x_flash.h
...................\...\......\stm32f10x_fsmc.c
...................\...\......\stm32f10x_fsmc.h
...................\...\......\stm32f10x_gpio.c
...................\...\......\stm32f10x_gpio.h
...................\...\......\stm32f10x_i2c.c
...................\...\......\stm32f10x_i2c.h
...................\...\......\stm32f10x_iwdg.c
...................\...\......\stm32f10x_iwdg.h
...................\...\......\stm32f10x_pwr.c
...................\...\......\stm32f10x_pwr.h
...................\...\......\stm32f10x_rcc.c
...................\...\......\stm32f10x_rcc.h
...................\...\......\stm32f10x_rtc.c
...................\...\......\stm32f10x_rtc.h
...................\...\......\stm32f10x_sdio.c
...................\...\......\stm32f10x_sdio.h
...................\...\......\stm32f10x_spi.c
...................\...\......\stm32f10x_spi.h
...................\...\......\stm32f10x_tim.c
...................\...\......\stm32f10x_tim.h
...................\...\......\stm32f10x_usart.c
...................\...\......\stm32f10x_usart.h
...................\...\......\stm32f10x_wwdg.c
...................\...\......\stm32f10x_wwdg.h
...................\...\......\system_stm32f10x.c
...................\...\......\system_stm32f10x.h
...................\...\SysTick.c
...................\...\SysTick.h
...................\...\TIM.c
...................\...\TIM.h
...................\...\USART.c
...................\...\USART.h
...................\...\stmlib\StartUp
...................\...\stmlib
...................\List
...................\Rvmak
...................\Src
Output PWM from PA0