-
不同周期相同占空比的PWM波形 赏100家园币
[i=s] 本帖最后由 CHAIBIN 于 2024-9-13 20:56 编辑 [/i] 如何让使用HC32L110芯片发一个连续脉宽380us、320us、280us,占空比50%,即380us的3个周期、320us的3个周期、280us的3个周期,一直循环发
4424浏览量 5回复量 关注量 -
TL494制作BOOST升压电路时占空比增大一点后不变
[i=s] 本帖最后由 wzy521 于 2024-7-22 21:05 编辑 [/i] [url=/data/attachment/album/202407/22/210116o5753yly7usxmb5b.png][img]/data/attachment/album/202407/22/210116o5753yly7usxmb5b.png[/img][/url] 如上图:用TL494设计一个异步BOOST电路,过流保护为8.3A左右,过压保护在48V左右,空载占空比在5%左右, 1、2脚用来检测过流,15、16用来检测过压;目前出现的问题是:当负载在4A左右时,占空比在35%左右,当负 载继续加大时,占空比不随着负载加大而增大,而输出48V却随着负载增加而降低。看规格书是占空比可以达到 91%上下,我这个实测相差太大,想请教一下:如何做可以继续让占空比随着负载增大而增大?没有币了[img]https://bbs.21ic.com/static/image/smiley/comcom/9.gif[/img]实 在抱歉!!!
11483浏览量 8回复量 关注量 -
CW32 的高级时钟如何同时独立控制6路的占空比 sos
刚接触这个芯片,这一个问题搞了两天的,真的不友好,连个寄存器手册也没!!!!CW32 的高级时钟如何同时控制6路pwm,并且能够独立控制6路的占空比?
889浏览量 0回复量 关注量 -
请教一下STC12H1K输出PWM的问题 sos
[i=s] 本帖最后由 chenczyaa 于 2024-7-3 08:49 编辑 [/i] 代码如下,我的P3.5脚 没PWM输出的,好奇怪。void pwm_init() { CCON = 0x00; // CL = 0; //PCA计数器 低8位 CH = 0; //PCA计数器 高8位 CMOD = 0x00; //选择时钟源为系统时钟源的1/12 CCAPM0 = 0x42; //0100 0010 允许比较器,允许PWM0引脚输出 //PCA_PWM0=0x00; //8位PWM PCA_PWM0=0x40; //7位PWM CCAP0H = CCAP0L = 0x00; //设置占空比为 0 PWMA_PS = 0xff; PWMB_PS = 0xf3;//P3.5输出PWM CR = 1; //启动 PCA 计数器阵列 } main() { uchar key1up=0,key2up=0,gear1=0,gear2=0; /* TMOD =0x00; //0模式16位自动重装载 TL0=0x66; //1ms初值 TH0=0xfc; TR0=1;// 启动定时器0 ET0=1;// 开启定时器0中断 EA=1;// 开启整个中断系统 */ P1M0=0x00;//设置P1为准双向口 P1M1=0x00; P3M0=0x00;//设置P3为准双向口 P3M1=0x00; //P1=0xff; //P35=0; pwm_init(); //PCA_PWM0=0x02;CCAP0H= CCAP0L=0xFF; //固定输出低 //PCA_PWM0=0x00;CCAP0H= CCAP0L=0x00; //固定输出高 //CCAP0L=0x20;//PWM占空比(100H-20H)/100H(87.5%)//8位PWM //CCAP0H=0x20; CR = 0; //CCAP0L=0xCC;//PWM占空比(100H-CCH)/100H(20%)//8位PWM //CCAP0H=0xCC; CCAP0L=0x20;//PWM占空比(80H-20H)/80H(75%)//7位PWM CCAP0H=0x20; CR = 1; P34=0; while(1) { delay(4000); P34 = ~P34; } }
859浏览量 0回复量 关注量 -
MM32G0001A 2个Timer各出1PWM 设置占空比不同 实际结果确一样
MM32G0001A 使用两个定时器 TIM14和TIM3 各出一路PWM 设置不一样的占空比 但是实际结果确一样 哪里设置有问题吗? void TIM3_Configure(void) { GPIO_InitTypeDef GPIO_InitStruct; TIM_OCInitTypeDef TIM_OCInitStruct; TIM_TimeBaseInitTypeDef TIM_TimeBaseStruct; /* Compute the value to be set in ARR regiter to generate signal frequency at 100 Khz */ uint32_t TimerPeriod = (TIM_GetTIMxClock(TIM3) / 5000 ) - 1; /* Compute CCR1 value to generate a duty cycle at 80% for channel 1 */ uint32_t Channel1Pulse = ((uint32_t)800 * (TimerPeriod - 1)) / 1000; RCC_APB1PeriphClockCmd(RCC_APB1ENR_TIM3, ENABLE); TIM_TimeBaseStructInit(&TIM_TimeBaseStruct); TIM_TimeBaseStruct.TIM_Prescaler = 0; TIM_TimeBaseStruct.TIM_CounterMode = TIM_CounterMode_Up; TIM_TimeBaseStruct.TIM_Period = TimerPeriod; TIM_TimeBaseStruct.TIM_ClockDivision = TIM_CKD_Div1; TIM_TimeBaseStruct.TIM_RepetitionCounter = 0; TIM_TimeBaseInit(TIM3, &TIM_TimeBaseStruct); TIM_OCStructInit(&TIM_OCInitStruct); TIM_OCInitStruct.TIM_OCMode = TIM_OCMode_PWM1; TIM_OCInitStruct.TIM_OutputState = TIM_OutputState_Enable; TIM_OCInitStruct.TIM_Pulse = 0; TIM_OCInitStruct.TIM_OCPolarity = TIM_OCPolarity_High; TIM_OCInitStruct.TIM_OCIdleState = TIM_OCIdleState_Set; TIM_OCInitStruct.TIM_Pulse = Channel1Pulse; TIM_OC1Init(TIM3, &TIM_OCInitStruct); RCC_AHBPeriphClockCmd(RCC_AHBENR_GPIOA, ENABLE); GPIO_PinAFConfig(GPIOA, GPIO_PinSource11, GPIO_AF_3); /* TIM1_CH1 */ GPIO_StructInit(&GPIO_InitStruct); GPIO_InitStruct.GPIO_Pin = GPIO_Pin_11; GPIO_InitStruct.GPIO_Speed = GPIO_Speed_High; GPIO_InitStruct.GPIO_Mode = GPIO_Mode_AF_PP; GPIO_Init(GPIOA, &GPIO_InitStruct); TIM_Cmd(TIM3, ENABLE); TIM_CtrlPWMOutputs(TIM3, ENABLE); } /*********************************************************************************************************************** * @brief * [url=home.php?mod=space&uid=536309]@NOTE[/url] none * @param none * @retval none *********************************************************************************************************************/ void TIM14_Configure(void) { GPIO_InitTypeDef GPIO_InitStruct; TIM_OCInitTypeDef TIM_OCInitStruct; TIM_TimeBaseInitTypeDef TIM_TimeBaseStruct; /* Compute the value to be set in ARR regiter to generate signal frequency at 100 Khz */ uint32_t TimerPeriod = (TIM_GetTIMxClock(TIM14) / 5000 ) - 1; /* Compute CCR1 value to generate a duty cycle at 80% for channel 1 */ uint32_t Channel1Pulse = ((uint32_t)500 * (TimerPeriod - 1)) / 1000; RCC_APB1PeriphClockCmd(RCC_APB1ENR_TIM14, ENABLE); TIM_TimeBaseStructInit(&TIM_TimeBaseStruct); TIM_TimeBaseStruct.TIM_Prescaler = 0; TIM_TimeBaseStruct.TIM_CounterMode = TIM_CounterMode_Up; TIM_TimeBaseStruct.TIM_Period = TimerPeriod; TIM_TimeBaseStruct.TIM_ClockDivision = TIM_CKD_Div1; TIM_TimeBaseStruct.TIM_RepetitionCounter = 0; TIM_TimeBaseInit(TIM14, &TIM_TimeBaseStruct); TIM_OCStructInit(&TIM_OCInitStruct); TIM_OCInitStruct.TIM_OCMode = TIM_OCMode_PWM1; TIM_OCInitStruct.TIM_OutputState = TIM_OutputState_Enable; TIM_OCInitStruct.TIM_Pulse = 0; TIM_OCInitStruct.TIM_OCPolarity = TIM_OCPolarity_High; TIM_OCInitStruct.TIM_OCIdleState = TIM_OCIdleState_Set; TIM_OCInitStruct.TIM_Pulse = Channel1Pulse; TIM_OC1Init(TIM14, &TIM_OCInitStruct); RCC_AHBPeriphClockCmd(RCC_AHBENR_GPIOA, ENABLE); GPIO_PinAFConfig(GPIOA, GPIO_PinSource9, GPIO_AF_3); /* TIM1_CH1 */ GPIO_StructInit(&GPIO_InitStruct); GPIO_InitStruct.GPIO_Pin = GPIO_Pin_9; GPIO_InitStruct.GPIO_Speed = GPIO_Speed_High; GPIO_InitStruct.GPIO_Mode = GPIO_Mode_AF_PP; GPIO_Init(GPIOA, &GPIO_InitStruct); TIM_Cmd(TIM14, ENABLE); TIM_CtrlPWMOutputs(TIM14, ENABLE); }
1094浏览量 1回复量 关注量