// ----------------------------------------------------------------------- // ----------------------------------------------------------------------- void main(void) { initMSP430(); // Setup MSP to process IR and buttons int32 bitstring=0x00000000; int32 i; int8 packetIndex2=0; stopRobot(); _enable_interrupt(); while(1) { if (new_packet) { _disable_interrupt(); packetIndex2=0; //this part consolidates the incoming packet while (packetData[packetIndex2]!=2) { packetIndex2++; } packetIndex2++; while (packetIndex2<33) { bitstring+=packetData[packetIndex2]; bitstring<<=1; packetIndex2++; } if (bitstring==BUTTON_FIVE) //this part translates the packet { stopRobot(); } else if (bitstring==BUTTON_TWO) { moveRobotForward(); } else if (bitstring==BUTTON_FOUR) { moveRobotLeft(); } else if (bitstring==BUTTON_SIX) { moveRobotRight(); } else if (bitstring==BUTTON_EIGHT) { moveRobotBackwards(); } else if (bitstring==BUTTON_ONE) { moveRobotLeftSlow(); } else if (bitstring==BUTTON_THREE) { moveRobotRightSlow(); } else { stopRobot(); } for (i=0;i<0xFFFFF;i++); bitstring=0x00000000; packetIndex=0; _enable_interrupt(); new_packet=0; } else { bitstring=0x00000000; } } // end infinite loop } // end main
int main(void) { WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer _disable_interrupt(); halUCS_set16MFrequency(); _enable_interrupt(); halBioAX12_initialize(); halLed_sx_initialize(); halLed_sx_setLed(LED_RED, ON); halLed_sx_setLed(LED_YELLOW, OFF); halLed_rx_initialize(); halLed_rx_setLed(LED_RX_ALL, OFF); halTimer_b_initialize(TIMER_CLKSRC_ACLK, TIMER_MODE_UP); halTimer_b_setCCRTimedInterruption(TIMER_CCR0, 1000); halTimer_b_enableInterruptCCR0(); halJoystick_initialize(); halJoystick_setInterruptions(JOYSTICK_ALL, ON); halButtons_initialize(); halButtons_setInterruptions(BUTTON_ALL, ON); return 0; }
void main() { WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer (good dog) _disable_interrupt(); cron.seconds = 0; cron.minutes = 0; cron.hours = 0; alarm.seconds = 30; alarm.minutes = 2; alarm.hours = 0; initialize_leds(); initialize_lcd(); initialize_buttons(); initialize_timer_b(); initialize_timer_a1(); _enable_interrupt(); halLcdPrintLine(lcd_line, 0, OVERWRITE_TEXT); write_time_base(); write_cron(); while ( 1 ); }
void main(void) { WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer P1OUT = 0x00; // Port 1 Initialization (LEDs) P1SEL = 0x00; P1DIR = 0xFF; P1REN = 0x00; P1IES = 0x00; P1IFG = 0x00; P1IE = 0x00; P2OUT = 0xFF; // Port 2 Initialization (button control) P2SEL = 0x00; P2DIR = 0x00; P2REN = 0xFF; P2IES = 0xFF; P2IFG = 0x00; P2IE = 0xFF; _enable_interrupt(); while (1) { if (Flag == 1) { control(); } } }
void main(void) { WDTCTL = WDTPW+WDTHOLD; // Paramos el watchdog timer init_botons(); // Iniciamos los botones y Leds. _enable_interrupt(); // Activamos las interrupciones a nivel global del chip init_LCD(); // Inicializamos la pantalla init_UCS(); //Inicialitzem UCS init_UART(); //Inicialitzem UART halLcdPrintLine( saludo,linea,textstyle); linea++; sprintf(cadena,"bID = %d",bID); halLcdPrintLine( cadena,linea,textstyle); Encendre_LED(); TxPacket(0xFE, 2, 0x19); do { P1OUT ^= 0x03; i = 25000; do { i--; } while (i != 0); } while(1); }
// ----------------------------------------------------------------------- // In order to decode IR packets, the MSP430 needs to be configured to // tell time and generate interrupts on positive going edges. The // edge sensitivity is used to detect the first incoming IR packet. // The P2.6 pin change ISR will then toggle the edge sensitivity of // the interrupt in order to measure the times of the high and low // pulses arriving from the IR decoder. // // The timer must be enabled so that we can tell how long the pulses // last. In some degenerate cases, we will need to generate a interrupt // when the timer rolls over. This will indicate the end of a packet // and will be used to alert main that we have a new packet. // ----------------------------------------------------------------------- void initMSP430() { IFG1=0; // clear interrupt flag1 WDTCTL=WDTPW+WDTHOLD; // stop WD BCSCTL1 = CALBC1_8MHZ; DCOCTL = CALDCO_8MHZ; P2SEL &= ~BIT6; // Setup P2.6 as GPIO not XIN P2SEL2 &= ~BIT6; P2DIR &= ~BIT6; P2IFG &= ~BIT6; // Clear any interrupt flag P2IE |= BIT6; // Enable PORT 2 interrupt on pin change HIGH_2_LOW; P1DIR |= BIT0 | BIT6; // Enable updates to the LED P1OUT &= ~(BIT0 | BIT6); // An turn the LED off TA0CCR0 = 0x8000; // create a 16mS roll-over period TACTL &= ~TAIFG; // clear flag before enabling interrupts = good practice TACTL = ID_3 | TASSEL_2 | MC_1; // Use 1:1 presclar off MCLK and enable interrupts HIGH_2_LOW; // Setup pin interrupr on positive edge _enable_interrupt(); }
inline void StartCapture() { P1IES |= BIT1; P1IE |= BIT1; P1SEL &= ~BIT1; TACTL = TASSEL_2 | MC_2 | TACLR; _logCnt = 0; _enable_interrupt(); }
/* * initIR() *readies the IR sensor to recieve a signal from the remote * must be recalled after initMSP430() is called */ void initIR(){ //IR Pins P2SEL &= ~BIT6; // Setup P2.6 as GPIO not XIN P2SEL2 &= ~BIT6; P2DIR &= ~BIT6; P2IFG &= ~BIT6; // Clear any interrupt flag P2IE |= BIT6; // Enable PORT 2 interrupt on pin change TACTL &= ~TAIFG; // clear flag before enabling interrupts = good practice TACTL = ID_3 | TASSEL_2 | MC_1 | TAIE; // Use 1:1 presclar off MCLK and enable interrupts _enable_interrupt(); }
void init(){ WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer P1OUT = 0x00; //Start with nothing being output P1DIR = 0x41; // Set LED to output direction BCSCTL1 = CALBC1_1MHZ; // Set oscillator to 1MHz DCOCTL = CALDCO_1MHZ; // Set oscillator to 1MHz TACCR0 = 50000; // Initialize the timer to count at 5Hz TACCTL0 = CCIE; // Enable interrupt TA0CTL = TASSEL_2 + ID_2 + MC_1 + TACLR; // SMCLK, div 4, up mode, // clear timer _enable_interrupt(); //Enable global interrupt }
int main(void) { int i; delay(10000000); ODCE = 0; TRISECLR = 0xFF; _enable_int_number(7, (void *) IPC(1), 1, 0); _enable_interrupt(); for (i = 0;; i++) { PORTE = i & 0xFF; delay(1000000); } return 0; }
void initMSP430() { IFG1=0; // clear interrupt flag1 WDTCTL=WDTPW+WDTHOLD; // stop Watchdog timer BCSCTL1 = CALBC1_8MHZ; DCOCTL = CALDCO_8MHZ; P2SEL &= ~BIT6; // Setup P2.6 as GPIO P2SEL2 &= ~BIT6; P2DIR &= ~BIT6; P2IFG &= ~BIT6; P2IE |= BIT6; HIGH_2_LOW; TA0CCR0 = 0xFFFF; // This serves to create a 16mS roll-over TACTL &= ~TAIFG; // Just to clear the flag before we start interrupts and such TACTL = ID_3 | TASSEL_2 | MC_1; _enable_interrupt(); }
void flash_write(uint8_t *addr, uint8_t value) { _disable_interrupt(); // Disable interrupts(IAR workbench). FCTL2 = FWKEY + FSSEL_1 + FN0; // Clk = SMCLK/4 FCTL3 = FWKEY; // Clear Lock bit FCTL1 = FWKEY + WRT; // Set WRT bit for write operation *addr=value; // if(option == WRITE_FROM_BUFFER) //// for (i=0; i<64; i++) //// *addr++ = data_buffer[i]; // copy value to flash // // else if(option == WRITE_FROM_DUMP) // for (i=0; i<64; i++) // *addr++ = data_dump[i]; // copy value to flash FCTL1 = FWKEY; // Clear WRT bit FCTL3 = FWKEY + LOCK; // Set LOCK bit _enable_interrupt(); }
int process_create(void(*f)(void), int n) { unsigned int sp_create;//Stack pointer (SP) for process /*Create queue_t and process_t (allocate memory)*/ queue_t *elm = (queue_t *)malloc(sizeof(queue_t)); elm->p = (process_t *)malloc(sizeof(process_t)); //Initialize memory allocation for running the process _disable_interrupt(); sp_create = process_init(f,n); _enable_interrupt(); //If memory allocation failed if (sp_create == 0)return -1; else { //Memory Allocation Success. Set process's SP and Add elm to queue elm->p->sp = sp_create; add_queue(elm); return 0; } }
void initMSP430() { IFG1=0; // clear interrupt flag1 WDTCTL=WDTPW+WDTHOLD; // stop WD BCSCTL1 = CALBC1_8MHZ; DCOCTL = CALDCO_8MHZ; TA0CCR0 = PWM_FREQ; // create a 1mS roll-over period TACTL &= ~TAIFG; // clear flag before enabling interrupts = good practice TACTL = ID_3 | TASSEL_2 | MC_1 | TAIE; // Use 1:8 presclar off MCLK and enable interrupts // ADC Subsystem Setup ADC10CTL0 = 0; // Turn off ADC subsystem ADC10CTL1 = ADC10DIV_3; // Channel 4, ADC10CLK/4 ADC10AE0 = BIT4 | BIT3 | BIT5; // Make P1.4, P1.3, and P1.2 analog inputs ADC10CTL0 = SREF_0 | ADC10SHT_3 | ADC10ON | ENC; // Vcc & Vss as reference _enable_interrupt(); return; }
void initMotors(){ //Enable Motor Outputs P2DIR |= BIT0 | BIT1; //Right Motor Enable and Direction P2DIR |= BIT3 | BIT5; //Left Motor Enable and Direction //Setup Timer A1 for motor output PWM P2DIR |= BIT2; // P2.2 is associated with TA1CCR1 P2SEL |= BIT2; // P2.2 is associated with TA1CCTL1 P2DIR |= BIT4; // P2.4 is associated with TA1CCR2 P2SEL |= BIT4; // P2.4 is associated with TA1CCTL2 TA1CTL = ID_3 | TASSEL_2 | MC_1; // Use 1:8 presclar off MCLK TA1CCR0 = 1000; // set signal period TA1CCR1 = 400; // Set an appropriate duty cycle TA1CCTL1 = OUTMOD_3; // set TACCTL1 to Reset / Set mode TA1CCR2 = 400; // set an appropriate duty cycle TA1CCTL2 = OUTMOD_3; // set TACCTL1 to Reset / Set mode _enable_interrupt(); }
// ----------------------------------------------------------------------- // In order to decode IR packets, the MSP430 needs to be configured to // tell time and generate interrupts on positive going edges. The // edge sensitivity is used to detect the first incoming IR packet. // The P2.6 pin change ISR will then toggle the edge sensitivity of // the interrupt in order to measure the times of the high and low // pulses arriving from the IR decoder. // // The timer must be enabled so that we can tell how long the pulses // last. In some degenerate cases, we will need to generate a interrupt // when the timer rolls over. This will indicate the end of a packet // and will be used to alert main that we have a new packet. // ----------------------------------------------------------------------- void initMSP430() { IFG1=0; // clear interrupt flag1 WDTCTL=WDTPW+WDTHOLD; // stop WD BCSCTL1 = CALBC1_8MHZ; DCOCTL = CALDCO_8MHZ; P2SEL &= ~BIT6; // Setup P2.6 as GPIO not XIN P2SEL2 &= ~BIT6; P2DIR &= ~BIT6; P2IFG &= ~BIT6; // Clear any interrupt flag P2IE |= BIT6; // Enable PORT 2 interrupt on pin change HIGH_2_LOW; P1DIR = BIT0 | BIT6; // Enable updates to the LED P1OUT = (BIT0 | BIT6); // An turn the LED on TA0CCR0 = 10000; // create a 10mS roll-over period _enable_interrupt(); }
void main(void) { WDTCTL = WDTPW+WDTHOLD; // Paramos el watchdog timer init_botons(); // Iniciamos los botones y Leds. config_P4_LEDS(); // Iniciamos los LEDS del puerto 4 _enable_interrupt(); // Activamos las interrupciones a nivel global del chip init_LCD(); // Inicializamos la pantalla write(saludo,linea); //escribimos saludo en la primera linea linea++; //Aumentamos el valor de linea y con ello pasamos a la linea siguiente do { if (estado_anterior != estado) // Dependiendo el valor del estado se encenderá un LED externo u otro. { //clearLine(linea); sprintf(cadena," estado %02d", estado); // Guardamos en cadena lo siguiente frase: estado "valor del estado" write(cadena, linea); // Escribimos cadena estado_anterior = estado; // Actualizamos el valor de estado_anterior, para que no esté siempre escribiendo. } halLed_rx_setLed(LED_RX_ALL, OFF); halLed_rx_setLed(bitled, ON); if ( estado <= 2 || estado == 5 ) halLed_sx_toggleLed(LED_SX_ALL); //P1OUT^= 0x03; // Encender los LEDS con intermitencia delay(2); // retraso de aprox 1 segundo if ( bitled == LED_R8 ) bitled = BIT0; else bitled = bitled << 1; } while(1); }
// ----------------------------------------------------------------------- // ----------------------------------------------------------------------- void main(void) { initMSP430(); // Setup MSP to process IR and buttons while(1) { if (newIrPacket) { //Got a new packet! _disable_interrupt(); newIrPacket = FALSE; packetIndex = 0; if(packetBits == ONE){ P1OUT ^= BIT0; //Alternate the Red LED } else if(packetBits == TWO){ P1OUT ^= BIT6; //Alternate the Green LED } _enable_interrupt(); } // end if new IR packet arrived } // end infinite loop } // end main
/* * ======== main ======== */ int main(int argc, char *argv[]) { CSL_init(); // Activate Grace-generated configuration delay(); // System_Initial(); // initialize system. delay(); // delay and wait the first conversion. _enable_interrupt(); // enable interrupt while(1) { // half a second interrupt. if(flag & BIT7) { half_second(); } // read ADC result if(flag & BIT4) //Read ADC result { ADC_display(); } // one second interrupt to display time if (flag & BIT3) { time_display(); } if(flag & BIT1) // if SW1 is pushed, threshold temperature { // state machine will be changed flag &= ~ BIT1; // flag is reset time_state = 0; //when threshold temperature is setting, //setting time is disable. if(!customThreshold) { meatSelect(); //Enter meat select menu if not setting custom } if(Thr_state >= 3) // if in state 3, change to state 0; { Thr_state = 0; Thr_temp = set_temp; // assign threshold temperature LCD_display_number(0,4,Thr_temp); // display threshold temperature customThreshold = 0; //Reset custom threshold flag } else //else, Thr_state is changed to next state { Thr_state ++; } } if((flag & BIT2) && (!Thr_state)) // if SW2 is pushed, and Thr_state = 0, { // time setting state machine will be changed flag &= ~ BIT2; // flag is reset if(!(P1IN & BIT3)) { flag ^= BIT9; // S2 and SW2 are pushed together to change input flag ^= BIT8; if(flag & BIT9) // Display external temp LCD_display_string(1," Ext :"); else //Display probe temp LCD_display_string(1," Probe :"); } else { if(time_state >= 4) // if in state 4, change to state 0; { time_state = 0; time = set_time; // assign actual time set_time = 0; LCD_display_time(0,8,time); // display setting time } else { time_state ++; } } } if(flag & BIT0) // P1.3 service, set the Threshold temp or Time. { flag &= ~ BIT0; // flag is reset if(Thr_state != 0) { set_Thrtemp(); // set threshold temperature. } else if(time_state != 0) { set_Time(); // set timer. } else flag ^= BIT8; // display temperature in Fahrenheit } else __no_operation(); } }
void main(void) { // === Initialize system ================================================ IFG1=0; /* clear interrupt flag1 */ WDTCTL = WDTPW|WDTHOLD; // stop the watchdog timer initMSP430(); P2DIR |= BIT2; // P2.2 is associated with TA1CCR1 P2SEL |= BIT2; // P2.2 is associated with TA1CCTL1 P2DIR |= BIT4; // P2.2 is associated with TA1CCR2 P2SEL |= BIT4; // P2.2 is associated with TA1CCTL2 TA1CTL = ID_3 | TASSEL_2 | MC_1; // Use 1:8 presclar off MCLK TA1CCR0 = 100; // set signal period TA1CCR1 = 20; TA1CCTL1 = OUTMOD_7; // set TACCTL1 to Reset / Set mode TA1CCR2 = 80; TA1CCTL2 = OUTMOD_3; // P2.0 - Timer1_A, capture: CCI0A input, compare: Out0 output // P2.1 - Timer1_A, capture: CCI1A input, compare: Out1 output // P2.3 - Timer1_A, capture: CCI0B input, compare: Out0 output // P2.5 - Timer1_A, capture: CCI2B input, compare: Out2 output while(1) { if(flagged==1) { _disable_interrupt(); packetCount = 0; while(packetData[packetCount]==2) { packetCount++; } while(packetCount<33) { irPacket+=packetData[packetCount]; irPacket<<=1; packetCount++; } irPacket+=packetData[packetCount]; if(irPacket == SEL) { stopMovingForward(); stopMovingBackward(); movement=0; } if (movement == 0) { if(irPacket == CH_UP) { moveForward(); movement = 1; } if(irPacket == CH_DW) { moveBackward(); movement = 1; } if(irPacket == CH_L) { moveLeft(); } if(irPacket == CH_R) { moveRight(); } } unsigned int i; for(i=0; i<0xFFFF;i++); for(i=0; i<0xFFFF;i++); for(i=0; i<0xFFFF;i++); packetIndex=0; irPacket=0x00000000; flagged =0; _enable_interrupt(); } else { irPacket = 0x00000000; } } // end if new IR packet arrived } //end forever loop
//------------------------------------------------------------------------------ // void main(void) { ERROR2(RBX430_init(_12MHZ)); // init board to 12 MHz ERROR2(lcd_init()); // init LCD ERROR2(port1_init()); // init switches ERROR2(ADC_init()); // init ADC ERROR2(watchdog_init()); // init watchdog ERROR2(timerA_init()); // init TimerA ERROR2(timerB_init()); // init TimerB __bis_SR_register(GIE); // enable interrupts sys_event = NEW_GAME; // start w/new game //----------------------------------------------------------- // play forever while (1) { //----------------------------------------------------------- // event service routine loop //----------------------------------------------------------- while (1) { // disable interrupts while checking sys_event _disable_interrupts(); // if event pending, enable interrupts if (sys_event) _enable_interrupt(); // else enable interrupts and goto sleep else __bis_SR_register(LPM0_bits | GIE); //------------------------------------------------------- // I'm AWAKE!!! What needs service? if (sys_event == SWITCH_1) { sys_event = sys_event & ~SWITCH_1; SWITCH_1_event(); } else if (sys_event == NEW_GAME) // new game event { sys_event &= ~NEW_GAME; // clear new game event NEW_GAME_event(); // process new game } else if (sys_event == MOVE_BALL) // timer A event { sys_event &= ~MOVE_BALL; // clear TimerA event MOVE_BALL_event(ball); // update ball position } else if (sys_event == ADC_READ) // read ADC event { sys_event &= ~ADC_READ; // clear ADC event ADC_READ_event(rightPaddle); // process ADC read ADC_READ_event(leftPaddle); } else if (sys_event == LCD_UPDATE) { LCD_UPDATE_event(); } else if (sys_event == START_GAME) { sys_event = sys_event & ~START_GAME; START_GAME_event(); } else if (sys_event == NEW_RALLY) { sys_event = sys_event & ~ NEW_RALLY; NEW_RALLY_event(); } else if (sys_event == MISSED_BALL) { sys_event = sys_event & ~MISSED_BALL; MISSED_BALL_event(); } else if (sys_event == END_GAME) { sys_event = sys_event | END_GAME; END_GAME_event(); } else // ???? { ERROR2(SYS_ERR_EVENT); // unrecognized event } } } } // end main
// ----------------------------------------------------------------------- // Main: Initializes the MSP430 and checks input for a known code // ----------------------------------------------------------------------- void main(void) { init(); initNokia(); initMSP430(); // Setup MSP to process IR and buttons clearDisplay(); x=1; y=1; color= BLACK; drawBlock(y,x);//, color); while(1) { if (newIrPacket) { //Got a new packet! _disable_interrupt(); newIrPacket = FALSE; packetIndex = 0; if(IS_BUTTON_ONE){ P1OUT ^= BIT0; //Alternate the Red LED } else if(IS_BUTTON_TWO){ P1OUT ^= BIT6; //Alternate the Green LED } //Check if color is changed by middle button else if(packetBits == BIG_MIDDLE){ color = (color+1)%2; } //Check if up button is pressed else if (packetBits == BIG_UP) { if (y>=1) y=y-1; drawBlock(y,x,color); } //Check if down button is pressed else if (packetBits == BIG_DOWN) { if (y<=6) y=y+1; drawBlock(y,x,color); } //Check if left button is pressed else if (packetBits == BIG_LEFT) { if (x>=1) x=x-1; drawBlock(y,x,color); } //Check if right button is pressed else if (packetBits == BIG_RIGHT) { if (x<=10) x=x+1; drawBlock(y,x,color); } initMSP430(); _enable_interrupt(); } // end if new IR packet arrived } // end infinite loop } // end main
int main(void) { WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer initMSP430(); while (1) { if (packetIndex > 40) { _disable_interrupt(); while(packetData[i] != 2 && i < 80){ i++; } for(j = 0; j < 31; j++){ i++; irPacket += packetData[i]; irPacket <<= 1; } if(irPacket == CH_UP){ initRobot(); moveForward(50); newPacket = TRUE; } if(irPacket == CH_DW){ initRobot(); moveBackward(50); newPacket = TRUE; } if(irPacket == VOL_UP){ initRobot(); turnRight(50); newPacket = TRUE; } if(irPacket == VOL_DW){ initRobot(); turnLeft(50); newPacket = TRUE; } if(irPacket == ONE){ newPacket = TRUE; } if(irPacket == TWO){ newPacket = TRUE; } if(irPacket == THR){ newPacket = TRUE; } if(irPacket == PWR){ newPacket = TRUE; shutDown(); } if(newPacket == TRUE){ initMSP430(); newPacket = FALSE; } i = 0; packetIndex = 0; _enable_interrupt(); } // end if new IR packet arrived } }
void getTimeFromTarget(etTargetTime_t *t) { _disable_interrupt(); *t = targetTime; _enable_interrupt(); }
void etUserPreRun(void) { _enable_interrupt(); }
void main(void) { initMSP430(); moveForward(); P1DIR &= ~BIT3; P1REN |= BIT3; // Left P2DIR |= BIT0; // 1,2EN as OUT P2DIR |= BIT1; // Sets direction of left motor P2DIR |= BIT2; // P2.2 is associated with TA1CCR P2SEL |= BIT2; // P2.2 is associated with TA1CCTL1 // Right P2DIR |= BIT5; // 3,4EN as OUT P2DIR |= BIT3; // direction of right motor P2DIR |= BIT4; // P2.2 is associated with TA1CCR2 P2SEL |= BIT4; // P2.2 is associated with TA1CCTL2 TA1CTL = ID_3 | TASSEL_2 | MC_1; // Use 1:8 presclar off MCLK TA1CCR0 = 100; // set signal period TA1CCR1 = 50; TA1CCTL1 = OUTMOD_7; // set TACCTL1 to Reset / Set mode TA1CCR2 = 50; TA1CCTL2 = OUTMOD_3; // set TACCTL2 to Set / Reset mode while(1) { //This runs if we get a new packet from the remote and decodes it to control the code if(newIRPacket){ _disable_interrupt(); if(packet == VOL_UP){ moveForward(); }else if(packet == VOL_DW){ moveBackward(); }else if(packet == TWO ){ rotateLeft(); __delay_cycles(fullturn); }else if(packet == ONE){ rotateRight(); __delay_cycles(fullturn); }else{ stopMoving(); } //Now we reset the interrupt so we can run through this cycle again. _enable_interrupt(); initMSP430(); newIRPacket= FALSE; } } }