-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMod2Ex15.c
More file actions
46 lines (38 loc) · 760 Bytes
/
Mod2Ex15.c
File metadata and controls
46 lines (38 loc) · 760 Bytes
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <msp430.h>
#define TRUE 1
#define FALSE 0
void configleds(void){
P4DIR |= BIT7;
P4OUT &= ~BIT7;
P1DIR |= BIT0;
P1OUT &= ~BIT0;
}
void timera0config(void){
TA0CTL = TASSEL__SMCLK | MC__UP | TAIE;
TA0CCTL1 = CCIE;
TA0CCTL2 = CCIE;
TA0CCR0 = 8192;
TA0CCR1 = 2457;
TA0CCR2 = 5734;
}
#pragma vector = TIMER0_A1_VECTOR
__interrupt void led(void){
int ivec = TA0IV;
switch(ivec){
case 2: P1OUT &= ~BIT0; break;
case 4: P4OUT &= ~BIT7; break;
case 14:
P1OUT |= BIT0;
P4OUT |= BIT7;
break;
}
}
int main(void)
{
WDTCTL = WDTPW | WDTHOLD; // stop watchdog timer
configleds();
timera0config();
__enable_interrupt();
while(TRUE);
return 0;
}