CC2541 定时器3 如何在通道0和通道1 产生方向相反的两路脉冲
请问下,我想利用CC2541 定时器3 分别设置它的通道0 和通道1 为方向相反的两路脉冲:
其中程序里 T3CTL 模式设置为Up/down计数,T3CCTL0 模式设置为CMP[011],T3CCTL1 模式设置为CMP[100]
可实际上,只有T3CCTL0 输出正常,T3CCTL1 始终高电平。是否我对寄存器描述的理解有问题?
贴上下面程序所示:
PERCFG |= 0x20; // Timer 3 Alternate location 2
P1DIR |= 0xC0; // P1_6 = output 1.7
P1SEL |= 0xC0; // Peripheral function on P1_6 1.7
T3CTL &= ~0x10; // Stop timer 3 (if it was running)
T3CTL |= 0x04; // Clear timer 3
T3CTL &= ~0x08; // Disable Timer 3 overflow interrupts
T3CTL |= 0x03; // Timer 3 mode = 3 - Up/Down
T3CCTL0 &= ~0x40; // Disable channel 0 interrupts
T3CCTL0 |= 0x04; // Ch0 mode = compare
T3CCTL0 |= 0x18; // Ch0 output compare mode = toggle on compare
T3CCTL1 &= ~0x40; // Disable channel 1 interrupts
T3CCTL1 |= 0x04; // Ch1 mode = compare
T3CCTL1 |= 0x20;
.........
T3CTL &= ~0xE0;
T3CTL |= prescaler;
T3CC0 = (uint8)ticks;
T3CC1 = (uint8)ticks;
// Start timer
T3CTL |= 0x10;
zaizhi,
有没有试过单独的用channel 1进行配置?
或者把channel设置成和channel 0 一样?