Subversion Repositories DevTools

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2850 dpurdie 1
/********************************************************************
2
*
3
* Standard register and bit definitions for the Texas Instruments
4
* MSP430 microcontroller.
5
*
6
* This file supports assembler and C development for
7
* MSP430x23x devices.
8
*
9
* Texas Instruments, Version 1.4
10
*
11
* Rev. 1.0, Initial Version
12
* Rev. 1.1  added TLV in INFO Memory
13
* Rev. 1.2  added missing SVS Register
14
* Rev. 1.3, added definitions for Interrupt Vectors xxIV
15
* Rev. 1.4, fixed define: TAG_ADC12_1 to 0x08
16
*
17
********************************************************************/
18
 
19
#ifndef __msp430x23x
20
#define __msp430x23x
21
 
22
#ifdef __cplusplus
23
extern "C" {
24
#endif
25
 
26
 
27
/*----------------------------------------------------------------------------*/
28
/* PERIPHERAL FILE MAP                                                        */
29
/*----------------------------------------------------------------------------*/
30
 
31
/* External references resolved by a device-specific linker command file */
32
#define SFR_8BIT(address)   extern volatile unsigned char address
33
#define SFR_16BIT(address)  extern volatile unsigned int address
34
 
35
 
36
/************************************************************
37
* STANDARD BITS
38
************************************************************/
39
 
40
#define BIT0                   (0x0001)
41
#define BIT1                   (0x0002)
42
#define BIT2                   (0x0004)
43
#define BIT3                   (0x0008)
44
#define BIT4                   (0x0010)
45
#define BIT5                   (0x0020)
46
#define BIT6                   (0x0040)
47
#define BIT7                   (0x0080)
48
#define BIT8                   (0x0100)
49
#define BIT9                   (0x0200)
50
#define BITA                   (0x0400)
51
#define BITB                   (0x0800)
52
#define BITC                   (0x1000)
53
#define BITD                   (0x2000)
54
#define BITE                   (0x4000)
55
#define BITF                   (0x8000)
56
 
57
/************************************************************
58
* STATUS REGISTER BITS
59
************************************************************/
60
 
61
#define C                      (0x0001)
62
#define Z                      (0x0002)
63
#define N                      (0x0004)
64
#define V                      (0x0100)
65
#define GIE                    (0x0008)
66
#define CPUOFF                 (0x0010)
67
#define OSCOFF                 (0x0020)
68
#define SCG0                   (0x0040)
69
#define SCG1                   (0x0080)
70
 
71
/* Low Power Modes coded with Bits 4-7 in SR */
72
 
73
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
74
#define LPM0                   (CPUOFF)
75
#define LPM1                   (SCG0+CPUOFF)
76
#define LPM2                   (SCG1+CPUOFF)
77
#define LPM3                   (SCG1+SCG0+CPUOFF)
78
#define LPM4                   (SCG1+SCG0+OSCOFF+CPUOFF)
79
/* End #defines for assembler */
80
 
81
#else /* Begin #defines for C */
82
#define LPM0_bits              (CPUOFF)
83
#define LPM1_bits              (SCG0+CPUOFF)
84
#define LPM2_bits              (SCG1+CPUOFF)
85
#define LPM3_bits              (SCG1+SCG0+CPUOFF)
86
#define LPM4_bits              (SCG1+SCG0+OSCOFF+CPUOFF)
87
 
88
#include "in430.h"
89
 
90
#define LPM0         _bis_SR_register(LPM0_bits)         /* Enter Low Power Mode 0 */
91
#define LPM0_EXIT    _bic_SR_register_on_exit(LPM0_bits) /* Exit Low Power Mode 0 */
92
#define LPM1         _bis_SR_register(LPM1_bits)         /* Enter Low Power Mode 1 */
93
#define LPM1_EXIT    _bic_SR_register_on_exit(LPM1_bits) /* Exit Low Power Mode 1 */
94
#define LPM2         _bis_SR_register(LPM2_bits)         /* Enter Low Power Mode 2 */
95
#define LPM2_EXIT    _bic_SR_register_on_exit(LPM2_bits) /* Exit Low Power Mode 2 */
96
#define LPM3         _bis_SR_register(LPM3_bits)         /* Enter Low Power Mode 3 */
97
#define LPM3_EXIT    _bic_SR_register_on_exit(LPM3_bits) /* Exit Low Power Mode 3 */
98
#define LPM4         _bis_SR_register(LPM4_bits)         /* Enter Low Power Mode 4 */
99
#define LPM4_EXIT    _bic_SR_register_on_exit(LPM4_bits) /* Exit Low Power Mode 4 */
100
#endif /* End #defines for C */
101
 
102
/************************************************************
103
* PERIPHERAL FILE MAP
104
************************************************************/
105
 
106
/************************************************************
107
* SPECIAL FUNCTION REGISTER ADDRESSES + CONTROL BITS
108
************************************************************/
109
 
110
SFR_8BIT(IE1);                                /* Interrupt Enable 1 */
111
#define WDTIE                  (0x01)         /* Watchdog Interrupt Enable */
112
#define OFIE                   (0x02)         /* Osc. Fault  Interrupt Enable */
113
#define NMIIE                  (0x10)         /* NMI Interrupt Enable */
114
#define ACCVIE                 (0x20)         /* Flash Access Violation Interrupt Enable */
115
 
116
SFR_8BIT(IFG1);                               /* Interrupt Flag 1 */
117
#define WDTIFG                 (0x01)         /* Watchdog Interrupt Flag */
118
#define OFIFG                  (0x02)         /* Osc. Fault Interrupt Flag */
119
#define PORIFG                 (0x04)         /* Power On Interrupt Flag */
120
#define RSTIFG                 (0x08)         /* Reset Interrupt Flag */
121
#define NMIIFG                 (0x10)         /* NMI Interrupt Flag */
122
 
123
SFR_8BIT(IE2);                                /* Interrupt Enable 2 */
124
#define UC0IE                  IE2
125
#define UCA0RXIE               (0x01)
126
#define UCA0TXIE               (0x02)
127
#define UCB0RXIE               (0x04)
128
#define UCB0TXIE               (0x08)
129
 
130
SFR_8BIT(IFG2);                               /* Interrupt Flag 2 */
131
#define UC0IFG                 IFG2
132
#define UCA0RXIFG              (0x01)
133
#define UCA0TXIFG              (0x02)
134
#define UCB0RXIFG              (0x04)
135
#define UCB0TXIFG              (0x08)
136
 
137
/************************************************************
138
* ADC12
139
************************************************************/
140
#define __MSP430_HAS_ADC12__                  /* Definition to show that Module is available */
141
 
142
SFR_16BIT(ADC12CTL0);                         /* ADC12 Control 0 */
143
SFR_16BIT(ADC12CTL1);                         /* ADC12 Control 1 */
144
SFR_16BIT(ADC12IFG);                          /* ADC12 Interrupt Flag */
145
SFR_16BIT(ADC12IE);                           /* ADC12 Interrupt Enable */
146
SFR_16BIT(ADC12IV);                           /* ADC12 Interrupt Vector Word */
147
 
148
#define ADC12MEM_              (0x0140)       /* ADC12 Conversion Memory */
149
#ifdef __ASM_HEADER__
150
#define ADC12MEM               (ADC12MEM_)    /* ADC12 Conversion Memory (for assembler) */
151
#else
152
#define ADC12MEM               ((int*)        ADC12MEM_) /* ADC12 Conversion Memory (for C) */
153
#endif
154
SFR_16BIT(ADC12MEM0);                         /* ADC12 Conversion Memory 0 */
155
SFR_16BIT(ADC12MEM1);                         /* ADC12 Conversion Memory 1 */
156
SFR_16BIT(ADC12MEM2);                         /* ADC12 Conversion Memory 2 */
157
SFR_16BIT(ADC12MEM3);                         /* ADC12 Conversion Memory 3 */
158
SFR_16BIT(ADC12MEM4);                         /* ADC12 Conversion Memory 4 */
159
SFR_16BIT(ADC12MEM5);                         /* ADC12 Conversion Memory 5 */
160
SFR_16BIT(ADC12MEM6);                         /* ADC12 Conversion Memory 6 */
161
SFR_16BIT(ADC12MEM7);                         /* ADC12 Conversion Memory 7 */
162
SFR_16BIT(ADC12MEM8);                         /* ADC12 Conversion Memory 8 */
163
SFR_16BIT(ADC12MEM9);                         /* ADC12 Conversion Memory 9 */
164
SFR_16BIT(ADC12MEM10);                        /* ADC12 Conversion Memory 10 */
165
SFR_16BIT(ADC12MEM11);                        /* ADC12 Conversion Memory 11 */
166
SFR_16BIT(ADC12MEM12);                        /* ADC12 Conversion Memory 12 */
167
SFR_16BIT(ADC12MEM13);                        /* ADC12 Conversion Memory 13 */
168
SFR_16BIT(ADC12MEM14);                        /* ADC12 Conversion Memory 14 */
169
SFR_16BIT(ADC12MEM15);                        /* ADC12 Conversion Memory 15 */
170
 
171
#define ADC12MCTL_             (0x0080)       /* ADC12 Memory Control */
172
#ifdef __ASM_HEADER__
173
#define ADC12MCTL              (ADC12MCTL_)   /* ADC12 Memory Control (for assembler) */
174
#else
175
#define ADC12MCTL              ((char*)       ADC12MCTL_) /* ADC12 Memory Control (for C) */
176
#endif
177
SFR_8BIT(ADC12MCTL0);                         /* ADC12 Memory Control 0 */
178
SFR_8BIT(ADC12MCTL1);                         /* ADC12 Memory Control 1 */
179
SFR_8BIT(ADC12MCTL2);                         /* ADC12 Memory Control 2 */
180
SFR_8BIT(ADC12MCTL3);                         /* ADC12 Memory Control 3 */
181
SFR_8BIT(ADC12MCTL4);                         /* ADC12 Memory Control 4 */
182
SFR_8BIT(ADC12MCTL5);                         /* ADC12 Memory Control 5 */
183
SFR_8BIT(ADC12MCTL6);                         /* ADC12 Memory Control 6 */
184
SFR_8BIT(ADC12MCTL7);                         /* ADC12 Memory Control 7 */
185
SFR_8BIT(ADC12MCTL8);                         /* ADC12 Memory Control 8 */
186
SFR_8BIT(ADC12MCTL9);                         /* ADC12 Memory Control 9 */
187
SFR_8BIT(ADC12MCTL10);                        /* ADC12 Memory Control 10 */
188
SFR_8BIT(ADC12MCTL11);                        /* ADC12 Memory Control 11 */
189
SFR_8BIT(ADC12MCTL12);                        /* ADC12 Memory Control 12 */
190
SFR_8BIT(ADC12MCTL13);                        /* ADC12 Memory Control 13 */
191
SFR_8BIT(ADC12MCTL14);                        /* ADC12 Memory Control 14 */
192
SFR_8BIT(ADC12MCTL15);                        /* ADC12 Memory Control 15 */
193
 
194
/* ADC12CTL0 */
195
#define ADC12SC                (0x001)        /* ADC12 Start Conversion */
196
#define ENC                    (0x002)        /* ADC12 Enable Conversion */
197
#define ADC12TOVIE             (0x004)        /* ADC12 Timer Overflow interrupt enable */
198
#define ADC12OVIE              (0x008)        /* ADC12 Overflow interrupt enable */
199
#define ADC12ON                (0x010)        /* ADC12 On/enable */
200
#define REFON                  (0x020)        /* ADC12 Reference on */
201
#define REF2_5V                (0x040)        /* ADC12 Ref 0:1.5V / 1:2.5V */
202
#define MSC                    (0x080)        /* ADC12 Multiple SampleConversion */
203
#define SHT00                  (0x0100)       /* ADC12 Sample Hold 0 Select 0 */
204
#define SHT01                  (0x0200)       /* ADC12 Sample Hold 0 Select 1 */
205
#define SHT02                  (0x0400)       /* ADC12 Sample Hold 0 Select 2 */
206
#define SHT03                  (0x0800)       /* ADC12 Sample Hold 0 Select 3 */
207
#define SHT10                  (0x1000)       /* ADC12 Sample Hold 0 Select 0 */
208
#define SHT11                  (0x2000)       /* ADC12 Sample Hold 1 Select 1 */
209
#define SHT12                  (0x4000)       /* ADC12 Sample Hold 2 Select 2 */
210
#define SHT13                  (0x8000)       /* ADC12 Sample Hold 3 Select 3 */
211
#define MSH                    (0x080)
212
 
213
#define SHT0_0                 (0*0x100u)     /* ADC12 Sample Hold 0 Select Bit: 0 */
214
#define SHT0_1                 (1*0x100u)     /* ADC12 Sample Hold 0 Select Bit: 1 */
215
#define SHT0_2                 (2*0x100u)     /* ADC12 Sample Hold 0 Select Bit: 2 */
216
#define SHT0_3                 (3*0x100u)     /* ADC12 Sample Hold 0 Select Bit: 3 */
217
#define SHT0_4                 (4*0x100u)     /* ADC12 Sample Hold 0 Select Bit: 4 */
218
#define SHT0_5                 (5*0x100u)     /* ADC12 Sample Hold 0 Select Bit: 5 */
219
#define SHT0_6                 (6*0x100u)     /* ADC12 Sample Hold 0 Select Bit: 6 */
220
#define SHT0_7                 (7*0x100u)     /* ADC12 Sample Hold 0 Select Bit: 7 */
221
#define SHT0_8                 (8*0x100u)     /* ADC12 Sample Hold 0 Select Bit: 8 */
222
#define SHT0_9                 (9*0x100u)     /* ADC12 Sample Hold 0 Select Bit: 9 */
223
#define SHT0_10                (10*0x100u)    /* ADC12 Sample Hold 0 Select Bit: 10 */
224
#define SHT0_11                (11*0x100u)    /* ADC12 Sample Hold 0 Select Bit: 11 */
225
#define SHT0_12                (12*0x100u)    /* ADC12 Sample Hold 0 Select Bit: 12 */
226
#define SHT0_13                (13*0x100u)    /* ADC12 Sample Hold 0 Select Bit: 13 */
227
#define SHT0_14                (14*0x100u)    /* ADC12 Sample Hold 0 Select Bit: 14 */
228
#define SHT0_15                (15*0x100u)    /* ADC12 Sample Hold 0 Select Bit: 15 */
229
 
230
#define SHT1_0                 (0*0x1000u)    /* ADC12 Sample Hold 1 Select Bit: 0 */
231
#define SHT1_1                 (1*0x1000u)    /* ADC12 Sample Hold 1 Select Bit: 1 */
232
#define SHT1_2                 (2*0x1000u)    /* ADC12 Sample Hold 1 Select Bit: 2 */
233
#define SHT1_3                 (3*0x1000u)    /* ADC12 Sample Hold 1 Select Bit: 3 */
234
#define SHT1_4                 (4*0x1000u)    /* ADC12 Sample Hold 1 Select Bit: 4 */
235
#define SHT1_5                 (5*0x1000u)    /* ADC12 Sample Hold 1 Select Bit: 5 */
236
#define SHT1_6                 (6*0x1000u)    /* ADC12 Sample Hold 1 Select Bit: 6 */
237
#define SHT1_7                 (7*0x1000u)    /* ADC12 Sample Hold 1 Select Bit: 7 */
238
#define SHT1_8                 (8*0x1000u)    /* ADC12 Sample Hold 1 Select Bit: 8 */
239
#define SHT1_9                 (9*0x1000u)    /* ADC12 Sample Hold 1 Select Bit: 9 */
240
#define SHT1_10                (10*0x1000u)   /* ADC12 Sample Hold 1 Select Bit: 10 */
241
#define SHT1_11                (11*0x1000u)   /* ADC12 Sample Hold 1 Select Bit: 11 */
242
#define SHT1_12                (12*0x1000u)   /* ADC12 Sample Hold 1 Select Bit: 12 */
243
#define SHT1_13                (13*0x1000u)   /* ADC12 Sample Hold 1 Select Bit: 13 */
244
#define SHT1_14                (14*0x1000u)   /* ADC12 Sample Hold 1 Select Bit: 14 */
245
#define SHT1_15                (15*0x1000u)   /* ADC12 Sample Hold 1 Select Bit: 15 */
246
 
247
/* ADC12CTL1 */
248
#define ADC12BUSY              (0x0001)       /* ADC12 Busy */
249
#define CONSEQ0                (0x0002)       /* ADC12 Conversion Sequence Select 0 */
250
#define CONSEQ1                (0x0004)       /* ADC12 Conversion Sequence Select 1 */
251
#define ADC12SSEL0             (0x0008)       /* ADC12 Clock Source Select 0 */
252
#define ADC12SSEL1             (0x0010)       /* ADC12 Clock Source Select 1 */
253
#define ADC12DIV0              (0x0020)       /* ADC12 Clock Divider Select 0 */
254
#define ADC12DIV1              (0x0040)       /* ADC12 Clock Divider Select 1 */
255
#define ADC12DIV2              (0x0080)       /* ADC12 Clock Divider Select 2 */
256
#define ISSH                   (0x0100)       /* ADC12 Invert Sample Hold Signal */
257
#define SHP                    (0x0200)       /* ADC12 Sample/Hold Pulse Mode */
258
#define SHS0                   (0x0400)       /* ADC12 Sample/Hold Source 0 */
259
#define SHS1                   (0x0800)       /* ADC12 Sample/Hold Source 1 */
260
#define CSTARTADD0             (0x1000)       /* ADC12 Conversion Start Address 0 */
261
#define CSTARTADD1             (0x2000)       /* ADC12 Conversion Start Address 1 */
262
#define CSTARTADD2             (0x4000)       /* ADC12 Conversion Start Address 2 */
263
#define CSTARTADD3             (0x8000)       /* ADC12 Conversion Start Address 3 */
264
 
265
#define CONSEQ_0               (0*2u)         /* ADC12 Conversion Sequence Select: 0 */
266
#define CONSEQ_1               (1*2u)         /* ADC12 Conversion Sequence Select: 1 */
267
#define CONSEQ_2               (2*2u)         /* ADC12 Conversion Sequence Select: 2 */
268
#define CONSEQ_3               (3*2u)         /* ADC12 Conversion Sequence Select: 3 */
269
#define ADC12SSEL_0            (0*8u)         /* ADC12 Clock Source Select: 0 */
270
#define ADC12SSEL_1            (1*8u)         /* ADC12 Clock Source Select: 1 */
271
#define ADC12SSEL_2            (2*8u)         /* ADC12 Clock Source Select: 2 */
272
#define ADC12SSEL_3            (3*8u)         /* ADC12 Clock Source Select: 3 */
273
#define ADC12DIV_0             (0*0x20u)      /* ADC12 Clock Divider Select: 0 */
274
#define ADC12DIV_1             (1*0x20u)      /* ADC12 Clock Divider Select: 1 */
275
#define ADC12DIV_2             (2*0x20u)      /* ADC12 Clock Divider Select: 2 */
276
#define ADC12DIV_3             (3*0x20u)      /* ADC12 Clock Divider Select: 3 */
277
#define ADC12DIV_4             (4*0x20u)      /* ADC12 Clock Divider Select: 4 */
278
#define ADC12DIV_5             (5*0x20u)      /* ADC12 Clock Divider Select: 5 */
279
#define ADC12DIV_6             (6*0x20u)      /* ADC12 Clock Divider Select: 6 */
280
#define ADC12DIV_7             (7*0x20u)      /* ADC12 Clock Divider Select: 7 */
281
#define SHS_0                  (0*0x400u)     /* ADC12 Sample/Hold Source: 0 */
282
#define SHS_1                  (1*0x400u)     /* ADC12 Sample/Hold Source: 1 */
283
#define SHS_2                  (2*0x400u)     /* ADC12 Sample/Hold Source: 2 */
284
#define SHS_3                  (3*0x400u)     /* ADC12 Sample/Hold Source: 3 */
285
#define CSTARTADD_0            (0*0x1000u)    /* ADC12 Conversion Start Address: 0 */
286
#define CSTARTADD_1            (1*0x1000u)    /* ADC12 Conversion Start Address: 1 */
287
#define CSTARTADD_2            (2*0x1000u)    /* ADC12 Conversion Start Address: 2 */
288
#define CSTARTADD_3            (3*0x1000u)    /* ADC12 Conversion Start Address: 3 */
289
#define CSTARTADD_4            (4*0x1000u)    /* ADC12 Conversion Start Address: 4 */
290
#define CSTARTADD_5            (5*0x1000u)    /* ADC12 Conversion Start Address: 5 */
291
#define CSTARTADD_6            (6*0x1000u)    /* ADC12 Conversion Start Address: 6 */
292
#define CSTARTADD_7            (7*0x1000u)    /* ADC12 Conversion Start Address: 7 */
293
#define CSTARTADD_8            (8*0x1000u)    /* ADC12 Conversion Start Address: 8 */
294
#define CSTARTADD_9            (9*0x1000u)    /* ADC12 Conversion Start Address: 9 */
295
#define CSTARTADD_10           (10*0x1000u)   /* ADC12 Conversion Start Address: 10 */
296
#define CSTARTADD_11           (11*0x1000u)   /* ADC12 Conversion Start Address: 11 */
297
#define CSTARTADD_12           (12*0x1000u)   /* ADC12 Conversion Start Address: 12 */
298
#define CSTARTADD_13           (13*0x1000u)   /* ADC12 Conversion Start Address: 13 */
299
#define CSTARTADD_14           (14*0x1000u)   /* ADC12 Conversion Start Address: 14 */
300
#define CSTARTADD_15           (15*0x1000u)   /* ADC12 Conversion Start Address: 15 */
301
 
302
/* ADC12MCTLx */
303
#define INCH0                  (0x0001)       /* ADC12 Input Channel Select Bit 0 */
304
#define INCH1                  (0x0002)       /* ADC12 Input Channel Select Bit 1 */
305
#define INCH2                  (0x0004)       /* ADC12 Input Channel Select Bit 2 */
306
#define INCH3                  (0x0008)       /* ADC12 Input Channel Select Bit 3 */
307
#define SREF0                  (0x0010)       /* ADC12 Select Reference Bit 0 */
308
#define SREF1                  (0x0020)       /* ADC12 Select Reference Bit 1 */
309
#define SREF2                  (0x0040)       /* ADC12 Select Reference Bit 2 */
310
#define EOS                    (0x0080)       /* ADC12 End of Sequence */
311
 
312
#define INCH_0                 (0)            /* ADC12 Input Channel 0 */
313
#define INCH_1                 (1)            /* ADC12 Input Channel 1 */
314
#define INCH_2                 (2)            /* ADC12 Input Channel 2 */
315
#define INCH_3                 (3)            /* ADC12 Input Channel 3 */
316
#define INCH_4                 (4)            /* ADC12 Input Channel 4 */
317
#define INCH_5                 (5)            /* ADC12 Input Channel 5 */
318
#define INCH_6                 (6)            /* ADC12 Input Channel 6 */
319
#define INCH_7                 (7)            /* ADC12 Input Channel 7 */
320
#define INCH_8                 (8)            /* ADC12 Input Channel 8 */
321
#define INCH_9                 (9)            /* ADC12 Input Channel 9 */
322
#define INCH_10                (10)           /* ADC12 Input Channel 10 */
323
#define INCH_11                (11)           /* ADC12 Input Channel 11 */
324
#define INCH_12                (12)           /* ADC12 Input Channel 12 */
325
#define INCH_13                (13)           /* ADC12 Input Channel 13 */
326
#define INCH_14                (14)           /* ADC12 Input Channel 14 */
327
#define INCH_15                (15)           /* ADC12 Input Channel 15 */
328
 
329
#define SREF_0                 (0*0x10u)      /* ADC12 Select Reference 0 */
330
#define SREF_1                 (1*0x10u)      /* ADC12 Select Reference 1 */
331
#define SREF_2                 (2*0x10u)      /* ADC12 Select Reference 2 */
332
#define SREF_3                 (3*0x10u)      /* ADC12 Select Reference 3 */
333
#define SREF_4                 (4*0x10u)      /* ADC12 Select Reference 4 */
334
#define SREF_5                 (5*0x10u)      /* ADC12 Select Reference 5 */
335
#define SREF_6                 (6*0x10u)      /* ADC12 Select Reference 6 */
336
#define SREF_7                 (7*0x10u)      /* ADC12 Select Reference 7 */
337
 
338
/* ADC12IV Definitions */
339
#define ADC12IV_NONE           (0x0000)       /* No Interrupt pending */
340
#define ADC12IV_ADC12OVIFG     (0x0002)       /* ADC12OVIFG */
341
#define ADC12IV_ADC12TOVIFG    (0x0004)       /* ADC12TOVIFG */
342
#define ADC12IV_ADC12IFG0      (0x0006)       /* ADC12IFG0 */
343
#define ADC12IV_ADC12IFG1      (0x0008)       /* ADC12IFG1 */
344
#define ADC12IV_ADC12IFG2      (0x000A)       /* ADC12IFG2 */
345
#define ADC12IV_ADC12IFG3      (0x000C)       /* ADC12IFG3 */
346
#define ADC12IV_ADC12IFG4      (0x000E)       /* ADC12IFG4 */
347
#define ADC12IV_ADC12IFG5      (0x0010)       /* ADC12IFG5 */
348
#define ADC12IV_ADC12IFG6      (0x0012)       /* ADC12IFG6 */
349
#define ADC12IV_ADC12IFG7      (0x0014)       /* ADC12IFG7 */
350
#define ADC12IV_ADC12IFG8      (0x0016)       /* ADC12IFG8 */
351
#define ADC12IV_ADC12IFG9      (0x0018)       /* ADC12IFG9 */
352
#define ADC12IV_ADC12IFG10     (0x001A)       /* ADC12IFG10 */
353
#define ADC12IV_ADC12IFG11     (0x001C)       /* ADC12IFG11 */
354
#define ADC12IV_ADC12IFG12     (0x001E)       /* ADC12IFG12 */
355
#define ADC12IV_ADC12IFG13     (0x0020)       /* ADC12IFG13 */
356
#define ADC12IV_ADC12IFG14     (0x0022)       /* ADC12IFG14 */
357
#define ADC12IV_ADC12IFG15     (0x0024)       /* ADC12IFG15 */
358
 
359
/************************************************************
360
* Basic Clock Module
361
************************************************************/
362
#define __MSP430_HAS_BC2__                    /* Definition to show that Module is available */
363
 
364
SFR_8BIT(DCOCTL);                             /* DCO Clock Frequency Control */
365
SFR_8BIT(BCSCTL1);                            /* Basic Clock System Control 1 */
366
SFR_8BIT(BCSCTL2);                            /* Basic Clock System Control 2 */
367
SFR_8BIT(BCSCTL3);                            /* Basic Clock System Control 3 */
368
 
369
#define MOD0                   (0x01)         /* Modulation Bit 0 */
370
#define MOD1                   (0x02)         /* Modulation Bit 1 */
371
#define MOD2                   (0x04)         /* Modulation Bit 2 */
372
#define MOD3                   (0x08)         /* Modulation Bit 3 */
373
#define MOD4                   (0x10)         /* Modulation Bit 4 */
374
#define DCO0                   (0x20)         /* DCO Select Bit 0 */
375
#define DCO1                   (0x40)         /* DCO Select Bit 1 */
376
#define DCO2                   (0x80)         /* DCO Select Bit 2 */
377
 
378
#define RSEL0                  (0x01)         /* Range Select Bit 0 */
379
#define RSEL1                  (0x02)         /* Range Select Bit 1 */
380
#define RSEL2                  (0x04)         /* Range Select Bit 2 */
381
#define RSEL3                  (0x08)         /* Range Select Bit 3 */
382
#define DIVA0                  (0x10)         /* ACLK Divider 0 */
383
#define DIVA1                  (0x20)         /* ACLK Divider 1 */
384
#define XTS                    (0x40)         /* LFXTCLK 0:Low Freq. / 1: High Freq. */
385
#define XT2OFF                 (0x80)         /* Enable XT2CLK */
386
 
387
#define DIVA_0                 (0x00)         /* ACLK Divider 0: /1 */
388
#define DIVA_1                 (0x10)         /* ACLK Divider 1: /2 */
389
#define DIVA_2                 (0x20)         /* ACLK Divider 2: /4 */
390
#define DIVA_3                 (0x30)         /* ACLK Divider 3: /8 */
391
 
392
#define DCOR                   (0x01)         /* Enable External Resistor : 1 */
393
#define DIVS0                  (0x02)         /* SMCLK Divider 0 */
394
#define DIVS1                  (0x04)         /* SMCLK Divider 1 */
395
#define SELS                   (0x08)         /* SMCLK Source Select 0:DCOCLK / 1:XT2CLK/LFXTCLK */
396
#define DIVM0                  (0x10)         /* MCLK Divider 0 */
397
#define DIVM1                  (0x20)         /* MCLK Divider 1 */
398
#define SELM0                  (0x40)         /* MCLK Source Select 0 */
399
#define SELM1                  (0x80)         /* MCLK Source Select 1 */
400
 
401
#define DIVS_0                 (0x00)         /* SMCLK Divider 0: /1 */
402
#define DIVS_1                 (0x02)         /* SMCLK Divider 1: /2 */
403
#define DIVS_2                 (0x04)         /* SMCLK Divider 2: /4 */
404
#define DIVS_3                 (0x06)         /* SMCLK Divider 3: /8 */
405
 
406
#define DIVM_0                 (0x00)         /* MCLK Divider 0: /1 */
407
#define DIVM_1                 (0x10)         /* MCLK Divider 1: /2 */
408
#define DIVM_2                 (0x20)         /* MCLK Divider 2: /4 */
409
#define DIVM_3                 (0x30)         /* MCLK Divider 3: /8 */
410
 
411
#define SELM_0                 (0x00)         /* MCLK Source Select 0: DCOCLK */
412
#define SELM_1                 (0x40)         /* MCLK Source Select 1: DCOCLK */
413
#define SELM_2                 (0x80)         /* MCLK Source Select 2: XT2CLK/LFXTCLK */
414
#define SELM_3                 (0xC0)         /* MCLK Source Select 3: LFXTCLK */
415
 
416
#define LFXT1OF                (0x01)         /* Low/high Frequency Oscillator Fault Flag */
417
#define XT2OF                  (0x02)         /* High frequency oscillator 2 fault flag */
418
#define XCAP0                  (0x04)         /* XIN/XOUT Cap 0 */
419
#define XCAP1                  (0x08)         /* XIN/XOUT Cap 1 */
420
#define LFXT1S0                (0x10)         /* Mode 0 for LFXT1 (XTS = 0) */
421
#define LFXT1S1                (0x20)         /* Mode 1 for LFXT1 (XTS = 0) */
422
#define XT2S0                  (0x40)         /* Mode 0 for XT2 */
423
#define XT2S1                  (0x80)         /* Mode 1 for XT2 */
424
 
425
#define XCAP_0                 (0x00)         /* XIN/XOUT Cap : 0 pF */
426
#define XCAP_1                 (0x04)         /* XIN/XOUT Cap : 6 pF */
427
#define XCAP_2                 (0x08)         /* XIN/XOUT Cap : 10 pF */
428
#define XCAP_3                 (0x0C)         /* XIN/XOUT Cap : 12.5 pF */
429
 
430
#define LFXT1S_0               (0x00)         /* Mode 0 for LFXT1 : Normal operation */
431
#define LFXT1S_1               (0x10)         /* Mode 1 for LFXT1 : Reserved */
432
#define LFXT1S_2               (0x20)         /* Mode 2 for LFXT1 : VLO */
433
#define LFXT1S_3               (0x30)         /* Mode 3 for LFXT1 : Digital input signal */
434
 
435
#define XT2S_0                 (0x00)         /* Mode 0 for XT2 : 0.4 - 1 MHz */
436
#define XT2S_1                 (0x40)         /* Mode 1 for XT2 : 1 - 4 MHz */
437
#define XT2S_2                 (0x80)         /* Mode 2 for XT2 : 2 - 16 MHz */
438
#define XT2S_3                 (0xC0)         /* Mode 3 for XT2 : Digital input signal */
439
 
440
/************************************************************
441
* Comparator A
442
************************************************************/
443
#define __MSP430_HAS_CAPLUS__                 /* Definition to show that Module is available */
444
 
445
SFR_8BIT(CACTL1);                             /* Comparator A Control 1 */
446
SFR_8BIT(CACTL2);                             /* Comparator A Control 2 */
447
SFR_8BIT(CAPD);                               /* Comparator A Port Disable */
448
 
449
#define CAIFG                  (0x01)         /* Comp. A Interrupt Flag */
450
#define CAIE                   (0x02)         /* Comp. A Interrupt Enable */
451
#define CAIES                  (0x04)         /* Comp. A Int. Edge Select: 0:rising / 1:falling */
452
#define CAON                   (0x08)         /* Comp. A enable */
453
#define CAREF0                 (0x10)         /* Comp. A Internal Reference Select 0 */
454
#define CAREF1                 (0x20)         /* Comp. A Internal Reference Select 1 */
455
#define CARSEL                 (0x40)         /* Comp. A Internal Reference Enable */
456
#define CAEX                   (0x80)         /* Comp. A Exchange Inputs */
457
 
458
#define CAREF_0                (0x00)         /* Comp. A Int. Ref. Select 0 : Off */
459
#define CAREF_1                (0x10)         /* Comp. A Int. Ref. Select 1 : 0.25*Vcc */
460
#define CAREF_2                (0x20)         /* Comp. A Int. Ref. Select 2 : 0.5*Vcc */
461
#define CAREF_3                (0x30)         /* Comp. A Int. Ref. Select 3 : Vt*/
462
 
463
#define CAOUT                  (0x01)         /* Comp. A Output */
464
#define CAF                    (0x02)         /* Comp. A Enable Output Filter */
465
#define P2CA0                  (0x04)         /* Comp. A +Terminal Multiplexer */
466
#define P2CA1                  (0x08)         /* Comp. A -Terminal Multiplexer */
467
#define P2CA2                  (0x10)         /* Comp. A -Terminal Multiplexer */
468
#define P2CA3                  (0x20)         /* Comp. A -Terminal Multiplexer */
469
#define P2CA4                  (0x40)         /* Comp. A +Terminal Multiplexer */
470
#define CASHORT                (0x80)         /* Comp. A Short + and - Terminals */
471
 
472
#define CAPD0                  (0x01)         /* Comp. A Disable Input Buffer of Port Register .0 */
473
#define CAPD1                  (0x02)         /* Comp. A Disable Input Buffer of Port Register .1 */
474
#define CAPD2                  (0x04)         /* Comp. A Disable Input Buffer of Port Register .2 */
475
#define CAPD3                  (0x08)         /* Comp. A Disable Input Buffer of Port Register .3 */
476
#define CAPD4                  (0x10)         /* Comp. A Disable Input Buffer of Port Register .4 */
477
#define CAPD5                  (0x20)         /* Comp. A Disable Input Buffer of Port Register .5 */
478
#define CAPD6                  (0x40)         /* Comp. A Disable Input Buffer of Port Register .6 */
479
#define CAPD7                  (0x80)         /* Comp. A Disable Input Buffer of Port Register .7 */
480
 
481
/*************************************************************
482
* Flash Memory
483
*************************************************************/
484
#define __MSP430_HAS_FLASH2__                 /* Definition to show that Module is available */
485
 
486
SFR_16BIT(FCTL1);                             /* FLASH Control 1 */
487
SFR_16BIT(FCTL2);                             /* FLASH Control 2 */
488
SFR_16BIT(FCTL3);                             /* FLASH Control 3 */
489
SFR_16BIT(FCTL4);                             /* FLASH Control 4 */
490
 
491
#define FRKEY                  (0x9600)       /* Flash key returned by read */
492
#define FWKEY                  (0xA500)       /* Flash key for write */
493
#define FXKEY                  (0x3300)       /* for use with XOR instruction */
494
 
495
#define ERASE                  (0x0002)       /* Enable bit for Flash segment erase */
496
#define MERAS                  (0x0004)       /* Enable bit for Flash mass erase */
497
#define EEI                    (0x0008)       /* Enable Erase Interrupts */
498
#define EEIEX                  (0x0010)       /* Enable Emergency Interrupt Exit */
499
#define WRT                    (0x0040)       /* Enable bit for Flash write */
500
#define BLKWRT                 (0x0080)       /* Enable bit for Flash segment write */
501
#define SEGWRT                 (0x0080)       /* old definition */ /* Enable bit for Flash segment write */
502
 
503
#define FN0                    (0x0001)       /* Divide Flash clock by 1 to 64 using FN0 to FN5 according to: */
504
#define FN1                    (0x0002)       /*  32*FN5 + 16*FN4 + 8*FN3 + 4*FN2 + 2*FN1 + FN0 + 1 */
505
#ifndef FN2
506
#define FN2                    (0x0004)
507
#endif
508
#ifndef FN3
509
#define FN3                    (0x0008)
510
#endif
511
#ifndef FN4
512
#define FN4                    (0x0010)
513
#endif
514
#define FN5                    (0x0020)
515
#define FSSEL0                 (0x0040)       /* Flash clock select 0 */        /* to distinguish from USART SSELx */
516
#define FSSEL1                 (0x0080)       /* Flash clock select 1 */
517
 
518
#define FSSEL_0                (0x0000)       /* Flash clock select: 0 - ACLK */
519
#define FSSEL_1                (0x0040)       /* Flash clock select: 1 - MCLK */
520
#define FSSEL_2                (0x0080)       /* Flash clock select: 2 - SMCLK */
521
#define FSSEL_3                (0x00C0)       /* Flash clock select: 3 - SMCLK */
522
 
523
#define BUSY                   (0x0001)       /* Flash busy: 1 */
524
#define KEYV                   (0x0002)       /* Flash Key violation flag */
525
#define ACCVIFG                (0x0004)       /* Flash Access violation flag */
526
#define WAIT                   (0x0008)       /* Wait flag for segment write */
527
#define LOCK                   (0x0010)       /* Lock bit: 1 - Flash is locked (read only) */
528
#define EMEX                   (0x0020)       /* Flash Emergency Exit */
529
#define LOCKA                  (0x0040)       /* Segment A Lock bit: read = 1 - Segment is locked (read only) */
530
#define FAIL                   (0x0080)       /* Last Program or Erase failed */
531
 
532
#define MGR0                   (0x0010)       /* Marginal read 0 mode. */
533
#define MGR1                   (0x0020)       /* Marginal read 1 mode. */
534
 
535
/************************************************************
536
* HARDWARE MULTIPLIER
537
************************************************************/
538
#define __MSP430_HAS_MPY__                    /* Definition to show that Module is available */
539
 
540
SFR_16BIT(MPY);                               /* Multiply Unsigned/Operand 1 */
541
SFR_16BIT(MPYS);                              /* Multiply Signed/Operand 1 */
542
SFR_16BIT(MAC);                               /* Multiply Unsigned and Accumulate/Operand 1 */
543
SFR_16BIT(MACS);                              /* Multiply Signed and Accumulate/Operand 1 */
544
SFR_16BIT(OP2);                               /* Operand 2 */
545
SFR_16BIT(RESLO);                             /* Result Low Word */
546
SFR_16BIT(RESHI);                             /* Result High Word */
547
SFR_16BIT(SUMEXT);                            /* Sum Extend */
548
 
549
/************************************************************
550
* DIGITAL I/O Port1/2 Pull up / Pull down Resistors
551
************************************************************/
552
#define __MSP430_HAS_PORT1_R__                /* Definition to show that Module is available */
553
#define __MSP430_HAS_PORT2_R__                /* Definition to show that Module is available */
554
 
555
SFR_8BIT(P1IN);                               /* Port 1 Input */
556
SFR_8BIT(P1OUT);                              /* Port 1 Output */
557
SFR_8BIT(P1DIR);                              /* Port 1 Direction */
558
SFR_8BIT(P1IFG);                              /* Port 1 Interrupt Flag */
559
SFR_8BIT(P1IES);                              /* Port 1 Interrupt Edge Select */
560
SFR_8BIT(P1IE);                               /* Port 1 Interrupt Enable */
561
SFR_8BIT(P1SEL);                              /* Port 1 Selection */
562
SFR_8BIT(P1REN);                              /* Port 1 Resistor Enable */
563
 
564
SFR_8BIT(P2IN);                               /* Port 2 Input */
565
SFR_8BIT(P2OUT);                              /* Port 2 Output */
566
SFR_8BIT(P2DIR);                              /* Port 2 Direction */
567
SFR_8BIT(P2IFG);                              /* Port 2 Interrupt Flag */
568
SFR_8BIT(P2IES);                              /* Port 2 Interrupt Edge Select */
569
SFR_8BIT(P2IE);                               /* Port 2 Interrupt Enable */
570
SFR_8BIT(P2SEL);                              /* Port 2 Selection */
571
SFR_8BIT(P2REN);                              /* Port 2 Resistor Enable */
572
 
573
/************************************************************
574
* DIGITAL I/O Port3/4 Pull up / Pull down Resistors
575
************************************************************/
576
#define __MSP430_HAS_PORT3_R__                /* Definition to show that Module is available */
577
#define __MSP430_HAS_PORT4_R__                /* Definition to show that Module is available */
578
 
579
SFR_8BIT(P3IN);                               /* Port 3 Input */
580
SFR_8BIT(P3OUT);                              /* Port 3 Output */
581
SFR_8BIT(P3DIR);                              /* Port 3 Direction */
582
SFR_8BIT(P3SEL);                              /* Port 3 Selection */
583
SFR_8BIT(P3REN);                              /* Port 3 Resistor Enable */
584
 
585
SFR_8BIT(P4IN);                               /* Port 4 Input */
586
SFR_8BIT(P4OUT);                              /* Port 4 Output */
587
SFR_8BIT(P4DIR);                              /* Port 4 Direction */
588
SFR_8BIT(P4SEL);                              /* Port 4 Selection */
589
SFR_8BIT(P4REN);                              /* Port 4 Resistor Enable */
590
 
591
/************************************************************
592
* DIGITAL I/O Port5/6 Pull up / Pull down Resistors
593
************************************************************/
594
#define __MSP430_HAS_PORT5_R__                /* Definition to show that Module is available */
595
#define __MSP430_HAS_PORT6_R__                /* Definition to show that Module is available */
596
 
597
SFR_8BIT(P5IN);                               /* Port 5 Input */
598
SFR_8BIT(P5OUT);                              /* Port 5 Output */
599
SFR_8BIT(P5DIR);                              /* Port 5 Direction */
600
SFR_8BIT(P5SEL);                              /* Port 5 Selection */
601
SFR_8BIT(P5REN);                              /* Port 5 Resistor Enable */
602
 
603
SFR_8BIT(P6IN);                               /* Port 6 Input */
604
SFR_8BIT(P6OUT);                              /* Port 6 Output */
605
SFR_8BIT(P6DIR);                              /* Port 6 Direction */
606
SFR_8BIT(P6SEL);                              /* Port 6 Selection */
607
SFR_8BIT(P6REN);                              /* Port 6 Resistor Enable */
608
 
609
/************************************************************
610
* Brown-Out, Supply Voltage Supervision (SVS)
611
************************************************************/
612
#define __MSP430_HAS_SVS__                    /* Definition to show that Module is available */
613
 
614
SFR_8BIT(SVSCTL);                             /* SVS Control */
615
#define SVSFG                  (0x01)         /* SVS Flag */
616
#define SVSOP                  (0x02)         /* SVS output (read only) */
617
#define SVSON                  (0x04)         /* Switches the SVS on/off */
618
#define PORON                  (0x08)         /* Enable POR Generation if Low Voltage */
619
#define VLD0                   (0x10)
620
#define VLD1                   (0x20)
621
#define VLD2                   (0x40)
622
#define VLD3                   (0x80)
623
 
624
#define VLDON                  (0x10)
625
#define VLDOFF                 (0x00)
626
#define VLD_1_8V               (0x10)
627
 
628
/************************************************************
629
* Timer A3
630
************************************************************/
631
#define __MSP430_HAS_TA3__                    /* Definition to show that Module is available */
632
 
633
SFR_16BIT(TAIV);                              /* Timer A Interrupt Vector Word */
634
SFR_16BIT(TACTL);                             /* Timer A Control */
635
SFR_16BIT(TACCTL0);                           /* Timer A Capture/Compare Control 0 */
636
SFR_16BIT(TACCTL1);                           /* Timer A Capture/Compare Control 1 */
637
SFR_16BIT(TACCTL2);                           /* Timer A Capture/Compare Control 2 */
638
SFR_16BIT(TAR);                               /* Timer A Counter Register */
639
SFR_16BIT(TACCR0);                            /* Timer A Capture/Compare 0 */
640
SFR_16BIT(TACCR1);                            /* Timer A Capture/Compare 1 */
641
SFR_16BIT(TACCR2);                            /* Timer A Capture/Compare 2 */
642
 
643
/* Alternate register names */
644
#define CCTL0                  TACCTL0        /* Timer A Capture/Compare Control 0 */
645
#define CCTL1                  TACCTL1        /* Timer A Capture/Compare Control 1 */
646
#define CCTL2                  TACCTL2        /* Timer A Capture/Compare Control 2 */
647
#define CCR0                   TACCR0         /* Timer A Capture/Compare 0 */
648
#define CCR1                   TACCR1         /* Timer A Capture/Compare 1 */
649
#define CCR2                   TACCR2         /* Timer A Capture/Compare 2 */
650
#define CCTL0_                 TACCTL0_       /* Timer A Capture/Compare Control 0 */
651
#define CCTL1_                 TACCTL1_       /* Timer A Capture/Compare Control 1 */
652
#define CCTL2_                 TACCTL2_       /* Timer A Capture/Compare Control 2 */
653
#define CCR0_                  TACCR0_        /* Timer A Capture/Compare 0 */
654
#define CCR1_                  TACCR1_        /* Timer A Capture/Compare 1 */
655
#define CCR2_                  TACCR2_        /* Timer A Capture/Compare 2 */
656
/* Alternate register names - 5xx style */
657
#define TA0IV                  TAIV           /* Timer A Interrupt Vector Word */
658
#define TA0CTL                 TACTL          /* Timer A Control */
659
#define TA0CCTL0               TACCTL0        /* Timer A Capture/Compare Control 0 */
660
#define TA0CCTL1               TACCTL1        /* Timer A Capture/Compare Control 1 */
661
#define TA0CCTL2               TACCTL2        /* Timer A Capture/Compare Control 2 */
662
#define TA0R                   TAR            /* Timer A Counter Register */
663
#define TA0CCR0                TACCR0         /* Timer A Capture/Compare 0 */
664
#define TA0CCR1                TACCR1         /* Timer A Capture/Compare 1 */
665
#define TA0CCR2                TACCR2         /* Timer A Capture/Compare 2 */
666
#define TA0IV_                 TAIV_          /* Timer A Interrupt Vector Word */
667
#define TA0CTL_                TACTL_         /* Timer A Control */
668
#define TA0CCTL0_              TACCTL0_       /* Timer A Capture/Compare Control 0 */
669
#define TA0CCTL1_              TACCTL1_       /* Timer A Capture/Compare Control 1 */
670
#define TA0CCTL2_              TACCTL2_       /* Timer A Capture/Compare Control 2 */
671
#define TA0R_                  TAR_           /* Timer A Counter Register */
672
#define TA0CCR0_               TACCR0_        /* Timer A Capture/Compare 0 */
673
#define TA0CCR1_               TACCR1_        /* Timer A Capture/Compare 1 */
674
#define TA0CCR2_               TACCR2_        /* Timer A Capture/Compare 2 */
675
 
676
#define TASSEL1                (0x0200)       /* Timer A clock source select 0 */
677
#define TASSEL0                (0x0100)       /* Timer A clock source select 1 */
678
#define ID1                    (0x0080)       /* Timer A clock input divider 1 */
679
#define ID0                    (0x0040)       /* Timer A clock input divider 0 */
680
#define MC1                    (0x0020)       /* Timer A mode control 1 */
681
#define MC0                    (0x0010)       /* Timer A mode control 0 */
682
#define TACLR                  (0x0004)       /* Timer A counter clear */
683
#define TAIE                   (0x0002)       /* Timer A counter interrupt enable */
684
#define TAIFG                  (0x0001)       /* Timer A counter interrupt flag */
685
 
686
#define MC_0                   (0*0x10u)      /* Timer A mode control: 0 - Stop */
687
#define MC_1                   (1*0x10u)      /* Timer A mode control: 1 - Up to CCR0 */
688
#define MC_2                   (2*0x10u)      /* Timer A mode control: 2 - Continous up */
689
#define MC_3                   (3*0x10u)      /* Timer A mode control: 3 - Up/Down */
690
#define ID_0                   (0*0x40u)      /* Timer A input divider: 0 - /1 */
691
#define ID_1                   (1*0x40u)      /* Timer A input divider: 1 - /2 */
692
#define ID_2                   (2*0x40u)      /* Timer A input divider: 2 - /4 */
693
#define ID_3                   (3*0x40u)      /* Timer A input divider: 3 - /8 */
694
#define TASSEL_0               (0*0x100u)     /* Timer A clock source select: 0 - TACLK */
695
#define TASSEL_1               (1*0x100u)     /* Timer A clock source select: 1 - ACLK  */
696
#define TASSEL_2               (2*0x100u)     /* Timer A clock source select: 2 - SMCLK */
697
#define TASSEL_3               (3*0x100u)     /* Timer A clock source select: 3 - INCLK */
698
 
699
#define CM1                    (0x8000)       /* Capture mode 1 */
700
#define CM0                    (0x4000)       /* Capture mode 0 */
701
#define CCIS1                  (0x2000)       /* Capture input select 1 */
702
#define CCIS0                  (0x1000)       /* Capture input select 0 */
703
#define SCS                    (0x0800)       /* Capture sychronize */
704
#define SCCI                   (0x0400)       /* Latched capture signal (read) */
705
#define CAP                    (0x0100)       /* Capture mode: 1 /Compare mode : 0 */
706
#define OUTMOD2                (0x0080)       /* Output mode 2 */
707
#define OUTMOD1                (0x0040)       /* Output mode 1 */
708
#define OUTMOD0                (0x0020)       /* Output mode 0 */
709
#define CCIE                   (0x0010)       /* Capture/compare interrupt enable */
710
#define CCI                    (0x0008)       /* Capture input signal (read) */
711
#define OUT                    (0x0004)       /* PWM Output signal if output mode 0 */
712
#define COV                    (0x0002)       /* Capture/compare overflow flag */
713
#define CCIFG                  (0x0001)       /* Capture/compare interrupt flag */
714
 
715
#define OUTMOD_0               (0*0x20u)      /* PWM output mode: 0 - output only */
716
#define OUTMOD_1               (1*0x20u)      /* PWM output mode: 1 - set */
717
#define OUTMOD_2               (2*0x20u)      /* PWM output mode: 2 - PWM toggle/reset */
718
#define OUTMOD_3               (3*0x20u)      /* PWM output mode: 3 - PWM set/reset */
719
#define OUTMOD_4               (4*0x20u)      /* PWM output mode: 4 - toggle */
720
#define OUTMOD_5               (5*0x20u)      /* PWM output mode: 5 - Reset */
721
#define OUTMOD_6               (6*0x20u)      /* PWM output mode: 6 - PWM toggle/set */
722
#define OUTMOD_7               (7*0x20u)      /* PWM output mode: 7 - PWM reset/set */
723
#define CCIS_0                 (0*0x1000u)    /* Capture input select: 0 - CCIxA */
724
#define CCIS_1                 (1*0x1000u)    /* Capture input select: 1 - CCIxB */
725
#define CCIS_2                 (2*0x1000u)    /* Capture input select: 2 - GND */
726
#define CCIS_3                 (3*0x1000u)    /* Capture input select: 3 - Vcc */
727
#define CM_0                   (0*0x4000u)    /* Capture mode: 0 - disabled */
728
#define CM_1                   (1*0x4000u)    /* Capture mode: 1 - pos. edge */
729
#define CM_2                   (2*0x4000u)    /* Capture mode: 1 - neg. edge */
730
#define CM_3                   (3*0x4000u)    /* Capture mode: 1 - both edges */
731
 
732
/* TA3IV Definitions */
733
#define TAIV_NONE              (0x0000)       /* No Interrupt pending */
734
#define TAIV_TACCR1            (0x0002)       /* TACCR1_CCIFG */
735
#define TAIV_TACCR2            (0x0004)       /* TACCR2_CCIFG */
736
#define TAIV_6                 (0x0006)       /* Reserved */
737
#define TAIV_8                 (0x0008)       /* Reserved */
738
#define TAIV_TAIFG             (0x000A)       /* TAIFG */
739
 
740
/************************************************************
741
* Timer B3
742
************************************************************/
743
#define __MSP430_HAS_TB3__                    /* Definition to show that Module is available */
744
 
745
SFR_16BIT(TBIV);                              /* Timer B Interrupt Vector Word */
746
SFR_16BIT(TBCTL);                             /* Timer B Control */
747
SFR_16BIT(TBCCTL0);                           /* Timer B Capture/Compare Control 0 */
748
SFR_16BIT(TBCCTL1);                           /* Timer B Capture/Compare Control 1 */
749
SFR_16BIT(TBCCTL2);                           /* Timer B Capture/Compare Control 2 */
750
SFR_16BIT(TBR);                               /* Timer B Counter Register */
751
SFR_16BIT(TBCCR0);                            /* Timer B Capture/Compare 0 */
752
SFR_16BIT(TBCCR1);                            /* Timer B Capture/Compare 1 */
753
SFR_16BIT(TBCCR2);                            /* Timer B Capture/Compare 2 */
754
 
755
/* Alternate register names - 5xx style */
756
#define TB0IV                  TBIV           /* Timer B Interrupt Vector Word */
757
#define TB0CTL                 TBCTL          /* Timer B Control */
758
#define TB0CCTL0               TBCCTL0        /* Timer B Capture/Compare Control 0 */
759
#define TB0CCTL1               TBCCTL1        /* Timer B Capture/Compare Control 1 */
760
#define TB0CCTL2               TBCCTL2        /* Timer B Capture/Compare Control 2 */
761
#define TB0R                   TBR            /* Timer B Counter Register */
762
#define TB0CCR0                TBCCR0         /* Timer B Capture/Compare 0 */
763
#define TB0CCR1                TBCCR1         /* Timer B Capture/Compare 1 */
764
#define TB0CCR2                TBCCR2         /* Timer B Capture/Compare 2 */
765
#define TB0IV_                 TBIV_          /* Timer B Interrupt Vector Word */
766
#define TB0CTL_                TBCTL_         /* Timer B Control */
767
#define TB0CCTL0_              TBCCTL0_       /* Timer B Capture/Compare Control 0 */
768
#define TB0CCTL1_              TBCCTL1_       /* Timer B Capture/Compare Control 1 */
769
#define TB0CCTL2_              TBCCTL2_       /* Timer B Capture/Compare Control 2 */
770
#define TB0R_                  TBR_           /* Timer B Counter Register */
771
#define TB0CCR0_               TBCCR0_        /* Timer B Capture/Compare 0 */
772
#define TB0CCR1_               TBCCR1_        /* Timer B Capture/Compare 1 */
773
#define TB0CCR2_               TBCCR2_        /* Timer B Capture/Compare 2 */
774
 
775
#define TBCLGRP1               (0x4000)       /* Timer B Compare latch load group 1 */
776
#define TBCLGRP0               (0x2000)       /* Timer B Compare latch load group 0 */
777
#define CNTL1                  (0x1000)       /* Counter lenght 1 */
778
#define CNTL0                  (0x0800)       /* Counter lenght 0 */
779
#define TBSSEL1                (0x0200)       /* Clock source 1 */
780
#define TBSSEL0                (0x0100)       /* Clock source 0 */
781
#define TBCLR                  (0x0004)       /* Timer B counter clear */
782
#define TBIE                   (0x0002)       /* Timer B interrupt enable */
783
#define TBIFG                  (0x0001)       /* Timer B interrupt flag */
784
 
785
#define SHR1                   (0x4000)       /* Timer B Compare latch load group 1 */
786
#define SHR0                   (0x2000)       /* Timer B Compare latch load group 0 */
787
 
788
#define TBSSEL_0               (0*0x0100u)    /* Clock Source: TBCLK */
789
#define TBSSEL_1               (1*0x0100u)    /* Clock Source: ACLK  */
790
#define TBSSEL_2               (2*0x0100u)    /* Clock Source: SMCLK */
791
#define TBSSEL_3               (3*0x0100u)    /* Clock Source: INCLK */
792
#define CNTL_0                 (0*0x0800u)    /* Counter lenght: 16 bit */
793
#define CNTL_1                 (1*0x0800u)    /* Counter lenght: 12 bit */
794
#define CNTL_2                 (2*0x0800u)    /* Counter lenght: 10 bit */
795
#define CNTL_3                 (3*0x0800u)    /* Counter lenght:  8 bit */
796
#define SHR_0                  (0*0x2000u)    /* Timer B Group: 0 - individually */
797
#define SHR_1                  (1*0x2000u)    /* Timer B Group: 1 - 3 groups (1-2, 3-4, 5-6) */
798
#define SHR_2                  (2*0x2000u)    /* Timer B Group: 2 - 2 groups (1-3, 4-6)*/
799
#define SHR_3                  (3*0x2000u)    /* Timer B Group: 3 - 1 group (all) */
800
#define TBCLGRP_0              (0*0x2000u)    /* Timer B Group: 0 - individually */
801
#define TBCLGRP_1              (1*0x2000u)    /* Timer B Group: 1 - 3 groups (1-2, 3-4, 5-6) */
802
#define TBCLGRP_2              (2*0x2000u)    /* Timer B Group: 2 - 2 groups (1-3, 4-6)*/
803
#define TBCLGRP_3              (3*0x2000u)    /* Timer B Group: 3 - 1 group (all) */
804
 
805
/* Additional Timer B Control Register bits are defined in Timer A */
806
 
807
#define CLLD1                  (0x0400)       /* Compare latch load source 1 */
808
#define CLLD0                  (0x0200)       /* Compare latch load source 0 */
809
 
810
#define SLSHR1                 (0x0400)       /* Compare latch load source 1 */
811
#define SLSHR0                 (0x0200)       /* Compare latch load source 0 */
812
 
813
#define SLSHR_0                (0*0x0200u)    /* Compare latch load sourec : 0 - immediate */
814
#define SLSHR_1                (1*0x0200u)    /* Compare latch load sourec : 1 - TBR counts to 0 */
815
#define SLSHR_2                (2*0x0200u)    /* Compare latch load sourec : 2 - up/down */
816
#define SLSHR_3                (3*0x0200u)    /* Compare latch load sourec : 3 - TBR counts to TBCTL0 */
817
 
818
#define CLLD_0                 (0*0x0200u)    /* Compare latch load sourec : 0 - immediate */
819
#define CLLD_1                 (1*0x0200u)    /* Compare latch load sourec : 1 - TBR counts to 0 */
820
#define CLLD_2                 (2*0x0200u)    /* Compare latch load sourec : 2 - up/down */
821
#define CLLD_3                 (3*0x0200u)    /* Compare latch load sourec : 3 - TBR counts to TBCTL0 */
822
 
823
/* TB3IV Definitions */
824
#define TBIV_NONE              (0x0000)       /* No Interrupt pending */
825
#define TBIV_TBCCR1            (0x0002)       /* TBCCR1_CCIFG */
826
#define TBIV_TBCCR2            (0x0004)       /* TBCCR2_CCIFG */
827
#define TBIV_3                 (0x0006)       /* Reserved */
828
#define TBIV_4                 (0x0008)       /* Reserved */
829
#define TBIV_5                 (0x000A)       /* Reserved */
830
#define TBIV_6                 (0x000C)       /* Reserved */
831
#define TBIV_TBIFG             (0x000E)       /* TBIFG */
832
 
833
/************************************************************
834
* USCI
835
************************************************************/
836
#define __MSP430_HAS_USCI__                   /* Definition to show that Module is available */
837
 
838
SFR_8BIT(UCA0CTL0);                           /* USCI A0 Control Register 0 */
839
SFR_8BIT(UCA0CTL1);                           /* USCI A0 Control Register 1 */
840
SFR_8BIT(UCA0BR0);                            /* USCI A0 Baud Rate 0 */
841
SFR_8BIT(UCA0BR1);                            /* USCI A0 Baud Rate 1 */
842
SFR_8BIT(UCA0MCTL);                           /* USCI A0 Modulation Control */
843
SFR_8BIT(UCA0STAT);                           /* USCI A0 Status Register */
844
SFR_8BIT(UCA0RXBUF);                          /* USCI A0 Receive Buffer */
845
SFR_8BIT(UCA0TXBUF);                          /* USCI A0 Transmit Buffer */
846
SFR_8BIT(UCA0ABCTL);                          /* USCI A0 LIN Control */
847
SFR_8BIT(UCA0IRTCTL);                         /* USCI A0 IrDA Transmit Control */
848
SFR_8BIT(UCA0IRRCTL);                         /* USCI A0 IrDA Receive Control */
849
 
850
 
851
 
852
SFR_8BIT(UCB0CTL0);                           /* USCI B0 Control Register 0 */
853
SFR_8BIT(UCB0CTL1);                           /* USCI B0 Control Register 1 */
854
SFR_8BIT(UCB0BR0);                            /* USCI B0 Baud Rate 0 */
855
SFR_8BIT(UCB0BR1);                            /* USCI B0 Baud Rate 1 */
856
SFR_8BIT(UCB0I2CIE);                          /* USCI B0 I2C Interrupt Enable Register */
857
SFR_8BIT(UCB0STAT);                           /* USCI B0 Status Register */
858
SFR_8BIT(UCB0RXBUF);                          /* USCI B0 Receive Buffer */
859
SFR_8BIT(UCB0TXBUF);                          /* USCI B0 Transmit Buffer */
860
SFR_16BIT(UCB0I2COA);                         /* USCI B0 I2C Own Address */
861
SFR_16BIT(UCB0I2CSA);                         /* USCI B0 I2C Slave Address */
862
 
863
// UART-Mode Bits
864
#define UCPEN                  (0x80)         /* Async. Mode: Parity enable */
865
#define UCPAR                  (0x40)         /* Async. Mode: Parity     0:odd / 1:even */
866
#define UCMSB                  (0x20)         /* Async. Mode: MSB first  0:LSB / 1:MSB */
867
#define UC7BIT                 (0x10)         /* Async. Mode: Data Bits  0:8-bits / 1:7-bits */
868
#define UCSPB                  (0x08)         /* Async. Mode: Stop Bits  0:one / 1: two */
869
#define UCMODE1                (0x04)         /* Async. Mode: USCI Mode 1 */
870
#define UCMODE0                (0x02)         /* Async. Mode: USCI Mode 0 */
871
#define UCSYNC                 (0x01)         /* Sync-Mode  0:UART-Mode / 1:SPI-Mode */
872
 
873
// SPI-Mode Bits
874
#define UCCKPH                 (0x80)         /* Sync. Mode: Clock Phase */
875
#define UCCKPL                 (0x40)         /* Sync. Mode: Clock Polarity */
876
#define UCMST                  (0x08)         /* Sync. Mode: Master Select */
877
 
878
// I2C-Mode Bits
879
#define UCA10                  (0x80)         /* 10-bit Address Mode */
880
#define UCSLA10                (0x40)         /* 10-bit Slave Address Mode */
881
#define UCMM                   (0x20)         /* Multi-Master Environment */
882
//#define res               (0x10)    /* reserved */
883
#define UCMODE_0               (0x00)         /* Sync. Mode: USCI Mode: 0 */
884
#define UCMODE_1               (0x02)         /* Sync. Mode: USCI Mode: 1 */
885
#define UCMODE_2               (0x04)         /* Sync. Mode: USCI Mode: 2 */
886
#define UCMODE_3               (0x06)         /* Sync. Mode: USCI Mode: 3 */
887
 
888
// UART-Mode Bits
889
#define UCSSEL1                (0x80)         /* USCI 0 Clock Source Select 1 */
890
#define UCSSEL0                (0x40)         /* USCI 0 Clock Source Select 0 */
891
#define UCRXEIE                (0x20)         /* RX Error interrupt enable */
892
#define UCBRKIE                (0x10)         /* Break interrupt enable */
893
#define UCDORM                 (0x08)         /* Dormant (Sleep) Mode */
894
#define UCTXADDR               (0x04)         /* Send next Data as Address */
895
#define UCTXBRK                (0x02)         /* Send next Data as Break */
896
#define UCSWRST                (0x01)         /* USCI Software Reset */
897
 
898
// SPI-Mode Bits
899
//#define res               (0x20)    /* reserved */
900
//#define res               (0x10)    /* reserved */
901
//#define res               (0x08)    /* reserved */
902
//#define res               (0x04)    /* reserved */
903
//#define res               (0x02)    /* reserved */
904
 
905
// I2C-Mode Bits
906
//#define res               (0x20)    /* reserved */
907
#define UCTR                   (0x10)         /* Transmit/Receive Select/Flag */
908
#define UCTXNACK               (0x08)         /* Transmit NACK */
909
#define UCTXSTP                (0x04)         /* Transmit STOP */
910
#define UCTXSTT                (0x02)         /* Transmit START */
911
#define UCSSEL_0               (0x00)         /* USCI 0 Clock Source: 0 */
912
#define UCSSEL_1               (0x40)         /* USCI 0 Clock Source: 1 */
913
#define UCSSEL_2               (0x80)         /* USCI 0 Clock Source: 2 */
914
#define UCSSEL_3               (0xC0)         /* USCI 0 Clock Source: 3 */
915
 
916
#define UCBRF3                 (0x80)         /* USCI First Stage Modulation Select 3 */
917
#define UCBRF2                 (0x40)         /* USCI First Stage Modulation Select 2 */
918
#define UCBRF1                 (0x20)         /* USCI First Stage Modulation Select 1 */
919
#define UCBRF0                 (0x10)         /* USCI First Stage Modulation Select 0 */
920
#define UCBRS2                 (0x08)         /* USCI Second Stage Modulation Select 2 */
921
#define UCBRS1                 (0x04)         /* USCI Second Stage Modulation Select 1 */
922
#define UCBRS0                 (0x02)         /* USCI Second Stage Modulation Select 0 */
923
#define UCOS16                 (0x01)         /* USCI 16-times Oversampling enable */
924
 
925
#define UCBRF_0                (0x00)         /* USCI First Stage Modulation: 0 */
926
#define UCBRF_1                (0x10)         /* USCI First Stage Modulation: 1 */
927
#define UCBRF_2                (0x20)         /* USCI First Stage Modulation: 2 */
928
#define UCBRF_3                (0x30)         /* USCI First Stage Modulation: 3 */
929
#define UCBRF_4                (0x40)         /* USCI First Stage Modulation: 4 */
930
#define UCBRF_5                (0x50)         /* USCI First Stage Modulation: 5 */
931
#define UCBRF_6                (0x60)         /* USCI First Stage Modulation: 6 */
932
#define UCBRF_7                (0x70)         /* USCI First Stage Modulation: 7 */
933
#define UCBRF_8                (0x80)         /* USCI First Stage Modulation: 8 */
934
#define UCBRF_9                (0x90)         /* USCI First Stage Modulation: 9 */
935
#define UCBRF_10               (0xA0)         /* USCI First Stage Modulation: A */
936
#define UCBRF_11               (0xB0)         /* USCI First Stage Modulation: B */
937
#define UCBRF_12               (0xC0)         /* USCI First Stage Modulation: C */
938
#define UCBRF_13               (0xD0)         /* USCI First Stage Modulation: D */
939
#define UCBRF_14               (0xE0)         /* USCI First Stage Modulation: E */
940
#define UCBRF_15               (0xF0)         /* USCI First Stage Modulation: F */
941
 
942
#define UCBRS_0                (0x00)         /* USCI Second Stage Modulation: 0 */
943
#define UCBRS_1                (0x02)         /* USCI Second Stage Modulation: 1 */
944
#define UCBRS_2                (0x04)         /* USCI Second Stage Modulation: 2 */
945
#define UCBRS_3                (0x06)         /* USCI Second Stage Modulation: 3 */
946
#define UCBRS_4                (0x08)         /* USCI Second Stage Modulation: 4 */
947
#define UCBRS_5                (0x0A)         /* USCI Second Stage Modulation: 5 */
948
#define UCBRS_6                (0x0C)         /* USCI Second Stage Modulation: 6 */
949
#define UCBRS_7                (0x0E)         /* USCI Second Stage Modulation: 7 */
950
 
951
#define UCLISTEN               (0x80)         /* USCI Listen mode */
952
#define UCFE                   (0x40)         /* USCI Frame Error Flag */
953
#define UCOE                   (0x20)         /* USCI Overrun Error Flag */
954
#define UCPE                   (0x10)         /* USCI Parity Error Flag */
955
#define UCBRK                  (0x08)         /* USCI Break received */
956
#define UCRXERR                (0x04)         /* USCI RX Error Flag */
957
#define UCADDR                 (0x02)         /* USCI Address received Flag */
958
#define UCBUSY                 (0x01)         /* USCI Busy Flag */
959
#define UCIDLE                 (0x02)         /* USCI Idle line detected Flag */
960
 
961
//#define res               (0x80)    /* reserved */
962
//#define res               (0x40)    /* reserved */
963
//#define res               (0x20)    /* reserved */
964
//#define res               (0x10)    /* reserved */
965
#define UCNACKIE               (0x08)         /* NACK Condition interrupt enable */
966
#define UCSTPIE                (0x04)         /* STOP Condition interrupt enable */
967
#define UCSTTIE                (0x02)         /* START Condition interrupt enable */
968
#define UCALIE                 (0x01)         /* Arbitration Lost interrupt enable */
969
 
970
#define UCSCLLOW               (0x40)         /* SCL low */
971
#define UCGC                   (0x20)         /* General Call address received Flag */
972
#define UCBBUSY                (0x10)         /* Bus Busy Flag */
973
#define UCNACKIFG              (0x08)         /* NAK Condition interrupt Flag */
974
#define UCSTPIFG               (0x04)         /* STOP Condition interrupt Flag */
975
#define UCSTTIFG               (0x02)         /* START Condition interrupt Flag */
976
#define UCALIFG                (0x01)         /* Arbitration Lost interrupt Flag */
977
 
978
#define UCIRTXPL5              (0x80)         /* IRDA Transmit Pulse Length 5 */
979
#define UCIRTXPL4              (0x40)         /* IRDA Transmit Pulse Length 4 */
980
#define UCIRTXPL3              (0x20)         /* IRDA Transmit Pulse Length 3 */
981
#define UCIRTXPL2              (0x10)         /* IRDA Transmit Pulse Length 2 */
982
#define UCIRTXPL1              (0x08)         /* IRDA Transmit Pulse Length 1 */
983
#define UCIRTXPL0              (0x04)         /* IRDA Transmit Pulse Length 0 */
984
#define UCIRTXCLK              (0x02)         /* IRDA Transmit Pulse Clock Select */
985
#define UCIREN                 (0x01)         /* IRDA Encoder/Decoder enable */
986
 
987
#define UCIRRXFL5              (0x80)         /* IRDA Receive Filter Length 5 */
988
#define UCIRRXFL4              (0x40)         /* IRDA Receive Filter Length 4 */
989
#define UCIRRXFL3              (0x20)         /* IRDA Receive Filter Length 3 */
990
#define UCIRRXFL2              (0x10)         /* IRDA Receive Filter Length 2 */
991
#define UCIRRXFL1              (0x08)         /* IRDA Receive Filter Length 1 */
992
#define UCIRRXFL0              (0x04)         /* IRDA Receive Filter Length 0 */
993
#define UCIRRXPL               (0x02)         /* IRDA Receive Input Polarity */
994
#define UCIRRXFE               (0x01)         /* IRDA Receive Filter enable */
995
 
996
//#define res               (0x80)    /* reserved */
997
//#define res               (0x40)    /* reserved */
998
#define UCDELIM1               (0x20)         /* Break Sync Delimiter 1 */
999
#define UCDELIM0               (0x10)         /* Break Sync Delimiter 0 */
1000
#define UCSTOE                 (0x08)         /* Sync-Field Timeout error */
1001
#define UCBTOE                 (0x04)         /* Break Timeout error */
1002
//#define res               (0x02)    /* reserved */
1003
#define UCABDEN                (0x01)         /* Auto Baud Rate detect enable */
1004
 
1005
#define UCGCEN                 (0x8000)       /* I2C General Call enable */
1006
#define UCOA9                  (0x0200)       /* I2C Own Address 9 */
1007
#define UCOA8                  (0x0100)       /* I2C Own Address 8 */
1008
#define UCOA7                  (0x0080)       /* I2C Own Address 7 */
1009
#define UCOA6                  (0x0040)       /* I2C Own Address 6 */
1010
#define UCOA5                  (0x0020)       /* I2C Own Address 5 */
1011
#define UCOA4                  (0x0010)       /* I2C Own Address 4 */
1012
#define UCOA3                  (0x0008)       /* I2C Own Address 3 */
1013
#define UCOA2                  (0x0004)       /* I2C Own Address 2 */
1014
#define UCOA1                  (0x0002)       /* I2C Own Address 1 */
1015
#define UCOA0                  (0x0001)       /* I2C Own Address 0 */
1016
 
1017
#define UCSA9                  (0x0200)       /* I2C Slave Address 9 */
1018
#define UCSA8                  (0x0100)       /* I2C Slave Address 8 */
1019
#define UCSA7                  (0x0080)       /* I2C Slave Address 7 */
1020
#define UCSA6                  (0x0040)       /* I2C Slave Address 6 */
1021
#define UCSA5                  (0x0020)       /* I2C Slave Address 5 */
1022
#define UCSA4                  (0x0010)       /* I2C Slave Address 4 */
1023
#define UCSA3                  (0x0008)       /* I2C Slave Address 3 */
1024
#define UCSA2                  (0x0004)       /* I2C Slave Address 2 */
1025
#define UCSA1                  (0x0002)       /* I2C Slave Address 1 */
1026
#define UCSA0                  (0x0001)       /* I2C Slave Address 0 */
1027
 
1028
/************************************************************
1029
* WATCHDOG TIMER
1030
************************************************************/
1031
#define __MSP430_HAS_WDT__                    /* Definition to show that Module is available */
1032
 
1033
SFR_16BIT(WDTCTL);                            /* Watchdog Timer Control */
1034
/* The bit names have been prefixed with "WDT" */
1035
#define WDTIS0                 (0x0001)
1036
#define WDTIS1                 (0x0002)
1037
#define WDTSSEL                (0x0004)
1038
#define WDTCNTCL               (0x0008)
1039
#define WDTTMSEL               (0x0010)
1040
#define WDTNMI                 (0x0020)
1041
#define WDTNMIES               (0x0040)
1042
#define WDTHOLD                (0x0080)
1043
 
1044
#define WDTPW                  (0x5A00)
1045
 
1046
/* WDT-interval times [1ms] coded with Bits 0-2 */
1047
/* WDT is clocked by fSMCLK (assumed 1MHz) */
1048
#define WDT_MDLY_32         (WDTPW+WDTTMSEL+WDTCNTCL)                         /* 32ms interval (default) */
1049
#define WDT_MDLY_8          (WDTPW+WDTTMSEL+WDTCNTCL+WDTIS0)                  /* 8ms     " */
1050
#define WDT_MDLY_0_5        (WDTPW+WDTTMSEL+WDTCNTCL+WDTIS1)                  /* 0.5ms   " */
1051
#define WDT_MDLY_0_064      (WDTPW+WDTTMSEL+WDTCNTCL+WDTIS1+WDTIS0)           /* 0.064ms " */
1052
/* WDT is clocked by fACLK (assumed 32KHz) */
1053
#define WDT_ADLY_1000       (WDTPW+WDTTMSEL+WDTCNTCL+WDTSSEL)                 /* 1000ms  " */
1054
#define WDT_ADLY_250        (WDTPW+WDTTMSEL+WDTCNTCL+WDTSSEL+WDTIS0)          /* 250ms   " */
1055
#define WDT_ADLY_16         (WDTPW+WDTTMSEL+WDTCNTCL+WDTSSEL+WDTIS1)          /* 16ms    " */
1056
#define WDT_ADLY_1_9        (WDTPW+WDTTMSEL+WDTCNTCL+WDTSSEL+WDTIS1+WDTIS0)   /* 1.9ms   " */
1057
/* Watchdog mode -> reset after expired time */
1058
/* WDT is clocked by fSMCLK (assumed 1MHz) */
1059
#define WDT_MRST_32         (WDTPW+WDTCNTCL)                                  /* 32ms interval (default) */
1060
#define WDT_MRST_8          (WDTPW+WDTCNTCL+WDTIS0)                           /* 8ms     " */
1061
#define WDT_MRST_0_5        (WDTPW+WDTCNTCL+WDTIS1)                           /* 0.5ms   " */
1062
#define WDT_MRST_0_064      (WDTPW+WDTCNTCL+WDTIS1+WDTIS0)                    /* 0.064ms " */
1063
/* WDT is clocked by fACLK (assumed 32KHz) */
1064
#define WDT_ARST_1000       (WDTPW+WDTCNTCL+WDTSSEL)                          /* 1000ms  " */
1065
#define WDT_ARST_250        (WDTPW+WDTCNTCL+WDTSSEL+WDTIS0)                   /* 250ms   " */
1066
#define WDT_ARST_16         (WDTPW+WDTCNTCL+WDTSSEL+WDTIS1)                   /* 16ms    " */
1067
#define WDT_ARST_1_9        (WDTPW+WDTCNTCL+WDTSSEL+WDTIS1+WDTIS0)            /* 1.9ms   " */
1068
 
1069
/* INTERRUPT CONTROL */
1070
/* These two bits are defined in the Special Function Registers */
1071
/* #define WDTIE               0x01 */
1072
/* #define WDTIFG              0x01 */
1073
 
1074
/************************************************************
1075
* Calibration Data in Info Mem
1076
************************************************************/
1077
 
1078
/* TLV Calibration Data Structure */
1079
#define TAG_DCO_30             (0x01)         /* Tag for DCO30  Calibration Data */
1080
#define TAG_ADC12_1            (0x08)         /* Tag for ADC12_1 Calibration Data */
1081
#define TAG_EMPTY              (0xFE)         /* Tag for Empty Data Field in Calibration Data */
1082
 
1083
#ifndef __DisableCalData
1084
SFR_16BIT(TLV_CHECKSUM);                      /* TLV CHECK SUM */
1085
SFR_8BIT(TLV_DCO_30_TAG);                     /* TLV TAG_DCO30 TAG */
1086
SFR_8BIT(TLV_DCO_30_LEN);                     /* TLV TAG_DCO30 LEN */
1087
SFR_8BIT(TLV_ADC12_1_TAG);                    /* TLV ADC12_1 TAG */
1088
SFR_8BIT(TLV_ADC12_1_LEN);                    /* TLV ADC12_1 LEN */
1089
#endif
1090
 
1091
#define CAL_ADC_25T85          (0x0007)       /* Index for 2.5V/85Deg Cal. Value */
1092
#define CAL_ADC_25T30          (0x0006)       /* Index for 2.5V/30Deg Cal. Value */
1093
#define CAL_ADC_25VREF_FACTOR  (0x0005)       /* Index for 2.5V Ref. Factor */
1094
#define CAL_ADC_15T85          (0x0004)       /* Index for 1.5V/85Deg Cal. Value */
1095
#define CAL_ADC_15T30          (0x0003)       /* Index for 1.5V/30Deg Cal. Value */
1096
#define CAL_ADC_15VREF_FACTOR  (0x0002)       /* Index for ADC 1.5V Ref. Factor */
1097
#define CAL_ADC_OFFSET         (0x0001)       /* Index for ADC Offset */
1098
#define CAL_ADC_GAIN_FACTOR    (0x0000)       /* Index for ADC Gain Factor */
1099
 
1100
#define CAL_DCO_16MHZ          (0x0000)       /* Index for DCOCTL  Calibration Data for 16MHz */
1101
#define CAL_BC1_16MHZ          (0x0001)       /* Index for BCSCTL1 Calibration Data for 16MHz */
1102
#define CAL_DCO_12MHZ          (0x0002)       /* Index for DCOCTL  Calibration Data for 12MHz */
1103
#define CAL_BC1_12MHZ          (0x0003)       /* Index for BCSCTL1 Calibration Data for 12MHz */
1104
#define CAL_DCO_8MHZ           (0x0004)       /* Index for DCOCTL  Calibration Data for 8MHz */
1105
#define CAL_BC1_8MHZ           (0x0005)       /* Index for BCSCTL1 Calibration Data for 8MHz */
1106
#define CAL_DCO_1MHZ           (0x0006)       /* Index for DCOCTL  Calibration Data for 1MHz */
1107
#define CAL_BC1_1MHZ           (0x0007)       /* Index for BCSCTL1 Calibration Data for 1MHz */
1108
 
1109
 
1110
/************************************************************
1111
* Calibration Data in Info Mem
1112
************************************************************/
1113
 
1114
#ifndef __DisableCalData
1115
 
1116
SFR_8BIT(CALDCO_16MHZ);                       /* DCOCTL  Calibration Data for 16MHz */
1117
SFR_8BIT(CALBC1_16MHZ);                       /* BCSCTL1 Calibration Data for 16MHz */
1118
SFR_8BIT(CALDCO_12MHZ);                       /* DCOCTL  Calibration Data for 12MHz */
1119
SFR_8BIT(CALBC1_12MHZ);                       /* BCSCTL1 Calibration Data for 12MHz */
1120
SFR_8BIT(CALDCO_8MHZ);                        /* DCOCTL  Calibration Data for 8MHz */
1121
SFR_8BIT(CALBC1_8MHZ);                        /* BCSCTL1 Calibration Data for 8MHz */
1122
SFR_8BIT(CALDCO_1MHZ);                        /* DCOCTL  Calibration Data for 1MHz */
1123
SFR_8BIT(CALBC1_1MHZ);                        /* BCSCTL1 Calibration Data for 1MHz */
1124
 
1125
#endif /* #ifndef __DisableCalData */
1126
 
1127
/************************************************************
1128
* Interrupt Vectors (offset from 0xFFE0)
1129
************************************************************/
1130
 
1131
#define VECTOR_NAME(name)       name##_ptr
1132
#define EMIT_PRAGMA(x)          _Pragma(#x)
1133
#define CREATE_VECTOR(name)     void (* const VECTOR_NAME(name))(void) = &name
1134
#define PLACE_VECTOR(vector,section) EMIT_PRAGMA(DATA_SECTION(vector,section))
1135
#define ISR_VECTOR(func,offset) CREATE_VECTOR(func); \
1136
                                PLACE_VECTOR(VECTOR_NAME(func), offset)
1137
 
1138
 
1139
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
1140
#define PORT1_VECTOR            ".int02"                    /* 0xFFE4 Port 1 */
1141
#else
1142
#define PORT1_VECTOR            (2 * 1u)                     /* 0xFFE4 Port 1 */
1143
/*#define PORT1_ISR(func)         ISR_VECTOR(func, ".int02")  */ /* 0xFFE4 Port 1 */ /* CCE V2 Style */
1144
#endif
1145
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
1146
#define PORT2_VECTOR            ".int03"                    /* 0xFFE6 Port 2 */
1147
#else
1148
#define PORT2_VECTOR            (3 * 1u)                     /* 0xFFE6 Port 2 */
1149
/*#define PORT2_ISR(func)         ISR_VECTOR(func, ".int03")  */ /* 0xFFE6 Port 2 */ /* CCE V2 Style */
1150
#endif
1151
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
1152
#define ADC12_VECTOR            ".int05"                    /* 0xFFEA ADC */
1153
#else
1154
#define ADC12_VECTOR            (5 * 1u)                     /* 0xFFEA ADC */
1155
/*#define ADC12_ISR(func)         ISR_VECTOR(func, ".int05")  */ /* 0xFFEA ADC */ /* CCE V2 Style */
1156
#endif
1157
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
1158
#define USCIAB0TX_VECTOR        ".int06"                    /* 0xFFEC USCI A0/B0 Transmit */
1159
#else
1160
#define USCIAB0TX_VECTOR        (6 * 1u)                     /* 0xFFEC USCI A0/B0 Transmit */
1161
/*#define USCIAB0TX_ISR(func)     ISR_VECTOR(func, ".int06")  */ /* 0xFFEC USCI A0/B0 Transmit */ /* CCE V2 Style */
1162
#endif
1163
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
1164
#define USCIAB0RX_VECTOR        ".int07"                    /* 0xFFEE USCI A0/B0 Receive */
1165
#else
1166
#define USCIAB0RX_VECTOR        (7 * 1u)                     /* 0xFFEE USCI A0/B0 Receive */
1167
/*#define USCIAB0RX_ISR(func)     ISR_VECTOR(func, ".int07")  */ /* 0xFFEE USCI A0/B0 Receive */ /* CCE V2 Style */
1168
#endif
1169
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
1170
#define TIMERA1_VECTOR          ".int08"                    /* 0xFFF0 Timer A CC1-2, TA */
1171
#else
1172
#define TIMERA1_VECTOR          (8 * 1u)                     /* 0xFFF0 Timer A CC1-2, TA */
1173
/*#define TIMERA1_ISR(func)       ISR_VECTOR(func, ".int08")  */ /* 0xFFF0 Timer A CC1-2, TA */ /* CCE V2 Style */
1174
#endif
1175
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
1176
#define TIMERA0_VECTOR          ".int09"                    /* 0xFFF2 Timer A CC0 */
1177
#else
1178
#define TIMERA0_VECTOR          (9 * 1u)                     /* 0xFFF2 Timer A CC0 */
1179
/*#define TIMERA0_ISR(func)       ISR_VECTOR(func, ".int09")  */ /* 0xFFF2 Timer A CC0 */ /* CCE V2 Style */
1180
#endif
1181
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
1182
#define WDT_VECTOR              ".int10"                    /* 0xFFF4 Watchdog Timer */
1183
#else
1184
#define WDT_VECTOR              (10 * 1u)                    /* 0xFFF4 Watchdog Timer */
1185
/*#define WDT_ISR(func)           ISR_VECTOR(func, ".int10")  */ /* 0xFFF4 Watchdog Timer */ /* CCE V2 Style */
1186
#endif
1187
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
1188
#define COMPARATORA_VECTOR      ".int11"                    /* 0xFFF6 Comparator A */
1189
#else
1190
#define COMPARATORA_VECTOR      (11 * 1u)                    /* 0xFFF6 Comparator A */
1191
/*#define COMPARATORA_ISR(func)   ISR_VECTOR(func, ".int11")  */ /* 0xFFF6 Comparator A */ /* CCE V2 Style */
1192
#endif
1193
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
1194
#define TIMERB1_VECTOR          ".int12"                    /* 0xFFF8 Timer B CC1-6, TB */
1195
#else
1196
#define TIMERB1_VECTOR          (12 * 1u)                    /* 0xFFF8 Timer B CC1-6, TB */
1197
/*#define TIMERB1_ISR(func)       ISR_VECTOR(func, ".int12")  */ /* 0xFFF8 Timer B CC1-6, TB */ /* CCE V2 Style */
1198
#endif
1199
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
1200
#define TIMERB0_VECTOR          ".int13"                    /* 0xFFFA Timer B CC0 */
1201
#else
1202
#define TIMERB0_VECTOR          (13 * 1u)                    /* 0xFFFA Timer B CC0 */
1203
/*#define TIMERB0_ISR(func)       ISR_VECTOR(func, ".int13")  */ /* 0xFFFA Timer B CC0 */ /* CCE V2 Style */
1204
#endif
1205
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
1206
#define NMI_VECTOR              ".int14"                    /* 0xFFFC Non-maskable */
1207
#else
1208
#define NMI_VECTOR              (14 * 1u)                    /* 0xFFFC Non-maskable */
1209
/*#define NMI_ISR(func)           ISR_VECTOR(func, ".int14")  */ /* 0xFFFC Non-maskable */ /* CCE V2 Style */
1210
#endif
1211
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
1212
#define RESET_VECTOR            ".reset"                    /* 0xFFFE Reset [Highest Priority] */
1213
#else
1214
#define RESET_VECTOR            (15 * 1u)                    /* 0xFFFE Reset [Highest Priority] */
1215
/*#define RESET_ISR(func)         ISR_VECTOR(func, ".int15")  */ /* 0xFFFE Reset [Highest Priority] */ /* CCE V2 Style */
1216
#endif
1217
 
1218
/************************************************************
1219
* End of Modules
1220
************************************************************/
1221
 
1222
#ifdef __cplusplus
1223
}
1224
#endif /* extern "C" */
1225
 
1226
#endif /* #ifndef __msp430x23x */
1227