summaryrefslogtreecommitdiff
path: root/msp340/Break/main.c
blob: 898628bc5f286432983560904f1a286a1aac323e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <msp430.h>

#define LED (1 << 0)
#define BTN (1 << 1)

main() {
    long i = 0;

    WDTCTL  = 0x5A80;
    PM5CTL0 = 0xFFFE;

    P1DIR = LED;
    P1OUT = LED;

    P1OUT |= BTN;
    P1REN = BTN;

    while(i < 200000) {

        if ((BTN & P1IN) == 0)
            continue;

        i++;
    }

    P1OUT = BTN;
    while(1);
}