Ok, I did some test. The code below is the complete code running on the MSP right now. Whenever there are 3,3V applied to P1.2 while downloading the programm, the P2 register of P1IN will stay "1" regardless what's happening at the input. Vise versa when there are 0V applied while downloading the P2 register will stay "0". P1.3,P1.4 and 1.5 are working properly and as expected. /////////////////////////////////////////////////main.c///////////////////////////////////////// #include "main.h" char PROG_Mod = 0; void main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop Watchdog Timer BCSCTL1 = CALBC1_1MHZ; BCSCTL2 &= ~(DIVS_3); WDTCTL = WDT_MDLY_32; // Set Watchdog Timer interval to ~32ms IE1 |= WDTIE; // Enable WDT interrupt P1OUT = 0; P1DIR = 0; P1SEL = 0; P2OUT = 0; P2SEL = 0; P2DIR = BIT6; // P2.6 output TACTL = TASSEL_2 + TACLR + ID_3; // SMCLK, clear TAR TACCTL0 = CCIE; // CCR0 interrupt enabled TACCR0 = 1020; //1330 TACTL |= MC_1; // Start Timer_A in continuous mode // Start Timer_A in continuous mode // Set S/H Time 10-Bit converter und continuous-sampling ADC10CTL0 = SREF_1 + ADC10SHT_2 + REFON + REF2_5V + ADC10ON + MSC; // Set Conversion auf single channel und continuous-sampling mode ADC10CTL1 = INCH_1 + CONSEQ_1 + ADC10DIV_0 + SHS_0 + ADC10SSEL_0; // P1.0, 1.1 (channel 2) als analog input pin ADC10AE0 = BIT1 + BIT2; // Anzahl der Werte ADC10DTC1 = 0x0A; __enable_interrupt(); for(;;) { reset_wdt(); // Reset WDT //Switch einlesen if (P1IN & BIT2) PROG_Mod = 0; if (P1IN & BIT3) PROG_Mod = 1; if (P1IN & BIT4) PROG_Mod = 2; if (P1IN & BIT5) PROG_Mod = 3; } } ////////////////////////////////////timer.c//////////////////////////////////////////////// #include "main.h" char merker = 0; // Timer A0 interrupt service routine #pragma vector=TIMER0_A0_VECTOR /// TIMERA0_VECTOR __interrupt void Timer_A (void) { merker=0; }
↧