本文目录一览

1,STM32处理器利用tim定时器输出pwm时最多可输出多少路不同占

每定时器四路,绝对相同

STM32处理器利用tim定时器输出pwm时最多可输出多少路不同占

2,STM32F103ZET6总共可以同时使用多少路PWM

pwm方案如果频率和精度要求不高可以定时器软实现,硬实现基本就是一定时器4路,你找5个定时器以上的就行,ZE有6个肯定没问题,另外你还要看手册这些输出是不是有复用管脚,这得看你封装.

STM32F103ZET6总共可以同时使用多少路PWM

3,STM32F103C8T6 LQFP48 最多可做出多少路PWM输出

类别:集成电路(IC) 家庭:嵌入式-微控制器 芯体尺寸:32-位 速度:72MHz 外围设备:DMA,电机控制PWM,PWM,温度传感器 输入/输出数:37 程序存储器容量:64KB (64K x 8) 程序存储器类型:FLASH RAM容量:20K x 8 电压-电源(Vcc/Vdd)
看你pwm要求高不高,10khz左右用定时器+io也可以的.要求高比如调整精度频率高那就是定时器pwm输出了,具体手册上有.

STM32F103C8T6 LQFP48 最多可做出多少路PWM输出

4,有谁用过STM32的一个普通定时器产生4路频率可调的PWM

STM32F103系列的芯片每个定时器(基本定时器TIM6和TIM7除外)都有4个通道,每个通道都能产生4路PWM,1路和4路区别不大,你把1路的初始化部分的代码在通道代码的基础上复制另外几个通道的初始化函数就可以了,其余的没有任何区别。
void tim2_pwm_out_conf(void) rcc->apb1enr |=1<<0; //tim2 clock rcc->apb2enr |=1<<2; //gpa clock rcc->apb2enr |=1<<0; //afio clock rcc->apb2enr |=1<<3; //gpb clock rcc->apb1enr |=7<<0; //tim2 tim3 tim4 clock gpioa->crl &=0xffff0000; // gpioa->crl |=0x0000bbbb; //af-out tim2->cr1 |=1<<4; //count down tim2->ccmr1 |=6<<4; //oc1m:pwm1 tim2->ccmr1 |=6<<12; //oc2m:pwm1 tim2->ccmr2 |=6<<4; //oc3m:pwm1 tim2->ccmr2 |=6<<12; //oc4m:pwm1 // tim2->ccmr1 |=1<<2; // tim2->ccmr2 |=1<<10; // tim2->ccmr1 |=1<<2; // tim2->ccmr2 |=1<<10; tim2->ccer |=1<<0; //cc1e enable tim2->ccer |=1<<4; //cc2e enable tim2->ccer |=1<<8; //cc3e enable tim2->ccer |=1<<12; //cc4e enable tim2->psc =719; //720-1 psc tim2->arr =pwm_period; //20ms tim2->cr1 |=1<<0; //enable } //ccr 寄存器修改占空比

5,stm32 pwm输入捕捉模式同时用多路吗

