//******************************************************************************
// Demo - MSP430F169, Check input on P1.6/TA1
//
// Description:  This code will configure an MSP430F169 to check the input logic
// level on P1.6/TA1 (pin 18).  First the program selects P1.6/TA1 for I/O
// function and configures it for input.  Then the program will continuously
// check the input logic level of this pin.  If a logic level 0 is read nothing
// will occur.  If a logic level 1 is read "Network Available" will be printed
// on the terminal I/O window while debugging.  This demo was written in order
// to check for network availability of an Iridium modem which will give 2.9V
// CMOS if the Iridium network is visible by the modem.
//
// Stefan Gadomski
// UC Santa Cruz
// June 5, 2007
// Senior Design 123B
// Built with IAR Embedded Workbench Version: 3.42A
//******************************************************************************



#include  <msp430x16x.h>
#include  <stdio.h>

unsigned char network = 0x00;

void main(void)
{
  WDTCTL = WDTPW + WDTHOLD;                 // Stop WDT
  P1SEL |= 0x40;                            // Set P1.6/TA1 for I/O
  P1DIR &= 0x40;                            // Set P1.6/TA1 to input direction
  while(1)
  {
    network = P1IN;
    if ( network == 0x40)
    {
      printf ("Network Available\n");
    }
    network = 0x00;
  }
}
