TA的每日心情 | 奋斗 2024-3-28 18:39 |
---|
签到天数: 1 天 [LV.1]初来乍到
注册会员
- 积分
- 51
|
使用的芯片是STC8A8K64D4
我设置了PWM15_PWM6_SW(PWM15_SW_P6); 切换PWM的6通道通过P6的引脚输出,但是P6.6没输出,还是P2.6在输出,这句话貌似配置了并没用
附上PWM的初始化函数
void PWM15bit_init(void)
{
PWM15_InitTypeDef PWM15_InitStructure;
PWM15_InitStructure.PWM_Enable = ENABLE; //PWM使能, ENABLE,DISABLE
PWM15_InitStructure.PWM_Period = 0x1000; //PWM周期, 0~0x7fff
PWM15_InitStructure.PWM_Clock_Sel = PWM_CLK_SYS; //时钟源选择, PWM_CLK_SYS, PWM_CLK_TM2
PWM15_InitStructure.PWM_Clock_PS = 15; //系统时钟分频参数(PS+1分频), 0~15
PWM15_InitStructure.PWM_CInt = DISABLE; //计数器归零中断使能, ENABLE, DISABLE
PWM15_InitStructure.PWM_Counter = ENABLE; //计数器使能, ENABLE, DISABLE
PWM15_Init(&PWM15_InitStructure);
PWM15Duty(PWM15_6,0x0000,0x0400); //PWM_ID, 输出低电平位置, 输出高电平位置
PWMChannelCtrl(PWM15_6,ENABLE,0,DISABLE,DISABLE,DISABLE); //PWM_ID, 输出使能, 初始电平, PWM中断, 第二个触发点中断, 第一触发点中断
}
|
|