可以的,各路的IC/OC功能时独立的。
我自己用的24路,贴不上来,就贴前面两个,其他的照着写就行。 #include "pwm.h" void timer1pwminit(void) { gpio_inittypedef gpio_initstructure; tim_timebaseinittypedef tim_timebasestructure; tim_ocinittypedef tim_ocinitstructure; // rcc_apb2periphclockcmd(rcc_apb2periph_tim1, enable); rcc_apb2periphclockcmd(rcc_apb2periph_gpiob | rcc_apb2periph_afio, enable); //使能gpio外设和afio复用功能模块时钟 rcc_apb2periphclockcmd(rcc_apb2periph_tim1, enable); gpio_initstructure.gpio_pin = gpio_pin_15; gpio_initstructure.gpio_mode = gpio_mode_af_pp; gpio_initstructure.gpio_speed = gpio_speed_50mhz; gpio_init(gpiob, &gpio_initstructure); tim_timebasestructure.tim_period = pwm_period;// tim_timebasestructure.tim_prescaler = precalers;// tim_timebasestructure.tim_clockdivision = 0; tim_timebasestructure.tim_repetitioncounter = 0x0000; tim_timebasestructure.tim_countermode = tim_countermode_up; tim_timebaseinit(tim1, &tim_timebasestructure); tim_ocinitstructure.tim_ocmode = tim_ocmode_pwm2; tim_ocinitstructure.tim_outputstate= tim_outputstate_disable;//只输出互补 tim_ocinitstructure.tim_outputnstate = tim_outputnstate_enable; tim_ocinitstructure.tim_pulse = 0;//ccr tim_ocinitstructure.tim_ocpolarity = tim_ocpolarity_low; tim_ocinitstructure.tim_ocnpolarity= tim_ocnpolarity_low; tim_ocinitstructure.tim_ocidlestate= tim_ocidlestate_set; tim_ocinitstructure.tim_ocnidlestate = tim_ocidlestate_reset; tim_oc3init(tim1, &tim_ocinitstructure);//ch3n pb15 tim_oc3preloadconfig(tim1, tim_ocpreload_enable); tim_arrpreloadconfig(tim1, disable); //预装载寄存器的内容被立即传送到影子寄存器 // tim_arrpreloadconfig(tim1, enable); tim_cmd(tim1, enable); tim_ctrlpwmoutputs(tim1, enable); } //void setled5_w(u16 val) //{ // tim1->ccr1 = val; //} //void setled5_b(u16 val) //{ // tim1->ccr2 = val; //} //void setled5_g(u16 val) //{ // tim1->ccr3 = val; //} //void setled5_r(u16 val) //{ // tim1->ccr4 = val; //} void setpwm4(u16 val) { tim1->ccr3 = val; } //void timer2pwminit(void) //{ // gpio_inittypedef gpio_initstructure; // tim_timebaseinittypedef tim_timebasestructure; // tim_ocinittypedef tim_ocinitstructure; // // rcc_apb1periphclockcmd(rcc_apb1periph_tim2, enable); // rcc_apb2periphclockcmd(rcc_apb2periph_gpioa|rcc_apb2periph_gpiob |rcc_apb2periph_afio, enable); //使能gpio外设和afio复用功能模块时钟 // afio->mapr&=0xf8ffffff; // afio->mapr|=0x04000000; // // gpio_pinremapconfig(gpio_fullremap_tim2, enable); //timer2完全重映射 // // gpio_initstructure.gpio_pin = gpio_pin_15; // gpio_initstructure.gpio_mode = gpio_mode_af_pp; //复用推挽输出 // gpio_initstructure.gpio_speed = gpio_speed_50mhz; // gpio_init(gpioa, &gpio_initstructure);//初始化gpio // // gpio_initstructure.gpio_pin = gpio_pin_3|gpio_pin_10|gpio_pin_11; // gpio_initstructure.gpio_mode = gpio_mode_af_pp; //复用推挽输出 // gpio_initstructure.gpio_speed = gpio_speed_50mhz; // gpio_init(gpiob, &gpio_initstructure);//初始化gpio // // //初始化tim2 // tim_timebasestructure.tim_period = pwm_period; // tim_timebasestructure.tim_prescaler =precalers; // tim_timebasestructure.tim_clockdivision = 0; //设置时钟分割:tdts = tck_tim // tim_timebasestructure.tim_countermode = tim_countermode_up; //tim向上计数模式 // tim_timebaseinit(tim2, &tim_timebasestructure); // // //初始化tim2 channel pwm模式 // tim_ocinitstructure.tim_ocmode = tim_ocmode_pwm1; // tim_ocinitstructure.tim_outputstate = tim_outputstate_enable; //比较输出使能 // tim_ocinitstructure.tim_pulse = 0;//tim->ccr = 0 // tim_ocinitstructure.tim_ocpolarity = tim_ocpolarity_high; // // // tim_oc1init(tim2, &tim_ocinitstructure); // tim_oc1preloadconfig(tim2, tim_ocpreload_enable); //使能tim2在ccr1上的预装载寄存器 // // tim_oc2init(tim2, &tim_ocinitstructure); // tim_oc2preloadconfig(tim2, tim_ocpreload_enable); // // tim_oc3init(tim2, &tim_ocinitstructure); // tim_oc3preloadconfig(tim2, tim_ocpreload_enable); // // tim_oc4init(tim2, &tim_ocinitstructure); // tim_oc4preloadconfig(tim2, tim_ocpreload_enable); // // tim_arrpreloadconfig(tim2, enable); // tim_cmd(tim2, enable); //使能tim2 //} //void setled2_r(u16 val) //{ // tim2->ccr4 = val; //} //void setled2_g(u16 val) //{ // tim2->ccr3 = val; //} //void setled2_b(u16 val) //{ // tim2->ccr2 = val; //} //void setled2_w(u16 val) //{ // tim2->ccr1 = val; //}

文章TAG:stm32f405多少  stm32  处理  
下一篇