This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
在Proteus仿真中,同时使P1和P2一共16个I/O口输出,P1.4始终无法输出高电平!
#include "msp430G2553.h"
void main( )
{
WDTCTL = WDTPW + WDTHOLD;
P1DIR=0xff;
P2DIR=0xff;
while(1)
{ P1OUT=0XFF;P2OUT=0xFF;}
}
建议您试一下例程
******************************************************************************* * * 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--*/ //****************************************************************************** // MSP430G2xx3 Demo - Software Poll P1.4, Set P1.0 if P1.4 = 1 // // Description: Poll P1.4 in a loop, if hi P1.0 is set, if low, P1.0 reset. // ACLK = n/a, MCLK = SMCLK = default DCO // // MSP430G2xx3 // ----------------- // /|\| XIN|- // | | | // --|RST XOUT|- // /|\ | | // --o--|P1.4 P1.0|-->LED // \|/ // // D. Dang // Texas Instruments, Inc // December 2010 // Built with CCS Version 4.2.0 and IAR Embedded Workbench Version: 5.10 //****************************************************************************** #include <msp430.h> int main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer P1DIR |= 0x01; // Set P1.0 to output direction while (1) // Test P1.4 { if ((0x10 & P1IN)) P1OUT |= 0x01; // if P1.4 set, set P1.0 else P1OUT &= ~0x01; // else reset } }