Subversion Repositories DevTools

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2850 dpurdie 1
/******************************************************************************/
2
/* Legacy Header File                                                         */
3
/* Not recommended for use in new projects.                                   */
4
/* Please use the msp430.h file or the device specific header file            */
5
/******************************************************************************/
6
 
7
/********************************************************************
8
*
9
* Standard register and bit definitions for the Texas Instruments
10
* MSP430 microcontroller.
11
*
12
* This file supports assembler and C development for
13
* MSP430x20x3 devices.
14
*
15
* Texas Instruments, Version 1.3
16
*
17
* Rev. 1.0, Setup
18
* Rev. 1.1, Removed some TACCx2 definition on TA2 module
19
* Rev. 1.2, Replaced USIIFGDC with USIIFGCC
20
* Rev. 1.3, added definitions for Interrupt Vectors xxIV
21
*
22
********************************************************************/
23
 
24
#ifndef __msp430x20x3
25
#define __msp430x20x3
26
 
27
#ifdef __cplusplus
28
extern "C" {
29
#endif
30
 
31
 
32
/*----------------------------------------------------------------------------*/
33
/* PERIPHERAL FILE MAP                                                        */
34
/*----------------------------------------------------------------------------*/
35
 
36
/* External references resolved by a device-specific linker command file */
37
#define SFR_8BIT(address)   extern volatile unsigned char address
38
#define SFR_16BIT(address)  extern volatile unsigned int address
39
 
40
 
41
/************************************************************
42
* STANDARD BITS
43
************************************************************/
44
 
45
#define BIT0                   (0x0001)
46
#define BIT1                   (0x0002)
47
#define BIT2                   (0x0004)
48
#define BIT3                   (0x0008)
49
#define BIT4                   (0x0010)
50
#define BIT5                   (0x0020)
51
#define BIT6                   (0x0040)
52
#define BIT7                   (0x0080)
53
#define BIT8                   (0x0100)
54
#define BIT9                   (0x0200)
55
#define BITA                   (0x0400)
56
#define BITB                   (0x0800)
57
#define BITC                   (0x1000)
58
#define BITD                   (0x2000)
59
#define BITE                   (0x4000)
60
#define BITF                   (0x8000)
61
 
62
/************************************************************
63
* STATUS REGISTER BITS
64
************************************************************/
65
 
66
#define C                      (0x0001)
67
#define Z                      (0x0002)
68
#define N                      (0x0004)
69
#define V                      (0x0100)
70
#define GIE                    (0x0008)
71
#define CPUOFF                 (0x0010)
72
#define OSCOFF                 (0x0020)
73
#define SCG0                   (0x0040)
74
#define SCG1                   (0x0080)
75
 
76
/* Low Power Modes coded with Bits 4-7 in SR */
77
 
78
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
79
#define LPM0                   (CPUOFF)
80
#define LPM1                   (SCG0+CPUOFF)
81
#define LPM2                   (SCG1+CPUOFF)
82
#define LPM3                   (SCG1+SCG0+CPUOFF)
83
#define LPM4                   (SCG1+SCG0+OSCOFF+CPUOFF)
84
/* End #defines for assembler */
85
 
86
#else /* Begin #defines for C */
87
#define LPM0_bits              (CPUOFF)
88
#define LPM1_bits              (SCG0+CPUOFF)
89
#define LPM2_bits              (SCG1+CPUOFF)
90
#define LPM3_bits              (SCG1+SCG0+CPUOFF)
91
#define LPM4_bits              (SCG1+SCG0+OSCOFF+CPUOFF)
92
 
93
#include "in430.h"
94
 
95
#define LPM0         _bis_SR_register(LPM0_bits)         /* Enter Low Power Mode 0 */
96
#define LPM0_EXIT    _bic_SR_register_on_exit(LPM0_bits) /* Exit Low Power Mode 0 */
97
#define LPM1         _bis_SR_register(LPM1_bits)         /* Enter Low Power Mode 1 */
98
#define LPM1_EXIT    _bic_SR_register_on_exit(LPM1_bits) /* Exit Low Power Mode 1 */
99
#define LPM2         _bis_SR_register(LPM2_bits)         /* Enter Low Power Mode 2 */
100
#define LPM2_EXIT    _bic_SR_register_on_exit(LPM2_bits) /* Exit Low Power Mode 2 */
101
#define LPM3         _bis_SR_register(LPM3_bits)         /* Enter Low Power Mode 3 */
102
#define LPM3_EXIT    _bic_SR_register_on_exit(LPM3_bits) /* Exit Low Power Mode 3 */
103
#define LPM4         _bis_SR_register(LPM4_bits)         /* Enter Low Power Mode 4 */
104
#define LPM4_EXIT    _bic_SR_register_on_exit(LPM4_bits) /* Exit Low Power Mode 4 */
105
#endif /* End #defines for C */
106
 
107
/************************************************************
108
* PERIPHERAL FILE MAP
109
************************************************************/
110
 
111
/************************************************************
112
* SPECIAL FUNCTION REGISTER ADDRESSES + CONTROL BITS
113
************************************************************/
114
 
115
SFR_8BIT(IE1);                                /* Interrupt Enable 1 */
116
#define WDTIE                  (0x01)         /* Watchdog Interrupt Enable */
117
#define OFIE                   (0x02)         /* Osc. Fault  Interrupt Enable */
118
#define NMIIE                  (0x10)         /* NMI Interrupt Enable */
119
#define ACCVIE                 (0x20)         /* Flash Access Violation Interrupt Enable */
120
 
121
SFR_8BIT(IFG1);                               /* Interrupt Flag 1 */
122
#define WDTIFG                 (0x01)         /* Watchdog Interrupt Flag */
123
#define OFIFG                  (0x02)         /* Osc. Fault Interrupt Flag */
124
#define PORIFG                 (0x04)         /* Power On Interrupt Flag */
125
#define RSTIFG                 (0x08)         /* Reset Interrupt Flag */
126
#define NMIIFG                 (0x10)         /* NMI Interrupt Flag */
127
 
128
/************************************************************
129
* Basic Clock Module
130
************************************************************/
131
#define __MSP430_HAS_BC2__                    /* Definition to show that Module is available */
132
 
133
SFR_8BIT(DCOCTL);                             /* DCO Clock Frequency Control */
134
SFR_8BIT(BCSCTL1);                            /* Basic Clock System Control 1 */
135
SFR_8BIT(BCSCTL2);                            /* Basic Clock System Control 2 */
136
SFR_8BIT(BCSCTL3);                            /* Basic Clock System Control 3 */
137
 
138
#define MOD0                   (0x01)         /* Modulation Bit 0 */
139
#define MOD1                   (0x02)         /* Modulation Bit 1 */
140
#define MOD2                   (0x04)         /* Modulation Bit 2 */
141
#define MOD3                   (0x08)         /* Modulation Bit 3 */
142
#define MOD4                   (0x10)         /* Modulation Bit 4 */
143
#define DCO0                   (0x20)         /* DCO Select Bit 0 */
144
#define DCO1                   (0x40)         /* DCO Select Bit 1 */
145
#define DCO2                   (0x80)         /* DCO Select Bit 2 */
146
 
147
#define RSEL0                  (0x01)         /* Range Select Bit 0 */
148
#define RSEL1                  (0x02)         /* Range Select Bit 1 */
149
#define RSEL2                  (0x04)         /* Range Select Bit 2 */
150
#define RSEL3                  (0x08)         /* Range Select Bit 3 */
151
#define DIVA0                  (0x10)         /* ACLK Divider 0 */
152
#define DIVA1                  (0x20)         /* ACLK Divider 1 */
153
#define XTS                    (0x40)         /* LFXTCLK 0:Low Freq. / 1: High Freq. */
154
#define XT2OFF                 (0x80)         /* Enable XT2CLK */
155
 
156
#define DIVA_0                 (0x00)         /* ACLK Divider 0: /1 */
157
#define DIVA_1                 (0x10)         /* ACLK Divider 1: /2 */
158
#define DIVA_2                 (0x20)         /* ACLK Divider 2: /4 */
159
#define DIVA_3                 (0x30)         /* ACLK Divider 3: /8 */
160
 
161
#define DIVS0                  (0x02)         /* SMCLK Divider 0 */
162
#define DIVS1                  (0x04)         /* SMCLK Divider 1 */
163
#define SELS                   (0x08)         /* SMCLK Source Select 0:DCOCLK / 1:XT2CLK/LFXTCLK */
164
#define DIVM0                  (0x10)         /* MCLK Divider 0 */
165
#define DIVM1                  (0x20)         /* MCLK Divider 1 */
166
#define SELM0                  (0x40)         /* MCLK Source Select 0 */
167
#define SELM1                  (0x80)         /* MCLK Source Select 1 */
168
 
169
#define DIVS_0                 (0x00)         /* SMCLK Divider 0: /1 */
170
#define DIVS_1                 (0x02)         /* SMCLK Divider 1: /2 */
171
#define DIVS_2                 (0x04)         /* SMCLK Divider 2: /4 */
172
#define DIVS_3                 (0x06)         /* SMCLK Divider 3: /8 */
173
 
174
#define DIVM_0                 (0x00)         /* MCLK Divider 0: /1 */
175
#define DIVM_1                 (0x10)         /* MCLK Divider 1: /2 */
176
#define DIVM_2                 (0x20)         /* MCLK Divider 2: /4 */
177
#define DIVM_3                 (0x30)         /* MCLK Divider 3: /8 */
178
 
179
#define SELM_0                 (0x00)         /* MCLK Source Select 0: DCOCLK */
180
#define SELM_1                 (0x40)         /* MCLK Source Select 1: DCOCLK */
181
#define SELM_2                 (0x80)         /* MCLK Source Select 2: XT2CLK/LFXTCLK */
182
#define SELM_3                 (0xC0)         /* MCLK Source Select 3: LFXTCLK */
183
 
184
#define LFXT1OF                (0x01)         /* Low/high Frequency Oscillator Fault Flag */
185
#define XT2OF                  (0x02)         /* High frequency oscillator 2 fault flag */
186
#define XCAP0                  (0x04)         /* XIN/XOUT Cap 0 */
187
#define XCAP1                  (0x08)         /* XIN/XOUT Cap 1 */
188
#define LFXT1S0                (0x10)         /* Mode 0 for LFXT1 (XTS = 0) */
189
#define LFXT1S1                (0x20)         /* Mode 1 for LFXT1 (XTS = 0) */
190
#define XT2S0                  (0x40)         /* Mode 0 for XT2 */
191
#define XT2S1                  (0x80)         /* Mode 1 for XT2 */
192
 
193
#define XCAP_0                 (0x00)         /* XIN/XOUT Cap : 0 pF */
194
#define XCAP_1                 (0x04)         /* XIN/XOUT Cap : 6 pF */
195
#define XCAP_2                 (0x08)         /* XIN/XOUT Cap : 10 pF */
196
#define XCAP_3                 (0x0C)         /* XIN/XOUT Cap : 12.5 pF */
197
 
198
#define LFXT1S_0               (0x00)         /* Mode 0 for LFXT1 : Normal operation */
199
#define LFXT1S_1               (0x10)         /* Mode 1 for LFXT1 : Reserved */
200
#define LFXT1S_2               (0x20)         /* Mode 2 for LFXT1 : VLO */
201
#define LFXT1S_3               (0x30)         /* Mode 3 for LFXT1 : Digital input signal */
202
 
203
#define XT2S_0                 (0x00)         /* Mode 0 for XT2 : 0.4 - 1 MHz */
204
#define XT2S_1                 (0x40)         /* Mode 1 for XT2 : 1 - 4 MHz */
205
#define XT2S_2                 (0x80)         /* Mode 2 for XT2 : 2 - 16 MHz */
206
#define XT2S_3                 (0xC0)         /* Mode 3 for XT2 : Digital input signal */
207
 
208
/*************************************************************
209
* Flash Memory
210
*************************************************************/
211
#define __MSP430_HAS_FLASH2__                 /* Definition to show that Module is available */
212
 
213
SFR_16BIT(FCTL1);                             /* FLASH Control 1 */
214
SFR_16BIT(FCTL2);                             /* FLASH Control 2 */
215
SFR_16BIT(FCTL3);                             /* FLASH Control 3 */
216
 
217
#define FRKEY                  (0x9600)       /* Flash key returned by read */
218
#define FWKEY                  (0xA500)       /* Flash key for write */
219
#define FXKEY                  (0x3300)       /* for use with XOR instruction */
220
 
221
#define ERASE                  (0x0002)       /* Enable bit for Flash segment erase */
222
#define MERAS                  (0x0004)       /* Enable bit for Flash mass erase */
223
#define WRT                    (0x0040)       /* Enable bit for Flash write */
224
#define BLKWRT                 (0x0080)       /* Enable bit for Flash segment write */
225
#define SEGWRT                 (0x0080)       /* old definition */ /* Enable bit for Flash segment write */
226
 
227
#define FN0                    (0x0001)       /* Divide Flash clock by 1 to 64 using FN0 to FN5 according to: */
228
#define FN1                    (0x0002)       /*  32*FN5 + 16*FN4 + 8*FN3 + 4*FN2 + 2*FN1 + FN0 + 1 */
229
#ifndef FN2
230
#define FN2                    (0x0004)
231
#endif
232
#ifndef FN3
233
#define FN3                    (0x0008)
234
#endif
235
#ifndef FN4
236
#define FN4                    (0x0010)
237
#endif
238
#define FN5                    (0x0020)
239
#define FSSEL0                 (0x0040)       /* Flash clock select 0 */        /* to distinguish from USART SSELx */
240
#define FSSEL1                 (0x0080)       /* Flash clock select 1 */
241
 
242
#define FSSEL_0                (0x0000)       /* Flash clock select: 0 - ACLK */
243
#define FSSEL_1                (0x0040)       /* Flash clock select: 1 - MCLK */
244
#define FSSEL_2                (0x0080)       /* Flash clock select: 2 - SMCLK */
245
#define FSSEL_3                (0x00C0)       /* Flash clock select: 3 - SMCLK */
246
 
247
#define BUSY                   (0x0001)       /* Flash busy: 1 */
248
#define KEYV                   (0x0002)       /* Flash Key violation flag */
249
#define ACCVIFG                (0x0004)       /* Flash Access violation flag */
250
#define WAIT                   (0x0008)       /* Wait flag for segment write */
251
#define LOCK                   (0x0010)       /* Lock bit: 1 - Flash is locked (read only) */
252
#define EMEX                   (0x0020)       /* Flash Emergency Exit */
253
#define LOCKA                  (0x0040)       /* Segment A Lock bit: read = 1 - Segment is locked (read only) */
254
#define FAIL                   (0x0080)       /* Last Program or Erase failed */
255
 
256
/************************************************************
257
* DIGITAL I/O Port1/2 Pull up / Pull down Resistors
258
************************************************************/
259
#define __MSP430_HAS_PORT1_R__                /* Definition to show that Module is available */
260
#define __MSP430_HAS_PORT2_R__                /* Definition to show that Module is available */
261
 
262
SFR_8BIT(P1IN);                               /* Port 1 Input */
263
SFR_8BIT(P1OUT);                              /* Port 1 Output */
264
SFR_8BIT(P1DIR);                              /* Port 1 Direction */
265
SFR_8BIT(P1IFG);                              /* Port 1 Interrupt Flag */
266
SFR_8BIT(P1IES);                              /* Port 1 Interrupt Edge Select */
267
SFR_8BIT(P1IE);                               /* Port 1 Interrupt Enable */
268
SFR_8BIT(P1SEL);                              /* Port 1 Selection */
269
SFR_8BIT(P1REN);                              /* Port 1 Resistor Enable */
270
 
271
SFR_8BIT(P2IN);                               /* Port 2 Input */
272
SFR_8BIT(P2OUT);                              /* Port 2 Output */
273
SFR_8BIT(P2DIR);                              /* Port 2 Direction */
274
SFR_8BIT(P2IFG);                              /* Port 2 Interrupt Flag */
275
SFR_8BIT(P2IES);                              /* Port 2 Interrupt Edge Select */
276
SFR_8BIT(P2IE);                               /* Port 2 Interrupt Enable */
277
SFR_8BIT(P2SEL);                              /* Port 2 Selection */
278
SFR_8BIT(P2REN);                              /* Port 2 Resistor Enable */
279
 
280
/************************************************************
281
* SD16_A1 - Sigma Delta 16 Bit
282
************************************************************/
283
#define __MSP430_HAS_SD16_A1__                /* Definition to show that Module is available */
284
 
285
SFR_8BIT(SD16INCTL0);                         /* SD16 Input Control Register Channel 0 */
286
SFR_8BIT(SD16AE);                             /* SD16 Analog Input Enable Register */
287
SFR_8BIT(SD16CONF0);                          /* SD16 Internal Configuration Register 0 */
288
SFR_8BIT(SD16CONF1);                          /* SD16 Internal Configuration Register 1 */
289
                                      /* Please use only the recommended settings */
290
 
291
SFR_16BIT(SD16CTL);                           /* Sigma Delta ADC 16 Control Register */
292
SFR_16BIT(SD16CCTL0);                         /* SD16 Channel 0 Control Register */
293
SFR_16BIT(SD16IV);                            /* SD16 Interrupt Vector Register */
294
SFR_16BIT(SD16MEM0);                          /* SD16 Channel 0 Conversion Memory */
295
 
296
/* SD16AE */
297
#define SD16AE0                (0x0001)       /* SD16 External Input Enable 0 */
298
#define SD16AE1                (0x0002)       /* SD16 External Input Enable 1 */
299
#define SD16AE2                (0x0004)       /* SD16 External Input Enable 2 */
300
#define SD16AE3                (0x0008)       /* SD16 External Input Enable 3 */
301
#define SD16AE4                (0x0010)       /* SD16 External Input Enable 4 */
302
#define SD16AE5                (0x0020)       /* SD16 External Input Enable 5 */
303
#define SD16AE6                (0x0040)       /* SD16 External Input Enable 6 */
304
#define SD16AE7                (0x0080)       /* SD16 External Input Enable 7 */
305
 
306
/* SD16INCTLx */
307
#define SD16INCH0              (0x0001)       /* SD16 Input Channel select 0 */
308
#define SD16INCH1              (0x0002)       /* SD16 Input Channel select 1 */
309
#define SD16INCH2              (0x0004)       /* SD16 Input Channel select 2 */
310
#define SD16GAIN0              (0x0008)       /* SD16 Input Pre-Amplifier Gain Select 0 */
311
#define SD16GAIN1              (0x0010)       /* SD16 Input Pre-Amplifier Gain Select 1 */
312
#define SD16GAIN2              (0x0020)       /* SD16 Input Pre-Amplifier Gain Select 2 */
313
#define SD16INTDLY0            (0x0040)       /* SD16 Interrupt Delay after 1.Conversion 0 */
314
#define SD16INTDLY1            (0x0080)       /* SD16 Interrupt Delay after 1.Conversion 1 */
315
 
316
#define SD16GAIN_1             (0x0000)       /* SD16 Input Pre-Amplifier Gain Select *1  */
317
#define SD16GAIN_2             (0x0008)       /* SD16 Input Pre-Amplifier Gain Select *2  */
318
#define SD16GAIN_4             (0x0010)       /* SD16 Input Pre-Amplifier Gain Select *4  */
319
#define SD16GAIN_8             (0x0018)       /* SD16 Input Pre-Amplifier Gain Select *8  */
320
#define SD16GAIN_16            (0x0020)       /* SD16 Input Pre-Amplifier Gain Select *16 */
321
#define SD16GAIN_32            (0x0028)       /* SD16 Input Pre-Amplifier Gain Select *32 */
322
 
323
#define SD16INCH_0             (0x0000)       /* SD16 Input Channel select A0 */
324
#define SD16INCH_1             (0x0001)       /* SD16 Input Channel select A1 */
325
#define SD16INCH_2             (0x0002)       /* SD16 Input Channel select A2 */
326
#define SD16INCH_3             (0x0003)       /* SD16 Input Channel select A3 */
327
#define SD16INCH_4             (0x0004)       /* SD16 Input Channel select A4 */
328
#define SD16INCH_5             (0x0005)       /* SD16 Input Channel select Vcc divider */
329
#define SD16INCH_6             (0x0006)       /* SD16 Input Channel select Temp */
330
#define SD16INCH_7             (0x0007)       /* SD16 Input Channel select Offset */
331
 
332
#define SD16INTDLY_0           (0x0000)       /* SD16 Interrupt Delay: Int. after 4.Conversion  */
333
#define SD16INTDLY_1           (0x0040)       /* SD16 Interrupt Delay: Int. after 3.Conversion  */
334
#define SD16INTDLY_2           (0x0080)       /* SD16 Interrupt Delay: Int. after 2.Conversion  */
335
#define SD16INTDLY_3           (0x00C0)       /* SD16 Interrupt Delay: Int. after 1.Conversion  */
336
 
337
/* SD16CTL */
338
#define SD16OVIE               (0x0002)       /* SD16 Overflow Interupt Enable */
339
#define SD16REFON              (0x0004)       /* SD16 Switch internal Reference on */
340
#define SD16VMIDON             (0x0008)       /* SD16 Switch Vmid Buffer on */
341
#define SD16SSEL0              (0x0010)       /* SD16 Clock Source Select 0 */
342
#define SD16SSEL1              (0x0020)       /* SD16 Clock Source Select 1 */
343
#define SD16DIV0               (0x0040)       /* SD16 Clock Divider Select 0 */
344
#define SD16DIV1               (0x0080)       /* SD16 Clock Divider Select 1 */
345
#define SD16LP                 (0x0100)       /* SD16 Low Power Mode Enable */
346
#define SD16XDIV0              (0x0200)       /* SD16 2.Clock Divider Select 0 */
347
#define SD16XDIV1              (0x0400)       /* SD16 2.Clock Divider Select 1 */
348
//#define SD16XDIV2           (0x0800)  /* SD16 2.Clock Divider Select 2 */
349
 
350
#define SD16DIV_0              (0x0000)       /* SD16 Clock Divider Select /1 */
351
#define SD16DIV_1              (SD16DIV0)     /* SD16 Clock Divider Select /2 */
352
#define SD16DIV_2              (SD16DIV1)     /* SD16 Clock Divider Select /4 */
353
#define SD16DIV_3           (SD16DIV0+SD16DIV1)    /* SD16 Clock Divider Select /8 */
354
 
355
#define SD16XDIV_0             (0x0000)       /* SD16 2.Clock Divider Select /1 */
356
#define SD16XDIV_1             (SD16XDIV0)    /* SD16 2.Clock Divider Select /3 */
357
#define SD16XDIV_2             (SD16XDIV1)    /* SD16 2.Clock Divider Select /16 */
358
#define SD16XDIV_3          (SD16XDIV0+SD16XDIV1)  /* SD16 2.Clock Divider Select /48 */
359
 
360
#define SD16SSEL_0             (0x0000)       /* SD16 Clock Source Select MCLK  */
361
#define SD16SSEL_1             (SD16SSEL0)    /* SD16 Clock Source Select SMCLK */
362
#define SD16SSEL_2             (SD16SSEL1)    /* SD16 Clock Source Select ACLK  */
363
#define SD16SSEL_3          (SD16SSEL0+SD16SSEL1)  /* SD16 Clock Source Select TACLK */
364
 
365
/* SD16CCTLx */
366
//#define RESERVED            (0x0001)  /* RESERVED */
367
#define SD16SC                 (0x0002)       /* SD16 Start Conversion */
368
#define SD16IFG                (0x0004)       /* SD16 Channel x Interrupt Flag */
369
#define SD16IE                 (0x0008)       /* SD16 Channel x Interrupt Enable */
370
#define SD16DF                 (0x0010)       /* SD16 Channel x Data Format: 0:Unipolar/1:Bipolar */
371
#define SD16OVIFG              (0x0020)       /* SD16 Channel x Overflow Interrupt Flag */
372
#define SD16LSBACC             (0x0040)       /* SD16 Channel x Access LSB of ADC */
373
#define SD16LSBTOG             (0x0080)       /* SD16 Channel x Toggle LSB Output of ADC */
374
#define SD16OSR0               (0x0100)       /* SD16 Channel x OverSampling Ratio 0 */
375
#define SD16OSR1               (0x0200)       /* SD16 Channel x OverSampling Ratio 1 */
376
#define SD16SNGL               (0x0400)       /* SD16 Channel x Single Conversion On/Off */
377
#define SD16XOSR               (0x0800)       /* SD16 Channel x Extended OverSampling Ratio */
378
#define SD16UNI                (0x1000)       /* SD16 Channel x Bipolar(0) / Unipolar(1) Mode */
379
 
380
#define SD16OSR_1024        (SD16OSR0+SD16XOSR)     /* SD16 Channel x OverSampling Ratio 1024 */
381
#define SD16OSR_512            (SD16XOSR)     /* SD16 Channel x OverSampling Ratio 512 */
382
#define SD16OSR_256            (0x0000)       /* SD16 Channel x OverSampling Ratio 256 */
383
#define SD16OSR_128            (SD16OSR0)     /* SD16 Channel x OverSampling Ratio 128 */
384
#define SD16OSR_64             (SD16OSR1)     /* SD16 Channel x OverSampling Ratio  64 */
385
#define SD16OSR_32          (SD16OSR0+SD16OSR1)     /* SD16 Channel x OverSampling Ratio  32 */
386
 
387
/* SD16IV Definitions */
388
#define SD16IV_NONE            (0x0000)       /* No Interrupt pending */
389
#define SD16IV_SD16OVIFG       (0x0002)       /* SD16OVIFG */
390
#define SD16IV_SD16MEM0        (0x0004)       /* SD16MEM0 SD16IFG */
391
 
392
/************************************************************
393
* Timer A2
394
************************************************************/
395
#define __MSP430_HAS_TA2__                    /* Definition to show that Module is available */
396
 
397
SFR_16BIT(TAIV);                              /* Timer A Interrupt Vector Word */
398
SFR_16BIT(TACTL);                             /* Timer A Control */
399
SFR_16BIT(TACCTL0);                           /* Timer A Capture/Compare Control 0 */
400
SFR_16BIT(TACCTL1);                           /* Timer A Capture/Compare Control 1 */
401
SFR_16BIT(TAR);                               /* Timer A Counter Register */
402
SFR_16BIT(TACCR0);                            /* Timer A Capture/Compare 0 */
403
SFR_16BIT(TACCR1);                            /* Timer A Capture/Compare 1 */
404
 
405
/* Alternate register names */
406
#define CCTL0                  TACCTL0        /* Timer A Capture/Compare Control 0 */
407
#define CCTL1                  TACCTL1        /* Timer A Capture/Compare Control 1 */
408
#define CCR0                   TACCR0         /* Timer A Capture/Compare 0 */
409
#define CCR1                   TACCR1         /* Timer A Capture/Compare 1 */
410
#define CCTL0_                 TACCTL0_       /* Timer A Capture/Compare Control 0 */
411
#define CCTL1_                 TACCTL1_       /* Timer A Capture/Compare Control 1 */
412
#define CCR0_                  TACCR0_        /* Timer A Capture/Compare 0 */
413
#define CCR1_                  TACCR1_        /* Timer A Capture/Compare 1 */
414
/* Alternate register names - 5xx style */
415
#define TA0IV                  TAIV           /* Timer A Interrupt Vector Word */
416
#define TA0CTL                 TACTL          /* Timer A Control */
417
#define TA0CCTL0               TACCTL0        /* Timer A Capture/Compare Control 0 */
418
#define TA0CCTL1               TACCTL1        /* Timer A Capture/Compare Control 1 */
419
#define TA0R                   TAR            /* Timer A Counter Register */
420
#define TA0CCR0                TACCR0         /* Timer A Capture/Compare 0 */
421
#define TA0CCR1                TACCR1         /* Timer A Capture/Compare 1 */
422
#define TA0IV_                 TAIV_          /* Timer A Interrupt Vector Word */
423
#define TA0CTL_                TACTL_         /* Timer A Control */
424
#define TA0CCTL0_              TACCTL0_       /* Timer A Capture/Compare Control 0 */
425
#define TA0CCTL1_              TACCTL1_       /* Timer A Capture/Compare Control 1 */
426
#define TA0R_                  TAR_           /* Timer A Counter Register */
427
#define TA0CCR0_               TACCR0_        /* Timer A Capture/Compare 0 */
428
#define TA0CCR1_               TACCR1_        /* Timer A Capture/Compare 1 */
429
 
430
#define TASSEL1                (0x0200)       /* Timer A clock source select 0 */
431
#define TASSEL0                (0x0100)       /* Timer A clock source select 1 */
432
#define ID1                    (0x0080)       /* Timer A clock input divider 1 */
433
#define ID0                    (0x0040)       /* Timer A clock input divider 0 */
434
#define MC1                    (0x0020)       /* Timer A mode control 1 */
435
#define MC0                    (0x0010)       /* Timer A mode control 0 */
436
#define TACLR                  (0x0004)       /* Timer A counter clear */
437
#define TAIE                   (0x0002)       /* Timer A counter interrupt enable */
438
#define TAIFG                  (0x0001)       /* Timer A counter interrupt flag */
439
 
440
#define MC_0                   (0*0x10u)      /* Timer A mode control: 0 - Stop */
441
#define MC_1                   (1*0x10u)      /* Timer A mode control: 1 - Up to CCR0 */
442
#define MC_2                   (2*0x10u)      /* Timer A mode control: 2 - Continous up */
443
#define MC_3                   (3*0x10u)      /* Timer A mode control: 3 - Up/Down */
444
#define ID_0                   (0*0x40u)      /* Timer A input divider: 0 - /1 */
445
#define ID_1                   (1*0x40u)      /* Timer A input divider: 1 - /2 */
446
#define ID_2                   (2*0x40u)      /* Timer A input divider: 2 - /4 */
447
#define ID_3                   (3*0x40u)      /* Timer A input divider: 3 - /8 */
448
#define TASSEL_0               (0*0x100u)     /* Timer A clock source select: 0 - TACLK */
449
#define TASSEL_1               (1*0x100u)     /* Timer A clock source select: 1 - ACLK  */
450
#define TASSEL_2               (2*0x100u)     /* Timer A clock source select: 2 - SMCLK */
451
#define TASSEL_3               (3*0x100u)     /* Timer A clock source select: 3 - INCLK */
452
 
453
#define CM1                    (0x8000)       /* Capture mode 1 */
454
#define CM0                    (0x4000)       /* Capture mode 0 */
455
#define CCIS1                  (0x2000)       /* Capture input select 1 */
456
#define CCIS0                  (0x1000)       /* Capture input select 0 */
457
#define SCS                    (0x0800)       /* Capture sychronize */
458
#define SCCI                   (0x0400)       /* Latched capture signal (read) */
459
#define CAP                    (0x0100)       /* Capture mode: 1 /Compare mode : 0 */
460
#define OUTMOD2                (0x0080)       /* Output mode 2 */
461
#define OUTMOD1                (0x0040)       /* Output mode 1 */
462
#define OUTMOD0                (0x0020)       /* Output mode 0 */
463
#define CCIE                   (0x0010)       /* Capture/compare interrupt enable */
464
#define CCI                    (0x0008)       /* Capture input signal (read) */
465
#define OUT                    (0x0004)       /* PWM Output signal if output mode 0 */
466
#define COV                    (0x0002)       /* Capture/compare overflow flag */
467
#define CCIFG                  (0x0001)       /* Capture/compare interrupt flag */
468
 
469
#define OUTMOD_0               (0*0x20u)      /* PWM output mode: 0 - output only */
470
#define OUTMOD_1               (1*0x20u)      /* PWM output mode: 1 - set */
471
#define OUTMOD_2               (2*0x20u)      /* PWM output mode: 2 - PWM toggle/reset */
472
#define OUTMOD_3               (3*0x20u)      /* PWM output mode: 3 - PWM set/reset */
473
#define OUTMOD_4               (4*0x20u)      /* PWM output mode: 4 - toggle */
474
#define OUTMOD_5               (5*0x20u)      /* PWM output mode: 5 - Reset */
475
#define OUTMOD_6               (6*0x20u)      /* PWM output mode: 6 - PWM toggle/set */
476
#define OUTMOD_7               (7*0x20u)      /* PWM output mode: 7 - PWM reset/set */
477
#define CCIS_0                 (0*0x1000u)    /* Capture input select: 0 - CCIxA */
478
#define CCIS_1                 (1*0x1000u)    /* Capture input select: 1 - CCIxB */
479
#define CCIS_2                 (2*0x1000u)    /* Capture input select: 2 - GND */
480
#define CCIS_3                 (3*0x1000u)    /* Capture input select: 3 - Vcc */
481
#define CM_0                   (0*0x4000u)    /* Capture mode: 0 - disabled */
482
#define CM_1                   (1*0x4000u)    /* Capture mode: 1 - pos. edge */
483
#define CM_2                   (2*0x4000u)    /* Capture mode: 1 - neg. edge */
484
#define CM_3                   (3*0x4000u)    /* Capture mode: 1 - both edges */
485
 
486
/* TA2IV Definitions */
487
#define TAIV_NONE              (0x0000)       /* No Interrupt pending */
488
#define TAIV_TACCR1            (0x0002)       /* TACCR1_CCIFG */
489
#define TAIV_2                 (0x0004)       /* Reserved */
490
#define TAIV_6                 (0x0006)       /* Reserved */
491
#define TAIV_8                 (0x0008)       /* Reserved */
492
#define TAIV_TAIFG             (0x000A)       /* TAIFG */
493
 
494
/************************************************************
495
* USI
496
************************************************************/
497
#define __MSP430_HAS_USI__                    /* Definition to show that Module is available */
498
 
499
SFR_8BIT(USICTL0);                            /* USI  Control Register 0 */
500
SFR_8BIT(USICTL1);                            /* USI  Control Register 1 */
501
SFR_8BIT(USICKCTL);                           /* USI  Clock Control Register */
502
SFR_8BIT(USICNT);                             /* USI  Bit Counter Register */
503
SFR_8BIT(USISRL);                             /* USI  Low Byte Shift Register */
504
SFR_8BIT(USISRH);                             /* USI  High Byte Shift Register */
505
SFR_16BIT(USICTL);                            /* USI  Control Register */
506
SFR_16BIT(USICCTL);                           /* USI  Clock and Counter Control Register */
507
SFR_16BIT(USISR);                             /* USI  Shift Register */
508
 
509
#define USIPE7                 (0x80)         /* USI  Port Enable Px.7 */
510
#define USIPE6                 (0x40)         /* USI  Port Enable Px.6 */
511
#define USIPE5                 (0x20)         /* USI  Port Enable Px.5 */
512
#define USILSB                 (0x10)         /* USI  LSB first  1:LSB / 0:MSB */
513
#define USIMST                 (0x08)         /* USI  Master Select  0:Slave / 1:Master */
514
#define USIGE                  (0x04)         /* USI  General Output Enable Latch */
515
#define USIOE                  (0x02)         /* USI  Output Enable */
516
#define USISWRST               (0x01)         /* USI  Software Reset */
517
 
518
#define USICKPH                (0x80)         /* USI  Sync. Mode: Clock Phase */
519
#define USII2C                 (0x40)         /* USI  I2C Mode */
520
#define USISTTIE               (0x20)         /* USI  START Condition interrupt enable */
521
#define USIIE                  (0x10)         /* USI  Counter Interrupt enable */
522
#define USIAL                  (0x08)         /* USI  Arbitration Lost */
523
#define USISTP                 (0x04)         /* USI  STOP Condition received */
524
#define USISTTIFG              (0x02)         /* USI  START Condition interrupt Flag */
525
#define USIIFG                 (0x01)         /* USI  Counter Interrupt Flag */
526
 
527
#define USIDIV2                (0x80)         /* USI  Clock Divider 2 */
528
#define USIDIV1                (0x40)         /* USI  Clock Divider 1 */
529
#define USIDIV0                (0x20)         /* USI  Clock Divider 0 */
530
#define USISSEL2               (0x10)         /* USI  Clock Source Select 2 */
531
#define USISSEL1               (0x08)         /* USI  Clock Source Select 1 */
532
#define USISSEL0               (0x04)         /* USI  Clock Source Select 0 */
533
#define USICKPL                (0x02)         /* USI  Clock Polarity 0:Inactive=Low / 1:Inactive=High */
534
#define USISWCLK               (0x01)         /* USI  Software Clock */
535
 
536
#define USIDIV_0               (0x00)         /* USI  Clock Divider: 0 */
537
#define USIDIV_1               (0x20)         /* USI  Clock Divider: 1 */
538
#define USIDIV_2               (0x40)         /* USI  Clock Divider: 2 */
539
#define USIDIV_3               (0x60)         /* USI  Clock Divider: 3 */
540
#define USIDIV_4               (0x80)         /* USI  Clock Divider: 4 */
541
#define USIDIV_5               (0xA0)         /* USI  Clock Divider: 5 */
542
#define USIDIV_6               (0xC0)         /* USI  Clock Divider: 6 */
543
#define USIDIV_7               (0xE0)         /* USI  Clock Divider: 7 */
544
 
545
#define USISSEL_0              (0x00)         /* USI  Clock Source: 0 */
546
#define USISSEL_1              (0x04)         /* USI  Clock Source: 1 */
547
#define USISSEL_2              (0x08)         /* USI  Clock Source: 2 */
548
#define USISSEL_3              (0x0C)         /* USI  Clock Source: 3 */
549
#define USISSEL_4              (0x10)         /* USI  Clock Source: 4 */
550
#define USISSEL_5              (0x14)         /* USI  Clock Source: 5 */
551
#define USISSEL_6              (0x18)         /* USI  Clock Source: 6 */
552
#define USISSEL_7              (0x1C)         /* USI  Clock Source: 7 */
553
 
554
#define USISCLREL              (0x80)         /* USI  SCL Released */
555
#define USI16B                 (0x40)         /* USI  16 Bit Shift Register Enable */
556
#define USIIFGCC               (0x20)         /* USI  Interrupt Flag Clear Control */
557
#define USICNT4                (0x10)         /* USI  Bit Count 4 */
558
#define USICNT3                (0x08)         /* USI  Bit Count 3 */
559
#define USICNT2                (0x04)         /* USI  Bit Count 2 */
560
#define USICNT1                (0x02)         /* USI  Bit Count 1 */
561
#define USICNT0                (0x01)         /* USI  Bit Count 0 */
562
/************************************************************
563
* WATCHDOG TIMER
564
************************************************************/
565
#define __MSP430_HAS_WDT__                    /* Definition to show that Module is available */
566
 
567
SFR_16BIT(WDTCTL);                            /* Watchdog Timer Control */
568
/* The bit names have been prefixed with "WDT" */
569
#define WDTIS0                 (0x0001)
570
#define WDTIS1                 (0x0002)
571
#define WDTSSEL                (0x0004)
572
#define WDTCNTCL               (0x0008)
573
#define WDTTMSEL               (0x0010)
574
#define WDTNMI                 (0x0020)
575
#define WDTNMIES               (0x0040)
576
#define WDTHOLD                (0x0080)
577
 
578
#define WDTPW                  (0x5A00)
579
 
580
/* WDT-interval times [1ms] coded with Bits 0-2 */
581
/* WDT is clocked by fSMCLK (assumed 1MHz) */
582
#define WDT_MDLY_32         (WDTPW+WDTTMSEL+WDTCNTCL)                         /* 32ms interval (default) */
583
#define WDT_MDLY_8          (WDTPW+WDTTMSEL+WDTCNTCL+WDTIS0)                  /* 8ms     " */
584
#define WDT_MDLY_0_5        (WDTPW+WDTTMSEL+WDTCNTCL+WDTIS1)                  /* 0.5ms   " */
585
#define WDT_MDLY_0_064      (WDTPW+WDTTMSEL+WDTCNTCL+WDTIS1+WDTIS0)           /* 0.064ms " */
586
/* WDT is clocked by fACLK (assumed 32KHz) */
587
#define WDT_ADLY_1000       (WDTPW+WDTTMSEL+WDTCNTCL+WDTSSEL)                 /* 1000ms  " */
588
#define WDT_ADLY_250        (WDTPW+WDTTMSEL+WDTCNTCL+WDTSSEL+WDTIS0)          /* 250ms   " */
589
#define WDT_ADLY_16         (WDTPW+WDTTMSEL+WDTCNTCL+WDTSSEL+WDTIS1)          /* 16ms    " */
590
#define WDT_ADLY_1_9        (WDTPW+WDTTMSEL+WDTCNTCL+WDTSSEL+WDTIS1+WDTIS0)   /* 1.9ms   " */
591
/* Watchdog mode -> reset after expired time */
592
/* WDT is clocked by fSMCLK (assumed 1MHz) */
593
#define WDT_MRST_32         (WDTPW+WDTCNTCL)                                  /* 32ms interval (default) */
594
#define WDT_MRST_8          (WDTPW+WDTCNTCL+WDTIS0)                           /* 8ms     " */
595
#define WDT_MRST_0_5        (WDTPW+WDTCNTCL+WDTIS1)                           /* 0.5ms   " */
596
#define WDT_MRST_0_064      (WDTPW+WDTCNTCL+WDTIS1+WDTIS0)                    /* 0.064ms " */
597
/* WDT is clocked by fACLK (assumed 32KHz) */
598
#define WDT_ARST_1000       (WDTPW+WDTCNTCL+WDTSSEL)                          /* 1000ms  " */
599
#define WDT_ARST_250        (WDTPW+WDTCNTCL+WDTSSEL+WDTIS0)                   /* 250ms   " */
600
#define WDT_ARST_16         (WDTPW+WDTCNTCL+WDTSSEL+WDTIS1)                   /* 16ms    " */
601
#define WDT_ARST_1_9        (WDTPW+WDTCNTCL+WDTSSEL+WDTIS1+WDTIS0)            /* 1.9ms   " */
602
 
603
/* INTERRUPT CONTROL */
604
/* These two bits are defined in the Special Function Registers */
605
/* #define WDTIE               0x01 */
606
/* #define WDTIFG              0x01 */
607
 
608
/************************************************************
609
* Calibration Data in Info Mem
610
************************************************************/
611
 
612
#ifndef __DisableCalData
613
 
614
SFR_8BIT(CALDCO_16MHZ);                       /* DCOCTL  Calibration Data for 16MHz */
615
SFR_8BIT(CALBC1_16MHZ);                       /* BCSCTL1 Calibration Data for 16MHz */
616
SFR_8BIT(CALDCO_12MHZ);                       /* DCOCTL  Calibration Data for 12MHz */
617
SFR_8BIT(CALBC1_12MHZ);                       /* BCSCTL1 Calibration Data for 12MHz */
618
SFR_8BIT(CALDCO_8MHZ);                        /* DCOCTL  Calibration Data for 8MHz */
619
SFR_8BIT(CALBC1_8MHZ);                        /* BCSCTL1 Calibration Data for 8MHz */
620
SFR_8BIT(CALDCO_1MHZ);                        /* DCOCTL  Calibration Data for 1MHz */
621
SFR_8BIT(CALBC1_1MHZ);                        /* BCSCTL1 Calibration Data for 1MHz */
622
 
623
#endif /* #ifndef __DisableCalData */
624
 
625
/************************************************************
626
* Interrupt Vectors (offset from 0xFFE0)
627
************************************************************/
628
 
629
#define VECTOR_NAME(name)       name##_ptr
630
#define EMIT_PRAGMA(x)          _Pragma(#x)
631
#define CREATE_VECTOR(name)     void (* const VECTOR_NAME(name))(void) = &name
632
#define PLACE_VECTOR(vector,section) EMIT_PRAGMA(DATA_SECTION(vector,section))
633
#define ISR_VECTOR(func,offset) CREATE_VECTOR(func); \
634
                                PLACE_VECTOR(VECTOR_NAME(func), offset)
635
 
636
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
637
#define PORT1_VECTOR            ".int02"                    /* 0xFFE4 Port 1 */
638
#else
639
#define PORT1_VECTOR            (2 * 1u)                     /* 0xFFE4 Port 1 */
640
/*#define PORT1_ISR(func)         ISR_VECTOR(func, ".int02")  */ /* 0xFFE4 Port 1 */ /* CCE V2 Style */
641
#endif
642
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
643
#define PORT2_VECTOR            ".int03"                    /* 0xFFE6 Port 2 */
644
#else
645
#define PORT2_VECTOR            (3 * 1u)                     /* 0xFFE6 Port 2 */
646
/*#define PORT2_ISR(func)         ISR_VECTOR(func, ".int03")  */ /* 0xFFE6 Port 2 */ /* CCE V2 Style */
647
#endif
648
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
649
#define USI_VECTOR              ".int04"                    /* 0xFFE8 USI */
650
#else
651
#define USI_VECTOR              (4 * 1u)                     /* 0xFFE8 USI */
652
/*#define USI_ISR(func)           ISR_VECTOR(func, ".int04")  */ /* 0xFFE8 USI */ /* CCE V2 Style */
653
#endif
654
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
655
#define SD16_VECTOR             ".int05"                    /* 0xFFEA Sigma Delta ADC */
656
#else
657
#define SD16_VECTOR             (5 * 1u)                     /* 0xFFEA Sigma Delta ADC */
658
/*#define SD16_ISR(func)          ISR_VECTOR(func, ".int05")  */ /* 0xFFEA Sigma Delta ADC */ /* CCE V2 Style */
659
#endif
660
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
661
#define TIMERA1_VECTOR          ".int08"                    /* 0xFFF0 Timer A CC1, TA */
662
#else
663
#define TIMERA1_VECTOR          (8 * 1u)                     /* 0xFFF0 Timer A CC1, TA */
664
/*#define TIMERA1_ISR(func)       ISR_VECTOR(func, ".int08")  */ /* 0xFFF0 Timer A CC1, TA */ /* CCE V2 Style */
665
#endif
666
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
667
#define TIMERA0_VECTOR          ".int09"                    /* 0xFFF2 Timer A CC0 */
668
#else
669
#define TIMERA0_VECTOR          (9 * 1u)                     /* 0xFFF2 Timer A CC0 */
670
/*#define TIMERA0_ISR(func)       ISR_VECTOR(func, ".int09")  */ /* 0xFFF2 Timer A CC0 */ /* CCE V2 Style */
671
#endif
672
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
673
#define WDT_VECTOR              ".int10"                    /* 0xFFF4 Watchdog Timer */
674
#else
675
#define WDT_VECTOR              (10 * 1u)                    /* 0xFFF4 Watchdog Timer */
676
/*#define WDT_ISR(func)           ISR_VECTOR(func, ".int10")  */ /* 0xFFF4 Watchdog Timer */ /* CCE V2 Style */
677
#endif
678
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
679
#define NMI_VECTOR              ".int14"                    /* 0xFFFC Non-maskable */
680
#else
681
#define NMI_VECTOR              (14 * 1u)                    /* 0xFFFC Non-maskable */
682
/*#define NMI_ISR(func)           ISR_VECTOR(func, ".int14")  */ /* 0xFFFC Non-maskable */ /* CCE V2 Style */
683
#endif
684
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
685
#define RESET_VECTOR            ".reset"                    /* 0xFFFE Reset [Highest Priority] */
686
#else
687
#define RESET_VECTOR            (15 * 1u)                    /* 0xFFFE Reset [Highest Priority] */
688
/*#define RESET_ISR(func)         ISR_VECTOR(func, ".int15")  */ /* 0xFFFE Reset [Highest Priority] */ /* CCE V2 Style */
689
#endif
690
 
691
/************************************************************
692
* End of Modules
693
************************************************************/
694
 
695
#ifdef __cplusplus
696
}
697
#endif /* extern "C" */
698
 
699
#endif /* #ifndef __msp430x20x3 */
700