LM4F用定时器产生PWM如何设置反相
数据手册里面,(TnPWML =1 时)这一位在哪设置,头文件里面没找着对应的函数啊?


nwx8899:
这个函数不是设置初始电平的吗? TimerControlLevel(TIMER0_BASE, TIMER_B,true);
xyz549040622:
回复 nwx8899:
你可以看看函数原型,操作的是什么寄存器呢。WARE开发包中应该有pwm.c文件的。
Maka Luo:
//*****************************************************************************////! Controls the output level.//!//! \param ui32Base is the base address of the timer module.//! \param ui32Timer specifies the timer(s) to adjust; must be one of//! \b TIMER_A, \b TIMER_B, or \b TIMER_BOTH.//! \param bInvert specifies the output level.//!//! This function configures the PWM output level for the specified timer. If//! the \e bInvert parameter is \b true, then the timer's output is made active//! low; otherwise, it is made active high.//!//! \return None.////*****************************************************************************voidTimerControlLevel(uint32_t ui32Base, uint32_t ui32Timer, bool bInvert){ // // Check the arguments. // ASSERT(_TimerBaseValid(ui32Base)); ASSERT((ui32Timer == TIMER_A) || (ui32Timer == TIMER_B) || (ui32Timer == TIMER_BOTH));
// // Set the output levels as requested. // ui32Timer &= TIMER_CTL_TAPWML | TIMER_CTL_TBPWML; HWREG(ui32Base + TIMER_O_CTL) = (bInvert ? (HWREG(ui32Base + TIMER_O_CTL) | ui32Timer) : (HWREG(ui32Base + TIMER_O_CTL) & ~(ui32Timer)));}
TI中文支持网
