-
Notifications
You must be signed in to change notification settings - Fork 0
/
MSP430x2xx.inc
154 lines (144 loc) · 3.18 KB
/
MSP430x2xx.inc
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
;registers
PC equ r0
SP equ r1
SR equ r2
;sr values
V equ 0x0100 ;overflow
SCG1 equ 0x0080 ;clock generator 1
SCG0 equ 0x0040 ;clock generator 0
OSCOFF equ 0x0020 ;oscillator off
CPUOFF equ 0x0010 ;turn off cpu
GIE equ 0x0008 ;general interrupt enable
N equ 0x0004 ;negative
Z equ 0x0002 ;zero
C equ 0x0001 ;carry
;wdt
WDTCTL equ 0x0120 ;address of control register
WDTPW equ 0x5A00 ;timer password
WDTHOLD equ 0x0080 ;stop timer
WDTNMIES equ 0x0040 ;NMI edge select
WDTNMI equ 0x0020 ;NMI select
WDTTMSEL equ 0x0010 ;Timer mode select
WDTCNTCL equ 0x0008 ;counter clear
WDTSSEL equ 0x0004 ;source select
WDTIS3 equ 0x0003 ;interval 3 (div 32768)
WDTIS2 equ 0x0002 ;interval 2 (div 8192)
WDTIS1 equ 0x0001 ;interval 1 (div 512)
WDTIS0 equ 0x0000 ;interval 0 (div 64)
;clock module
DCOCTL equ 0x0056 ;DCO control register
BCSCTL1 equ 0x0057
BCSCTL2 equ 0x0058
BCSCTL3 equ 0x0053
IE1 equ 0x0000
IFG1 equ 0x0002
;timer A0
#ifdef TA0
TA0R equ 0x0170
TA0CCR0 equ 0x0172
TA0CCR1 equ 0x0174
TA0CCR2 equ 0x0176
TA0IV equ 0x012E
#endif
;timer A1
#ifdef TA1
TA1R equ 0x0190
TA1CCR0 equ 0x0192
TA1CCR1 equ 0x0194
TA1CCR2 equ 0x0196
TA1IV equ 0x011E
#endif
;timer config
;register
#ifdef TA0
TA0CTL equ 0x0160
#endif
#ifdef TA1
TA1CTL equ 0x0180
#endif
;flags
TASSEL3 equ 0x0300
TASSEL2 equ 0x0200
TASSEL1 equ 0x0100
TASSEL0 equ 0x0000
ID3 equ 0x00A0
ID2 equ 0x0080
ID1 equ 0x0040
ID0 equ 0x0000
MC3 equ 0x0030
MC2 equ 0x0020
MC1 equ 0x0010
MC0 equ 0x0000
TACLR equ 0x0004
TAIE equ 0x0002
TAIFG equ 0x0001
;capture compare
;registers
#ifdef TA0
TA0CCTL0 equ 0x0162
TA0CCTL1 equ 0x0164
TA0CCTL2 equ 0x0166
#endif
#ifdef TA1
TA1CCTL0 equ 0x0182
TA1CCTL1 equ 0x0184
TA1CCTL2 equ 0x0186
#endif
;flags
CM3 equ 0xC000
CM2 equ 0x8000
CM1 equ 0x4000
CM0 equ 0x0000
CCIS3 equ 0x3000
CCIS2 equ 0x2000
CCIS1 equ 0x1000
CCIS0 equ 0x0000
SCS equ 0x0800
SCCI equ 0x0400
CAP equ 0x0100
OUTMOD7 equ 0x00E0
OUTMOD6 equ 0x00C0
OUTMOD5 equ 0x00A0
OUTMOD4 equ 0x0080
OUTMOD3 equ 0x0060
OUTMOD2 equ 0x0040
OUTMOD1 equ 0x0020
OUTMOD0 equ 0x0000
CCIE equ 0x0010
CCI equ 0x0008
OUT equ 0x0004
COV equ 0x0002
CCIFG equ 0x0001
;port stuff
;P1
#ifdef P1
P1IN equ 0x0020
P1OUT equ 0x0021
P1DIR equ 0x0022
P1IFG equ 0x0023
P1IES equ 0x0024
P1IE equ 0x0025
P1SEL equ 0x0026
P1SEL2 equ 0x0041
P1REN equ 0x0027
#endif
#ifdef P2
P2IN equ 0x0028
P2OUT equ 0x0029
P2DIR equ 0x002A
P2IFG equ 0x002B
P2IES equ 0x002C
P2IE equ 0x002D
P2SEL equ 0x002E
P2SEL2 equ 0x0042
P2REN equ 0x002F
#endif
;pins
PIN7 equ 0x80
PIN6 equ 0x40
PIN5 equ 0x20
PIN4 equ 0x10
PIN3 equ 0x08
PIN2 equ 0x04
PIN1 equ 0x02
PIN0 equ 0x01