Files
Embedded-Systems-Labs/content/dxp_Lab2_c1.c
2018-03-18 00:56:37 -04:00

42 lines
1.3 KiB
C

//******************************************************************************
// MSP430x1xx 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
//
// MSP430x1xx
// -----------------
// /|\| XIN|-
// | | |
// --|RST XOUT|-
// | |
// | P1.0|-->LED
//
// A. Dannenberg
// Texas Instruments, Inc
// January 2006
// Built with CCE for MSP430 Version: 3.0, 4.2
// Modified and enhanced by D. Patru for the EE365 MSP430 Kit - March 2011
// Modified and enhanced by D. Patru for the LaunchPad Kit - September 2013
// Currently built with CCS 5.4.
//******************************************************************************
#include "msp430g2553.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);
}
}