int main(int argc, char **argv) { WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer DCOCTL = CALDCO_1MHZ; // Set DCO to 16MHz BCSCTL1 = CALBC1_1MHZ; // MCLC = SMCLK = DCOCLK = 16MHz BCSCTL1 |= DIVA_0; // ACLK = ACLK/1 BCSCTL3 = LFXT1S1; //Select VLOCLK for ACLCK (i.e. 12khz intosc) TACCTL0 = OUTMOD_2 + CCIE; // TACCR0 interrupt enabled TACTL = TASSEL_1 + ID1 + ID0 + MC_1; // ACLCK, 1/8 DIVIDER, upmode to TCCR0 value //Set port directions P1DIR = 0x3F; // bits 0, 1, 2, 3, 4, 5 to outputs P1OUT = 0x00; // All bits low to initialize //initialize buttons P2DIR &= ~0x0F; // Set P2.0-3 to input direction P2REN |= 0x0F; // Set P2.0-3 to use pull up/down resistor P2OUT &= ~0x0F; // Set P2.0-3 to use pull down resistor //configure interrupts for buttons 2.0-3 P2IE = 0x0F; //Enable interrupts for each button P2IES = 0x00; //Set all ports to be sensitive only to rising edges nokia_init(); TACCR0 = 0; //Compare to Timer_A register (approx. 25 sec for VLOCLK & 1/8 divider) draw_image(rvasec_logo); TACCR0 = BLINK_CONST; //Compare to Timer_A register (approx. 25 sec for VLOCLK & 1/8 divider) __bis_SR_register(LPM3_bits + GIE); //Enter LPM3 w/interrupt __no_operation(); // For debugger, executes next instruction just like a PIC }
void TestLCD() { nokia_init(); // nokia 3310 lcd init. ********************************************************************** nokia_write_command(0x0d); // mod control inverse video change nokia_gotoxy(0,1); // nokia 3310 lcd cursor x y position printf(nokia_printchar,"Wei Fang"); // *************************************************************************** delay_ms(1000); nokia_write_command(0x0c); // mod control normal change }