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

MSP432P401R的TA1.0或TA2.0之类的引脚如何配置PWM引脚操作舵机的机械臂

MSP432P401R的TA1.0或TA2.0之类的引脚如何配置PWM引脚操作舵机的机械臂,可以使用PWM功能的引脚及占用情况如下,想问一下YTA0.0、TA1.0的引脚可以操作PWM舵机吗?如何配置,没有多余的引脚了,需要3路PWM,端口映射也找不到合适的。

Susan Yang:

您可以使用在线工具pinmux来设置端口映射

dev.ti.com/…/app.html

user5355349:

回复 Susan Yang:

都找过了,想知道一下TA0.0 TA1.0 TA2.0的引脚能用来配置pwm吗?我发现带码中要跟同一组的0.0,1.0,2.0的作比较。

Susan Yang:

回复 user5355349:

我又看了一下

表6-44列出了可通过端口映射控制器访问的外设引脚。第6.9.2.1节提到端口P2,P3和P7可用于映射

P2.0-7
P3.0-7
P7.0-7

这些引脚是可以的

PM_TA0.0可以,但TA1.0 TA2.0不可以

Susan Yang:

相关例程您可以参考

http://dev.ti.com/tirex/explore/node?node=APAOZq40W2CyGVgJMMsEMA__z-lQYNj__LATEST  

/* --COPYRIGHT--,BSD* Copyright (c) 2017, Texas Instruments Incorporated* All rights reserved.** Redistribution and use in source and binary forms, with or without* modification, are permitted provided that the following conditions* are met:** *Redistributions of source code must retain the above copyright*notice, this list of conditions and the following disclaimer.** *Redistributions in binary form must reproduce the above copyright*notice, this list of conditions and the following disclaimer in the*documentation and/or other materials provided with the distribution.** *Neither the name of Texas Instruments Incorporated nor the names of*its contributors may be used to endorse or promote products derived*from this software without specific prior written permission.** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.* --/COPYRIGHT--*/
/******************************************************************************** MSP432 Port Mapper - Remapping Timer_A CCR** Description: This program generates a PWM output on P2.4 using the port* mapper to internally redirect the CCR0 output of Timer A1 to P2.4 (it* is originally P7.7). After the port mapping function is called, the timer* is setup normally with a 75% duty cycle. The output of the timer can be* seen on P2.4 using a probe/debugger.**MSP432P401*-------------------*/|\||*| ||*--|RST|*||*|P2.4|--> CCR1 - 75% PWM*||********************************************************************************/
/* DriverLib Includes */
#include <ti/devices/msp432p4xx/driverlib/driverlib.h>/* Standard Includes */
#include <stdint.h>
#include <stdbool.h>//![Simple PMAP Config]
/* Port mapper configuration register */
const uint8_t port_mapping[] =
{//Port P2:PMAP_NONE, PMAP_NONE, PMAP_NONE, PMAP_NONE, PMAP_TA1CCR1A, PMAP_NONE,PMAP_NONE, PMAP_NONE
};
//![Simple PMAP Config]/* Timer_A UpDown Configuration Parameter */
const Timer_A_UpDownModeConfig upDownConfig =
{TIMER_A_CLOCKSOURCE_SMCLK,// SMCLK Clock SOurceTIMER_A_CLOCKSOURCE_DIVIDER_1,// SMCLK/1 = 3MHz127,// 127 tick periodTIMER_A_TAIE_INTERRUPT_DISABLE,// Disable Timer interruptTIMER_A_CCIE_CCR0_INTERRUPT_DISABLE,// Disable CCR0 interruptTIMER_A_DO_CLEAR// Clear value};/* Timer_A Compare Configuration Parameter(PWM1) */
const Timer_A_CompareModeConfig compareConfig_PWM1 =
{TIMER_A_CAPTURECOMPARE_REGISTER_1,// Use CCR1TIMER_A_CAPTURECOMPARE_INTERRUPT_DISABLE,// Disable CCR interruptTIMER_A_OUTPUTMODE_TOGGLE_SET,// Toggle output but32// 32 Duty Cycle
};int main(void)
{MAP_WDT_A_holdTimer();//![Simple PMAP Example]/* RemappingTACCR0 to P2.4 */MAP_PMAP_configurePorts((const uint8_t *) port_mapping, PMAP_P2MAP, 1,PMAP_DISABLE_RECONFIGURATION);//![Simple PMAP Example]MAP_GPIO_setAsPeripheralModuleFunctionOutputPin(GPIO_PORT_P2,GPIO_PIN4, GPIO_PRIMARY_MODULE_FUNCTION);/* Initialize compare registers to generate PWM1 */MAP_Timer_A_initCompare(TIMER_A1_BASE, &compareConfig_PWM1);/* Configuring Timer_A1 for UpDown Mode and starting */MAP_Timer_A_configureUpDownMode(TIMER_A1_BASE, &upDownConfig);MAP_Timer_A_startCounter(TIMER_A1_BASE, TIMER_A_UPDOWN_MODE);while (1){MAP_PCM_gotoLPM0();}
}

user5355349:

回复 Susan Yang:

如何配置TA0.0  TA1.0之类的,上图中1.2和1.0都配置了分别为周期和占空比·,如果配置1.0,周期选哪个?

Susan Yang:

回复 user5355349:

TA1.0是P8.0,是不可以使用pwm的,只有

P2.0-7
P3.0-7
P7.0-7

这些引脚是可以的

关于PWM的详细使用,您也可以参考

dev.ti.com/…/MSP432_DriverLib_Users_Guide-MSP432P4xx-3_10_00_09.pdf

24 16-Bit Timer with Precision PWM (Timer_A)

灰小子:

回复 user5355349:

这种需要外接多个舵机的情况,建议外扩一个pwm扩展板。会更方便一些。

赞(0)
未经允许不得转载:TI中文支持网 » MSP432P401R的TA1.0或TA2.0之类的引脚如何配置PWM引脚操作舵机的机械臂
分享到: 更多 (0)