Subversion Repositories DevTools

Rev

Blame | Last modification | View Log | RSS feed

//******************************************************************************
//  MSP430x6xx Demo - Software Toggle P1.0
//
//  Description; Toggle P1.0 by xor'ing P1.0 inside of a software loop.
//  ACLK = n/a, MCLK = SMCLK = default DCO
//
//                MSP430x6xx
//             -----------------
//         /|\|              XIN|-
//          | |                 |
//          --|RST          XOUT|-
//            |                 |
//            |             P1.0|-->LED
//
//  M. Pfeiffer
//  Texas Instruments, Inc
//  March 2009
//  Built with CCS for MSP430 Version: 4
//******************************************************************************

#include "msp430f6638.h"

int main(void)
{
  WDTCTL = WDTPW + WDTHOLD;             // Stop watchdog timer
  P1DIR |= 0x01;                        // Set P1.0 to output direction

  for (;;)
  {
    volatile unsigned int i;            // volatile to prevent optimization

    P1OUT ^= 0x01;                      // Toggle P1.0 using exclusive-OR

    i = 10000;                          // SW Delay
    do i--;
    while (i != 0);
  }
}