完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
电子发烧友论坛|
|
|
相关推荐
6 个讨论
|
|
Evawang 发表于 2018-8-16 07:47 还有一个问题 就是EK-TM4C123GXL 火箭板上的PB6和PD0是通过一个电感直接连上了 PB7和PD1也是一样的情况,这样两个IO口就短路了,这样设计是为什么呢? |
|
|
|
|
|
|
|
|
GPIOPinConfigure(GPIO_PB6_M0PWM0); //#define GPIO_PB6_M0PWM0 0x00011804 GPIOPinConfigure(GPIO_PB7_M0PWM1); //#define GPIO_PB7_M0PWM1 0x00011C04 这句代码是什么意思呢 如果我要换成其他的IO输出Pwm,也需要这样配置吗?如果是,那地址又该定义成多少呢? |
|
|
|
|
|
|
|
iujwers 发表于 2018-8-16 08:30 就拿第一个来说,这个代码是配置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 //! pin_map.h. The b PART_ //! 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. // //***************************************************************************** void GPIOPinConfigure(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)); ] |
|
|
|
|
|
|
|
只有小组成员才能发言,加入小组>>
590 浏览 0 评论
1645 浏览 0 评论
2084 浏览 0 评论
为啥BQ7693003DBTR芯片在和BQ769X0盒子通讯时收不到信号?
1537 浏览 0 评论
DSP 28027F 开发板 XDS100v2调试探针诊断日志显示了 Error -150 (SC_ERR_FTDI_FAIL)如何解决
1376 浏览 0 评论
AT32F407在USART2 DMA发送数据时,接包接到了要发送的数据,程序还是处于等待传输完成的标识判断中,为什么?
1788浏览 29评论
2816浏览 23评论
请问下tpa3220实际测试引脚功能和官方资料不符,哪位大佬可以帮忙解答下
1746浏览 20评论
请教下关于TAS5825PEVM评估模块原理图中不太明白的地方,寻求答疑
1662浏览 14评论
两个TMP117传感器一个可以正常读取温度值,一个读取的值一直是0,为什么?
1676浏览 13评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-12 06:52 , Processed in 0.574215 second(s), Total 50, Slave 43 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
7584