主题中讨论的其他器件:MSP430FR2633、 MSP430WARE、 MSP430FR2433、 CAPTIVATE-METAL
您好!
我已经尝试在 CapTIvate 开发板中 MSP430FR2633的 P1.1中输出 PWM 信号、但很幸运。
我已经删除了所有与 CapTIvate 相关的代码、并尝试简单地生成 PWM P1.1、但它似乎不起作用。
我正在使用示例代码 msp430fr243x_ta0_16.c - msp430fr243x_ta0_16.c (TI.com) ,我可以在 P1.2中看到漂亮的输出,但 P1.1保持低电平。
我会假定(根据它提供的示例)它应该正常工作、但我不确定 CapTIvate 开发板是否有一些特殊的东西阻止我看到 PWM 信号。
我无法使用 P1.2、因为我计划稍后添加 I2C、而 P1.2用作 SDA。
如果您对获得 P1.1中的输出有任何帮助、我们将不胜感激。
第1页。 我看过这个论坛帖子 :CAPTIVATE-FR2633:生成 PWM 信号- MSP 低功耗微控制器论坛- MSP 低功耗微控制器- TI E2E 支持论坛 、但这没有回答我的问题、因为我已经可以看到 P1.2中的 PWM 输出了。
PS2。 附加我正在使用的示例代码。
/* --COPYRIGHT--,BSD_EX * Copyright (c) 2014, 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. * ******************************************************************************* * * MSP430 CODE EXAMPLE DISCLAIMER * * MSP430 code examples are self-contained low-level programs that typically * demonstrate a single peripheral function or device feature in a highly * concise manner. For this the code may rely on the device's power-on default * register values and settings such as the clock configuration and care must * be taken when combining code from several examples to avoid potential side * effects. Also see www.ti.com/grace for a GUI- and www.ti.com/msp430ware * for an API functional library-approach to peripheral configuration. * * --/COPYRIGHT--*///*******************************************************************************// MSP430FR24xx Demo - Timer0_A3, PWM TA0.1-2, Up Mode, DCO SMCLK//// Description: This program generates two PWM outputs on P1.1,P1.2 using// Timer0_A configured for up mode. The value in CCR0, 1000-1, defines the PWM// period and the values in CCR1 and CCR2 the PWM duty cycles. Using ~1MHz// SMCLK as TACLK, the timer period is ~1ms with a 75% duty cycle on P1.1// and 25% on P1.2.// ACLK = default REFO ~32768Hz, MCLK = SMCLK = default DCODIV ~1MHz////// MSP430FR2433// ---------------// /|\| |// | | |// --|RST |// | |// | P1.1/TA0.1|--> CCR1 - 75% PWM// | P1.2/TA0.2|--> CCR2 - 25% PWM////// Wei Zhao// Texas Instruments Inc.// Jan 2014// Built with IAR Embedded Workbench v6.20 & Code Composer Studio v6.0.1//******************************************************************************#include <msp430.h>
int main(void){ WDTCTL = WDTPW | WDTHOLD; // Stop WDT
P1DIR |= BIT1 | BIT2; // P1.1 and P1.2 output P1SEL1 |= BIT1 | BIT2; // P1.1 and P1.2 options select // Disable the GPIO power-on default high-impedance mode to activate // previously configured port settings PM5CTL0 &= ~LOCKLPM5;
TA0CCR0 = 1000-1; // PWM Period TA0CCTL1 = OUTMOD_7; // CCR1 reset/set TA0CCR1 = 750; // CCR1 PWM duty cycle TA0CCTL2 = OUTMOD_7; // CCR2 reset/set TA0CCR2 = 250; // CCR2 PWM duty cycle TA0CTL = TASSEL__SMCLK | MC__UP | TACLR; // SMCLK, up mode, clear TAR
__bis_SR_register(LPM0_bits); // Enter LPM0 __no_operation(); // For debugger}



