void main(void) { initIO(); initOscillator(); initTimer(); while (1) { /* Check to see if the timer has counted beyond 32768 */ if (TMR1H == 0x80) { // reset the timer TMR1H = 0; TMR1L = 0; incrementSeconds(); } /* Check for button input */ // all buttons are active low if (TMR0 >= (unsigned) 192) { if (oldButtonS == 0 && _button_s == 1) second = 0; if (oldButtonM == 0 && _button_m == 1) incrementMinutes(); if (oldButtonH == 0 && _button_h == 1) incrementHours(); oldButtonS = _button_s; oldButtonM = _button_m; oldButtonH = _button_h; } /* Update display */ updateDisplay(); } }
__interrupt void ISR_Timer1_A0(void) { TA1CTL |= TACLR; // Increment the TI calendar library incrementSeconds(); // Increment the seconds counter seconds_since_boot++; // Because we want to wake the processor, use the following // to set the power control bits on the MSP430. __bic_SR_register_on_exit(LPM3_bits); }
__interrupt void Timer_A (void) { incrementSeconds(); LPM3_EXIT; }
__interrupt void Timer_A (void) { incrementSeconds(); lcd_write_time(); // TODO: move this out of isr __bic_SR_register_on_exit(LPM3_bits); }