TI E2E 英文论坛海量技术问答的中文版全新上线,可点击相关论坛查看,或在站内搜索 “参考译文” 获取。

This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2530同时驱动多路PWM问题

Other Parts Discussed in Thread: Z-STACK

1.参考C:\Texas Instruments\Z-Stack Lighting 1.0.2\Components\hal\target\CC2530PMP4712例程里的hal_timer.h和hal_timer.c文件(这两个文件没任何修改)

测试发现只有P0.6脚才能输出PWM,配置如下

#define INIT_PWM_PINS() 

PERCFG |= 0x40; 
P0SEL |= 0x40; 
P0DIR |= 0x40; 
}
#define PWM1 HAL_T1_CH4 //P0.6

HalTimer1Init(0);//初始化定时器
halTimer1SetChannelDuty (PWM1,500);//占空比50%

此时正常输出50%占空比方波

2.当想要设置P0.3和P0.4两路同时输出PWM时,发现没有任何波形,配置如下

P0.3和P0.4其他地方也没用啊

#define INIT_PWM_PINS() 

PERCFG &= ~0x40; 
P0SEL |= (0x08|0x10); 
P0DIR |= (0x08|0x10); 
}
#define PWM1 HAL_T1_CH1//P0.3
#define PWM2 HAL_T1_CH2//P0.4

HalTimer1Init(0);//初始化定时器
halTimer1SetChannelDuty (PWM1,500);//占空比50%