TI中文支持网
TI专业的中文技术问题搜集分享网站

TM4C123G怎样配置adc为单端 或者为差分采样呢?

   ADCSequenceStepConfigure(ADC0_BASE,2,1,ADC_CTL_CH1 | ADC_CTL_IE | ADC_CTL_END );

不知道具体怎么配置的 请TI技术讲解一下,万分感谢!

user4064792:

另外 如果使用VREFP 外接参考电压,具体是在哪个引脚呢?

user4064792:

回复 Michael Sun:

还有一个问题   就是EK-TM4C123GXL 火箭板上的PB6和PD0是通过一个电感直接连上了    PB7和PD1也是一样的情况,这样两个IO口就短路了,这样设计是为什么呢?

user4064792:

回复 Michael Sun:

GPIOPinConfigure(GPIO_PB6_M0PWM0); //#define GPIO_PB6_M0PWM0 0x00011804 GPIOPinConfigure(GPIO_PB7_M0PWM1); //#define GPIO_PB7_M0PWM1 0x00011C04

这句代码是什么意思呢     如果我要换成其他的IO输出Pwm,也需要这样配置吗?如果是,那地址又该定义成多少呢?

Michael Sun:

回复 user4064792:

就拿第一个来说,这个代码是配置PB6口的功能为M0的PWM0输出功能。

换成其他IO也可以,前提是这个IO支持PWM输出。这个值并不是地址,其实是一系列寄存器的值。详细的寄存器的配置过程请结合GPIOPinConfigure的源码进行分析:

//*****************************************************************************////! Configures the alternate function of a GPIO pin.//!//! \param ui32PinConfig is the pin configuration value, specified as only one//! of the \b GPIO_P??_??? values.//!//! This function configures the pin mux that selects the peripheral function//! associated with a particular GPIO pin. Only one peripheral function at a//! time can be associated with a GPIO pin, and each peripheral function should//! only be associated with a single GPIO pin at a time (despite the fact that//! many of them can be associated with more than one GPIO pin). To fully//! configure a pin, a GPIOPinType*() function should also be called.//!//! The available mappings are supplied on a per-device basis in//! <tt>pin_map.h</tt>. The \b PART_<partno> defines controls which set of//! defines are included so that they match the device that is being used.//! For example, \b PART_TM4C129XNCZAD must be defined in order to get the//! correct pin mappings for the TM4C129XNCZAD device.//!//! \note If the same signal is assigned to two different GPIO port//! pins, the signal is assigned to the port with the lowest letter and the//! assignment to the higher letter port is ignored.//!//! \return None.////*****************************************************************************voidGPIOPinConfigure(uint32_t ui32PinConfig){ uint32_t ui32Base, ui32Shift;

// // Check the argument. // ASSERT(((ui32PinConfig >> 16) & 0xff) < 15); ASSERT(((ui32PinConfig >> 8) & 0xe3) == 0);

// // Extract the base address index from the input value. // ui32Base = (ui32PinConfig >> 16) & 0xff;

// // Get the base address of the GPIO module, selecting either the APB or the // AHB aperture as appropriate. // if(HWREG(SYSCTL_GPIOHBCTL) & (1 << ui32Base)) { ui32Base = g_pui32GPIOBaseAddrs[(ui32Base << 1) + 1]; } else { ui32Base = g_pui32GPIOBaseAddrs[ui32Base << 1]; }

// // Extract the shift from the input value. // ui32Shift = (ui32PinConfig >> 8) & 0xff;

// // Write the requested pin muxing value for this GPIO pin. // HWREG(ui32Base + GPIO_O_PCTL) = ((HWREG(ui32Base + GPIO_O_PCTL) & ~(0xf << ui32Shift)) | ((ui32PinConfig & 0xf) << ui32Shift));}

赞(0)
未经允许不得转载:TI中文支持网 » TM4C123G怎样配置adc为单端 或者为差分采样呢?
分享到: 更多 (0)