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
* MSP430x23x0 devices.
14
*
15
* Texas Instruments, Version 1.2
16
*
17
* Rev. 1.0, ---
18
* Rev. 1.1, added definitions for Interrupt Vectors xxIV
19
* Rev. 1.2, added dummy TRAPINT_VECTOR interrupt vector as bugfix for USCI29
20
*
21
********************************************************************/
22
 
23
#ifndef __msp430x23x0
24
#define __msp430x23x0
25
 
26
#ifdef __cplusplus
27
extern "C" {
28
#endif
29
 
30
 
31
/*----------------------------------------------------------------------------*/
32
/* PERIPHERAL FILE MAP                                                        */
33
/*----------------------------------------------------------------------------*/
34
 
35
/* External references resolved by a device-specific linker command file */
36
#define SFR_8BIT(address)   extern volatile unsigned char address
37
#define SFR_16BIT(address)  extern volatile unsigned int address
38
 
39
 
40
/************************************************************
41
* STANDARD BITS
42
************************************************************/
43
 
44
#define BIT0                   (0x0001)
45
#define BIT1                   (0x0002)
46
#define BIT2                   (0x0004)
47
#define BIT3                   (0x0008)
48
#define BIT4                   (0x0010)
49
#define BIT5                   (0x0020)
50
#define BIT6                   (0x0040)
51
#define BIT7                   (0x0080)
52
#define BIT8                   (0x0100)
53
#define BIT9                   (0x0200)
54
#define BITA                   (0x0400)
55
#define BITB                   (0x0800)
56
#define BITC                   (0x1000)
57
#define BITD                   (0x2000)
58
#define BITE                   (0x4000)
59
#define BITF                   (0x8000)
60
 
61
/************************************************************
62
* STATUS REGISTER BITS
63
************************************************************/
64
 
65
#define C                      (0x0001)
66
#define Z                      (0x0002)
67
#define N                      (0x0004)
68
#define V                      (0x0100)
69
#define GIE                    (0x0008)
70
#define CPUOFF                 (0x0010)
71
#define OSCOFF                 (0x0020)
72
#define SCG0                   (0x0040)
73
#define SCG1                   (0x0080)
74
 
75
/* Low Power Modes coded with Bits 4-7 in SR */
76
 
77
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
78
#define LPM0                   (CPUOFF)
79
#define LPM1                   (SCG0+CPUOFF)
80
#define LPM2                   (SCG1+CPUOFF)
81
#define LPM3                   (SCG1+SCG0+CPUOFF)
82
#define LPM4                   (SCG1+SCG0+OSCOFF+CPUOFF)
83
/* End #defines for assembler */
84
 
85
#else /* Begin #defines for C */
86
#define LPM0_bits              (CPUOFF)
87
#define LPM1_bits              (SCG0+CPUOFF)
88
#define LPM2_bits              (SCG1+CPUOFF)
89
#define LPM3_bits              (SCG1+SCG0+CPUOFF)
90
#define LPM4_bits              (SCG1+SCG0+OSCOFF+CPUOFF)
91
 
92
#include "in430.h"
93
 
94
#define LPM0         _bis_SR_register(LPM0_bits)         /* Enter Low Power Mode 0 */
95
#define LPM0_EXIT    _bic_SR_register_on_exit(LPM0_bits) /* Exit Low Power Mode 0 */
96
#define LPM1         _bis_SR_register(LPM1_bits)         /* Enter Low Power Mode 1 */
97
#define LPM1_EXIT    _bic_SR_register_on_exit(LPM1_bits) /* Exit Low Power Mode 1 */
98
#define LPM2         _bis_SR_register(LPM2_bits)         /* Enter Low Power Mode 2 */
99
#define LPM2_EXIT    _bic_SR_register_on_exit(LPM2_bits) /* Exit Low Power Mode 2 */
100
#define LPM3         _bis_SR_register(LPM3_bits)         /* Enter Low Power Mode 3 */
101
#define LPM3_EXIT    _bic_SR_register_on_exit(LPM3_bits) /* Exit Low Power Mode 3 */
102
#define LPM4         _bis_SR_register(LPM4_bits)         /* Enter Low Power Mode 4 */
103
#define LPM4_EXIT    _bic_SR_register_on_exit(LPM4_bits) /* Exit Low Power Mode 4 */
104
#endif /* End #defines for C */
105
 
106
/************************************************************
107
* PERIPHERAL FILE MAP
108
************************************************************/
109
 
110
/************************************************************
111
* SPECIAL FUNCTION REGISTER ADDRESSES + CONTROL BITS
112
************************************************************/
113
 
114
SFR_8BIT(IE1);                                /* Interrupt Enable 1 */
115
#define WDTIE                  (0x01)         /* Watchdog Interrupt Enable */
116
#define OFIE                   (0x02)         /* Osc. Fault  Interrupt Enable */
117
#define NMIIE                  (0x10)         /* NMI Interrupt Enable */
118
#define ACCVIE                 (0x20)         /* Flash Access Violation Interrupt Enable */
119
 
120
SFR_8BIT(IFG1);                               /* Interrupt Flag 1 */
121
#define WDTIFG                 (0x01)         /* Watchdog Interrupt Flag */
122
#define OFIFG                  (0x02)         /* Osc. Fault Interrupt Flag */
123
#define PORIFG                 (0x04)         /* Power On Interrupt Flag */
124
#define RSTIFG                 (0x08)         /* Reset Interrupt Flag */
125
#define NMIIFG                 (0x10)         /* NMI Interrupt Flag */
126
 
127
SFR_8BIT(IE2);                                /* Interrupt Enable 2 */
128
#define UC0IE                  IE2
129
#define UCA0RXIE               (0x01)
130
#define UCA0TXIE               (0x02)
131
#define UCB0RXIE               (0x04)
132
#define UCB0TXIE               (0x08)
133
 
134
SFR_8BIT(IFG2);                               /* Interrupt Flag 2 */
135
#define UC0IFG                 IFG2
136
#define UCA0RXIFG              (0x01)
137
#define UCA0TXIFG              (0x02)
138
#define UCB0RXIFG              (0x04)
139
#define UCB0TXIFG              (0x08)
140
 
141
/************************************************************
142
* Basic Clock Module
143
************************************************************/
144
#define __MSP430_HAS_BC2__                    /* Definition to show that Module is available */
145
 
146
SFR_8BIT(DCOCTL);                             /* DCO Clock Frequency Control */
147
SFR_8BIT(BCSCTL1);                            /* Basic Clock System Control 1 */
148
SFR_8BIT(BCSCTL2);                            /* Basic Clock System Control 2 */
149
SFR_8BIT(BCSCTL3);                            /* Basic Clock System Control 3 */
150
 
151
#define MOD0                   (0x01)         /* Modulation Bit 0 */
152
#define MOD1                   (0x02)         /* Modulation Bit 1 */
153
#define MOD2                   (0x04)         /* Modulation Bit 2 */
154
#define MOD3                   (0x08)         /* Modulation Bit 3 */
155
#define MOD4                   (0x10)         /* Modulation Bit 4 */
156
#define DCO0                   (0x20)         /* DCO Select Bit 0 */
157
#define DCO1                   (0x40)         /* DCO Select Bit 1 */
158
#define DCO2                   (0x80)         /* DCO Select Bit 2 */
159
 
160
#define RSEL0                  (0x01)         /* Range Select Bit 0 */
161
#define RSEL1                  (0x02)         /* Range Select Bit 1 */
162
#define RSEL2                  (0x04)         /* Range Select Bit 2 */
163
#define RSEL3                  (0x08)         /* Range Select Bit 3 */
164
#define DIVA0                  (0x10)         /* ACLK Divider 0 */
165
#define DIVA1                  (0x20)         /* ACLK Divider 1 */
166
#define XTS                    (0x40)         /* LFXTCLK 0:Low Freq. / 1: High Freq. */
167
#define XT2OFF                 (0x80)         /* Enable XT2CLK */
168
 
169
#define DIVA_0                 (0x00)         /* ACLK Divider 0: /1 */
170
#define DIVA_1                 (0x10)         /* ACLK Divider 1: /2 */
171
#define DIVA_2                 (0x20)         /* ACLK Divider 2: /4 */
172
#define DIVA_3                 (0x30)         /* ACLK Divider 3: /8 */
173
 
174
#define DCOR                   (0x01)         /* Enable External Resistor : 1 */
175
#define DIVS0                  (0x02)         /* SMCLK Divider 0 */
176
#define DIVS1                  (0x04)         /* SMCLK Divider 1 */
177
#define SELS                   (0x08)         /* SMCLK Source Select 0:DCOCLK / 1:XT2CLK/LFXTCLK */
178
#define DIVM0                  (0x10)         /* MCLK Divider 0 */
179
#define DIVM1                  (0x20)         /* MCLK Divider 1 */
180
#define SELM0                  (0x40)         /* MCLK Source Select 0 */
181
#define SELM1                  (0x80)         /* MCLK Source Select 1 */
182
 
183
#define DIVS_0                 (0x00)         /* SMCLK Divider 0: /1 */
184
#define DIVS_1                 (0x02)         /* SMCLK Divider 1: /2 */
185
#define DIVS_2                 (0x04)         /* SMCLK Divider 2: /4 */
186
#define DIVS_3                 (0x06)         /* SMCLK Divider 3: /8 */
187
 
188
#define DIVM_0                 (0x00)         /* MCLK Divider 0: /1 */
189
#define DIVM_1                 (0x10)         /* MCLK Divider 1: /2 */
190
#define DIVM_2                 (0x20)         /* MCLK Divider 2: /4 */
191
#define DIVM_3                 (0x30)         /* MCLK Divider 3: /8 */
192
 
193
#define SELM_0                 (0x00)         /* MCLK Source Select 0: DCOCLK */
194
#define SELM_1                 (0x40)         /* MCLK Source Select 1: DCOCLK */
195
#define SELM_2                 (0x80)         /* MCLK Source Select 2: XT2CLK/LFXTCLK */
196
#define SELM_3                 (0xC0)         /* MCLK Source Select 3: LFXTCLK */
197
 
198
#define LFXT1OF                (0x01)         /* Low/high Frequency Oscillator Fault Flag */
199
#define XT2OF                  (0x02)         /* High frequency oscillator 2 fault flag */
200
#define XCAP0                  (0x04)         /* XIN/XOUT Cap 0 */
201
#define XCAP1                  (0x08)         /* XIN/XOUT Cap 1 */
202
#define LFXT1S0                (0x10)         /* Mode 0 for LFXT1 (XTS = 0) */
203
#define LFXT1S1                (0x20)         /* Mode 1 for LFXT1 (XTS = 0) */
204
#define XT2S0                  (0x40)         /* Mode 0 for XT2 */
205
#define XT2S1                  (0x80)         /* Mode 1 for XT2 */
206
 
207
#define XCAP_0                 (0x00)         /* XIN/XOUT Cap : 0 pF */
208
#define XCAP_1                 (0x04)         /* XIN/XOUT Cap : 6 pF */
209
#define XCAP_2                 (0x08)         /* XIN/XOUT Cap : 10 pF */
210
#define XCAP_3                 (0x0C)         /* XIN/XOUT Cap : 12.5 pF */
211
 
212
#define LFXT1S_0               (0x00)         /* Mode 0 for LFXT1 : Normal operation */
213
#define LFXT1S_1               (0x10)         /* Mode 1 for LFXT1 : Reserved */
214
#define LFXT1S_2               (0x20)         /* Mode 2 for LFXT1 : VLO */
215
#define LFXT1S_3               (0x30)         /* Mode 3 for LFXT1 : Digital input signal */
216
 
217
#define XT2S_0                 (0x00)         /* Mode 0 for XT2 : 0.4 - 1 MHz */
218
#define XT2S_1                 (0x40)         /* Mode 1 for XT2 : 1 - 4 MHz */
219
#define XT2S_2                 (0x80)         /* Mode 2 for XT2 : 2 - 16 MHz */
220
#define XT2S_3                 (0xC0)         /* Mode 3 for XT2 : Digital input signal */
221
 
222
/************************************************************
223
* Comparator A
224
************************************************************/
225
#define __MSP430_HAS_CAPLUS__                 /* Definition to show that Module is available */
226
 
227
SFR_8BIT(CACTL1);                             /* Comparator A Control 1 */
228
SFR_8BIT(CACTL2);                             /* Comparator A Control 2 */
229
SFR_8BIT(CAPD);                               /* Comparator A Port Disable */
230
 
231
#define CAIFG                  (0x01)         /* Comp. A Interrupt Flag */
232
#define CAIE                   (0x02)         /* Comp. A Interrupt Enable */
233
#define CAIES                  (0x04)         /* Comp. A Int. Edge Select: 0:rising / 1:falling */
234
#define CAON                   (0x08)         /* Comp. A enable */
235
#define CAREF0                 (0x10)         /* Comp. A Internal Reference Select 0 */
236
#define CAREF1                 (0x20)         /* Comp. A Internal Reference Select 1 */
237
#define CARSEL                 (0x40)         /* Comp. A Internal Reference Enable */
238
#define CAEX                   (0x80)         /* Comp. A Exchange Inputs */
239
 
240
#define CAREF_0                (0x00)         /* Comp. A Int. Ref. Select 0 : Off */
241
#define CAREF_1                (0x10)         /* Comp. A Int. Ref. Select 1 : 0.25*Vcc */
242
#define CAREF_2                (0x20)         /* Comp. A Int. Ref. Select 2 : 0.5*Vcc */
243
#define CAREF_3                (0x30)         /* Comp. A Int. Ref. Select 3 : Vt*/
244
 
245
#define CAOUT                  (0x01)         /* Comp. A Output */
246
#define CAF                    (0x02)         /* Comp. A Enable Output Filter */
247
#define P2CA0                  (0x04)         /* Comp. A +Terminal Multiplexer */
248
#define P2CA1                  (0x08)         /* Comp. A -Terminal Multiplexer */
249
#define P2CA2                  (0x10)         /* Comp. A -Terminal Multiplexer */
250
#define P2CA3                  (0x20)         /* Comp. A -Terminal Multiplexer */
251
#define P2CA4                  (0x40)         /* Comp. A +Terminal Multiplexer */
252
#define CASHORT                (0x80)         /* Comp. A Short + and - Terminals */
253
 
254
#define CAPD0                  (0x01)         /* Comp. A Disable Input Buffer of Port Register .0 */
255
#define CAPD1                  (0x02)         /* Comp. A Disable Input Buffer of Port Register .1 */
256
#define CAPD2                  (0x04)         /* Comp. A Disable Input Buffer of Port Register .2 */
257
#define CAPD3                  (0x08)         /* Comp. A Disable Input Buffer of Port Register .3 */
258
#define CAPD4                  (0x10)         /* Comp. A Disable Input Buffer of Port Register .4 */
259
#define CAPD5                  (0x20)         /* Comp. A Disable Input Buffer of Port Register .5 */
260
#define CAPD6                  (0x40)         /* Comp. A Disable Input Buffer of Port Register .6 */
261
#define CAPD7                  (0x80)         /* Comp. A Disable Input Buffer of Port Register .7 */
262
 
263
/*************************************************************
264
* Flash Memory
265
*************************************************************/
266
#define __MSP430_HAS_FLASH2__                 /* Definition to show that Module is available */
267
 
268
SFR_16BIT(FCTL1);                             /* FLASH Control 1 */
269
SFR_16BIT(FCTL2);                             /* FLASH Control 2 */
270
SFR_16BIT(FCTL3);                             /* FLASH Control 3 */
271
 
272
#define FRKEY                  (0x9600)       /* Flash key returned by read */
273
#define FWKEY                  (0xA500)       /* Flash key for write */
274
#define FXKEY                  (0x3300)       /* for use with XOR instruction */
275
 
276
#define ERASE                  (0x0002)       /* Enable bit for Flash segment erase */
277
#define MERAS                  (0x0004)       /* Enable bit for Flash mass erase */
278
#define EEI                    (0x0008)       /* Enable Erase Interrupts */
279
#define EEIEX                  (0x0010)       /* Enable Emergency Interrupt Exit */
280
#define WRT                    (0x0040)       /* Enable bit for Flash write */
281
#define BLKWRT                 (0x0080)       /* Enable bit for Flash segment write */
282
#define SEGWRT                 (0x0080)       /* old definition */ /* Enable bit for Flash segment write */
283
 
284
#define FN0                    (0x0001)       /* Divide Flash clock by 1 to 64 using FN0 to FN5 according to: */
285
#define FN1                    (0x0002)       /*  32*FN5 + 16*FN4 + 8*FN3 + 4*FN2 + 2*FN1 + FN0 + 1 */
286
#ifndef FN2
287
#define FN2                    (0x0004)
288
#endif
289
#ifndef FN3
290
#define FN3                    (0x0008)
291
#endif
292
#ifndef FN4
293
#define FN4                    (0x0010)
294
#endif
295
#define FN5                    (0x0020)
296
#define FSSEL0                 (0x0040)       /* Flash clock select 0 */        /* to distinguish from USART SSELx */
297
#define FSSEL1                 (0x0080)       /* Flash clock select 1 */
298
 
299
#define FSSEL_0                (0x0000)       /* Flash clock select: 0 - ACLK */
300
#define FSSEL_1                (0x0040)       /* Flash clock select: 1 - MCLK */
301
#define FSSEL_2                (0x0080)       /* Flash clock select: 2 - SMCLK */
302
#define FSSEL_3                (0x00C0)       /* Flash clock select: 3 - SMCLK */
303
 
304
#define BUSY                   (0x0001)       /* Flash busy: 1 */
305
#define KEYV                   (0x0002)       /* Flash Key violation flag */
306
#define ACCVIFG                (0x0004)       /* Flash Access violation flag */
307
#define WAIT                   (0x0008)       /* Wait flag for segment write */
308
#define LOCK                   (0x0010)       /* Lock bit: 1 - Flash is locked (read only) */
309
#define EMEX                   (0x0020)       /* Flash Emergency Exit */
310
#define LOCKA                  (0x0040)       /* Segment A Lock bit: read = 1 - Segment is locked (read only) */
311
#define FAIL                   (0x0080)       /* Last Program or Erase failed */
312
 
313
/************************************************************
314
* HARDWARE MULTIPLIER
315
************************************************************/
316
#define __MSP430_HAS_MPY__                    /* Definition to show that Module is available */
317
 
318
SFR_16BIT(MPY);                               /* Multiply Unsigned/Operand 1 */
319
SFR_16BIT(MPYS);                              /* Multiply Signed/Operand 1 */
320
SFR_16BIT(MAC);                               /* Multiply Unsigned and Accumulate/Operand 1 */
321
SFR_16BIT(MACS);                              /* Multiply Signed and Accumulate/Operand 1 */
322
SFR_16BIT(OP2);                               /* Operand 2 */
323
SFR_16BIT(RESLO);                             /* Result Low Word */
324
SFR_16BIT(RESHI);                             /* Result High Word */
325
SFR_16BIT(SUMEXT);                            /* Sum Extend */
326
 
327
/************************************************************
328
* DIGITAL I/O Port1/2 Pull up / Pull down Resistors
329
************************************************************/
330
#define __MSP430_HAS_PORT1_R__                /* Definition to show that Module is available */
331
#define __MSP430_HAS_PORT2_R__                /* Definition to show that Module is available */
332
 
333
SFR_8BIT(P1IN);                               /* Port 1 Input */
334
SFR_8BIT(P1OUT);                              /* Port 1 Output */
335
SFR_8BIT(P1DIR);                              /* Port 1 Direction */
336
SFR_8BIT(P1IFG);                              /* Port 1 Interrupt Flag */
337
SFR_8BIT(P1IES);                              /* Port 1 Interrupt Edge Select */
338
SFR_8BIT(P1IE);                               /* Port 1 Interrupt Enable */
339
SFR_8BIT(P1SEL);                              /* Port 1 Selection */
340
SFR_8BIT(P1REN);                              /* Port 1 Resistor Enable */
341
 
342
SFR_8BIT(P2IN);                               /* Port 2 Input */
343
SFR_8BIT(P2OUT);                              /* Port 2 Output */
344
SFR_8BIT(P2DIR);                              /* Port 2 Direction */
345
SFR_8BIT(P2IFG);                              /* Port 2 Interrupt Flag */
346
SFR_8BIT(P2IES);                              /* Port 2 Interrupt Edge Select */
347
SFR_8BIT(P2IE);                               /* Port 2 Interrupt Enable */
348
SFR_8BIT(P2SEL);                              /* Port 2 Selection */
349
SFR_8BIT(P2REN);                              /* Port 2 Resistor Enable */
350
 
351
/************************************************************
352
* DIGITAL I/O Port3/4 Pull up / Pull down Resistors
353
************************************************************/
354
#define __MSP430_HAS_PORT3_R__                /* Definition to show that Module is available */
355
#define __MSP430_HAS_PORT4_R__                /* Definition to show that Module is available */
356
 
357
SFR_8BIT(P3IN);                               /* Port 3 Input */
358
SFR_8BIT(P3OUT);                              /* Port 3 Output */
359
SFR_8BIT(P3DIR);                              /* Port 3 Direction */
360
SFR_8BIT(P3SEL);                              /* Port 3 Selection */
361
SFR_8BIT(P3REN);                              /* Port 3 Resistor Enable */
362
 
363
SFR_8BIT(P4IN);                               /* Port 4 Input */
364
SFR_8BIT(P4OUT);                              /* Port 4 Output */
365
SFR_8BIT(P4DIR);                              /* Port 4 Direction */
366
SFR_8BIT(P4SEL);                              /* Port 4 Selection */
367
SFR_8BIT(P4REN);                              /* Port 4 Resistor Enable */
368
 
369
/************************************************************
370
* Timer A3
371
************************************************************/
372
#define __MSP430_HAS_TA3__                    /* Definition to show that Module is available */
373
 
374
SFR_16BIT(TAIV);                              /* Timer A Interrupt Vector Word */
375
SFR_16BIT(TACTL);                             /* Timer A Control */
376
SFR_16BIT(TACCTL0);                           /* Timer A Capture/Compare Control 0 */
377
SFR_16BIT(TACCTL1);                           /* Timer A Capture/Compare Control 1 */
378
SFR_16BIT(TACCTL2);                           /* Timer A Capture/Compare Control 2 */
379
SFR_16BIT(TAR);                               /* Timer A Counter Register */
380
SFR_16BIT(TACCR0);                            /* Timer A Capture/Compare 0 */
381
SFR_16BIT(TACCR1);                            /* Timer A Capture/Compare 1 */
382
SFR_16BIT(TACCR2);                            /* Timer A Capture/Compare 2 */
383
 
384
/* Alternate register names */
385
#define CCTL0                  TACCTL0        /* Timer A Capture/Compare Control 0 */
386
#define CCTL1                  TACCTL1        /* Timer A Capture/Compare Control 1 */
387
#define CCTL2                  TACCTL2        /* Timer A Capture/Compare Control 2 */
388
#define CCR0                   TACCR0         /* Timer A Capture/Compare 0 */
389
#define CCR1                   TACCR1         /* Timer A Capture/Compare 1 */
390
#define CCR2                   TACCR2         /* Timer A Capture/Compare 2 */
391
#define CCTL0_                 TACCTL0_       /* Timer A Capture/Compare Control 0 */
392
#define CCTL1_                 TACCTL1_       /* Timer A Capture/Compare Control 1 */
393
#define CCTL2_                 TACCTL2_       /* Timer A Capture/Compare Control 2 */
394
#define CCR0_                  TACCR0_        /* Timer A Capture/Compare 0 */
395
#define CCR1_                  TACCR1_        /* Timer A Capture/Compare 1 */
396
#define CCR2_                  TACCR2_        /* Timer A Capture/Compare 2 */
397
/* Alternate register names - 5xx style */
398
#define TA0IV                  TAIV           /* Timer A Interrupt Vector Word */
399
#define TA0CTL                 TACTL          /* Timer A Control */
400
#define TA0CCTL0               TACCTL0        /* Timer A Capture/Compare Control 0 */
401
#define TA0CCTL1               TACCTL1        /* Timer A Capture/Compare Control 1 */
402
#define TA0CCTL2               TACCTL2        /* Timer A Capture/Compare Control 2 */
403
#define TA0R                   TAR            /* Timer A Counter Register */
404
#define TA0CCR0                TACCR0         /* Timer A Capture/Compare 0 */
405
#define TA0CCR1                TACCR1         /* Timer A Capture/Compare 1 */
406
#define TA0CCR2                TACCR2         /* Timer A Capture/Compare 2 */
407
#define TA0IV_                 TAIV_          /* Timer A Interrupt Vector Word */
408
#define TA0CTL_                TACTL_         /* Timer A Control */
409
#define TA0CCTL0_              TACCTL0_       /* Timer A Capture/Compare Control 0 */
410
#define TA0CCTL1_              TACCTL1_       /* Timer A Capture/Compare Control 1 */
411
#define TA0CCTL2_              TACCTL2_       /* Timer A Capture/Compare Control 2 */
412
#define TA0R_                  TAR_           /* Timer A Counter Register */
413
#define TA0CCR0_               TACCR0_        /* Timer A Capture/Compare 0 */
414
#define TA0CCR1_               TACCR1_        /* Timer A Capture/Compare 1 */
415
#define TA0CCR2_               TACCR2_        /* Timer A Capture/Compare 2 */
416
 
417
#define TASSEL1                (0x0200)       /* Timer A clock source select 0 */
418
#define TASSEL0                (0x0100)       /* Timer A clock source select 1 */
419
#define ID1                    (0x0080)       /* Timer A clock input divider 1 */
420
#define ID0                    (0x0040)       /* Timer A clock input divider 0 */
421
#define MC1                    (0x0020)       /* Timer A mode control 1 */
422
#define MC0                    (0x0010)       /* Timer A mode control 0 */
423
#define TACLR                  (0x0004)       /* Timer A counter clear */
424
#define TAIE                   (0x0002)       /* Timer A counter interrupt enable */
425
#define TAIFG                  (0x0001)       /* Timer A counter interrupt flag */
426
 
427
#define MC_0                   (0*0x10u)      /* Timer A mode control: 0 - Stop */
428
#define MC_1                   (1*0x10u)      /* Timer A mode control: 1 - Up to CCR0 */
429
#define MC_2                   (2*0x10u)      /* Timer A mode control: 2 - Continous up */
430
#define MC_3                   (3*0x10u)      /* Timer A mode control: 3 - Up/Down */
431
#define ID_0                   (0*0x40u)      /* Timer A input divider: 0 - /1 */
432
#define ID_1                   (1*0x40u)      /* Timer A input divider: 1 - /2 */
433
#define ID_2                   (2*0x40u)      /* Timer A input divider: 2 - /4 */
434
#define ID_3                   (3*0x40u)      /* Timer A input divider: 3 - /8 */
435
#define TASSEL_0               (0*0x100u)     /* Timer A clock source select: 0 - TACLK */
436
#define TASSEL_1               (1*0x100u)     /* Timer A clock source select: 1 - ACLK  */
437
#define TASSEL_2               (2*0x100u)     /* Timer A clock source select: 2 - SMCLK */
438
#define TASSEL_3               (3*0x100u)     /* Timer A clock source select: 3 - INCLK */
439
 
440
#define CM1                    (0x8000)       /* Capture mode 1 */
441
#define CM0                    (0x4000)       /* Capture mode 0 */
442
#define CCIS1                  (0x2000)       /* Capture input select 1 */
443
#define CCIS0                  (0x1000)       /* Capture input select 0 */
444
#define SCS                    (0x0800)       /* Capture sychronize */
445
#define SCCI                   (0x0400)       /* Latched capture signal (read) */
446
#define CAP                    (0x0100)       /* Capture mode: 1 /Compare mode : 0 */
447
#define OUTMOD2                (0x0080)       /* Output mode 2 */
448
#define OUTMOD1                (0x0040)       /* Output mode 1 */
449
#define OUTMOD0                (0x0020)       /* Output mode 0 */
450
#define CCIE                   (0x0010)       /* Capture/compare interrupt enable */
451
#define CCI                    (0x0008)       /* Capture input signal (read) */
452
#define OUT                    (0x0004)       /* PWM Output signal if output mode 0 */
453
#define COV                    (0x0002)       /* Capture/compare overflow flag */
454
#define CCIFG                  (0x0001)       /* Capture/compare interrupt flag */
455
 
456
#define OUTMOD_0               (0*0x20u)      /* PWM output mode: 0 - output only */
457
#define OUTMOD_1               (1*0x20u)      /* PWM output mode: 1 - set */
458
#define OUTMOD_2               (2*0x20u)      /* PWM output mode: 2 - PWM toggle/reset */
459
#define OUTMOD_3               (3*0x20u)      /* PWM output mode: 3 - PWM set/reset */
460
#define OUTMOD_4               (4*0x20u)      /* PWM output mode: 4 - toggle */
461
#define OUTMOD_5               (5*0x20u)      /* PWM output mode: 5 - Reset */
462
#define OUTMOD_6               (6*0x20u)      /* PWM output mode: 6 - PWM toggle/set */
463
#define OUTMOD_7               (7*0x20u)      /* PWM output mode: 7 - PWM reset/set */
464
#define CCIS_0                 (0*0x1000u)    /* Capture input select: 0 - CCIxA */
465
#define CCIS_1                 (1*0x1000u)    /* Capture input select: 1 - CCIxB */
466
#define CCIS_2                 (2*0x1000u)    /* Capture input select: 2 - GND */
467
#define CCIS_3                 (3*0x1000u)    /* Capture input select: 3 - Vcc */
468
#define CM_0                   (0*0x4000u)    /* Capture mode: 0 - disabled */
469
#define CM_1                   (1*0x4000u)    /* Capture mode: 1 - pos. edge */
470
#define CM_2                   (2*0x4000u)    /* Capture mode: 1 - neg. edge */
471
#define CM_3                   (3*0x4000u)    /* Capture mode: 1 - both edges */
472
 
473
/* TA3IV Definitions */
474
#define TAIV_NONE              (0x0000)       /* No Interrupt pending */
475
#define TAIV_TACCR1            (0x0002)       /* TACCR1_CCIFG */
476
#define TAIV_TACCR2            (0x0004)       /* TACCR2_CCIFG */
477
#define TAIV_6                 (0x0006)       /* Reserved */
478
#define TAIV_8                 (0x0008)       /* Reserved */
479
#define TAIV_TAIFG             (0x000A)       /* TAIFG */
480
 
481
/************************************************************
482
* Timer B3
483
************************************************************/
484
#define __MSP430_HAS_TB3__                    /* Definition to show that Module is available */
485
 
486
SFR_16BIT(TBIV);                              /* Timer B Interrupt Vector Word */
487
SFR_16BIT(TBCTL);                             /* Timer B Control */
488
SFR_16BIT(TBCCTL0);                           /* Timer B Capture/Compare Control 0 */
489
SFR_16BIT(TBCCTL1);                           /* Timer B Capture/Compare Control 1 */
490
SFR_16BIT(TBCCTL2);                           /* Timer B Capture/Compare Control 2 */
491
SFR_16BIT(TBR);                               /* Timer B Counter Register */
492
SFR_16BIT(TBCCR0);                            /* Timer B Capture/Compare 0 */
493
SFR_16BIT(TBCCR1);                            /* Timer B Capture/Compare 1 */
494
SFR_16BIT(TBCCR2);                            /* Timer B Capture/Compare 2 */
495
 
496
/* Alternate register names - 5xx style */
497
#define TB0IV                  TBIV           /* Timer B Interrupt Vector Word */
498
#define TB0CTL                 TBCTL          /* Timer B Control */
499
#define TB0CCTL0               TBCCTL0        /* Timer B Capture/Compare Control 0 */
500
#define TB0CCTL1               TBCCTL1        /* Timer B Capture/Compare Control 1 */
501
#define TB0CCTL2               TBCCTL2        /* Timer B Capture/Compare Control 2 */
502
#define TB0R                   TBR            /* Timer B Counter Register */
503
#define TB0CCR0                TBCCR0         /* Timer B Capture/Compare 0 */
504
#define TB0CCR1                TBCCR1         /* Timer B Capture/Compare 1 */
505
#define TB0CCR2                TBCCR2         /* Timer B Capture/Compare 2 */
506
#define TB0IV_                 TBIV_          /* Timer B Interrupt Vector Word */
507
#define TB0CTL_                TBCTL_         /* Timer B Control */
508
#define TB0CCTL0_              TBCCTL0_       /* Timer B Capture/Compare Control 0 */
509
#define TB0CCTL1_              TBCCTL1_       /* Timer B Capture/Compare Control 1 */
510
#define TB0CCTL2_              TBCCTL2_       /* Timer B Capture/Compare Control 2 */
511
#define TB0R_                  TBR_           /* Timer B Counter Register */
512
#define TB0CCR0_               TBCCR0_        /* Timer B Capture/Compare 0 */
513
#define TB0CCR1_               TBCCR1_        /* Timer B Capture/Compare 1 */
514
#define TB0CCR2_               TBCCR2_        /* Timer B Capture/Compare 2 */
515
 
516
#define TBCLGRP1               (0x4000)       /* Timer B Compare latch load group 1 */
517
#define TBCLGRP0               (0x2000)       /* Timer B Compare latch load group 0 */
518
#define CNTL1                  (0x1000)       /* Counter lenght 1 */
519
#define CNTL0                  (0x0800)       /* Counter lenght 0 */
520
#define TBSSEL1                (0x0200)       /* Clock source 1 */
521
#define TBSSEL0                (0x0100)       /* Clock source 0 */
522
#define TBCLR                  (0x0004)       /* Timer B counter clear */
523
#define TBIE                   (0x0002)       /* Timer B interrupt enable */
524
#define TBIFG                  (0x0001)       /* Timer B interrupt flag */
525
 
526
#define SHR1                   (0x4000)       /* Timer B Compare latch load group 1 */
527
#define SHR0                   (0x2000)       /* Timer B Compare latch load group 0 */
528
 
529
#define TBSSEL_0               (0*0x0100u)    /* Clock Source: TBCLK */
530
#define TBSSEL_1               (1*0x0100u)    /* Clock Source: ACLK  */
531
#define TBSSEL_2               (2*0x0100u)    /* Clock Source: SMCLK */
532
#define TBSSEL_3               (3*0x0100u)    /* Clock Source: INCLK */
533
#define CNTL_0                 (0*0x0800u)    /* Counter lenght: 16 bit */
534
#define CNTL_1                 (1*0x0800u)    /* Counter lenght: 12 bit */
535
#define CNTL_2                 (2*0x0800u)    /* Counter lenght: 10 bit */
536
#define CNTL_3                 (3*0x0800u)    /* Counter lenght:  8 bit */
537
#define SHR_0                  (0*0x2000u)    /* Timer B Group: 0 - individually */
538
#define SHR_1                  (1*0x2000u)    /* Timer B Group: 1 - 3 groups (1-2, 3-4, 5-6) */
539
#define SHR_2                  (2*0x2000u)    /* Timer B Group: 2 - 2 groups (1-3, 4-6)*/
540
#define SHR_3                  (3*0x2000u)    /* Timer B Group: 3 - 1 group (all) */
541
#define TBCLGRP_0              (0*0x2000u)    /* Timer B Group: 0 - individually */
542
#define TBCLGRP_1              (1*0x2000u)    /* Timer B Group: 1 - 3 groups (1-2, 3-4, 5-6) */
543
#define TBCLGRP_2              (2*0x2000u)    /* Timer B Group: 2 - 2 groups (1-3, 4-6)*/
544
#define TBCLGRP_3              (3*0x2000u)    /* Timer B Group: 3 - 1 group (all) */
545
 
546
/* Additional Timer B Control Register bits are defined in Timer A */
547
 
548
#define CLLD1                  (0x0400)       /* Compare latch load source 1 */
549
#define CLLD0                  (0x0200)       /* Compare latch load source 0 */
550
 
551
#define SLSHR1                 (0x0400)       /* Compare latch load source 1 */
552
#define SLSHR0                 (0x0200)       /* Compare latch load source 0 */
553
 
554
#define SLSHR_0                (0*0x0200u)    /* Compare latch load sourec : 0 - immediate */
555
#define SLSHR_1                (1*0x0200u)    /* Compare latch load sourec : 1 - TBR counts to 0 */
556
#define SLSHR_2                (2*0x0200u)    /* Compare latch load sourec : 2 - up/down */
557
#define SLSHR_3                (3*0x0200u)    /* Compare latch load sourec : 3 - TBR counts to TBCTL0 */
558
 
559
#define CLLD_0                 (0*0x0200u)    /* Compare latch load sourec : 0 - immediate */
560
#define CLLD_1                 (1*0x0200u)    /* Compare latch load sourec : 1 - TBR counts to 0 */
561
#define CLLD_2                 (2*0x0200u)    /* Compare latch load sourec : 2 - up/down */
562
#define CLLD_3                 (3*0x0200u)    /* Compare latch load sourec : 3 - TBR counts to TBCTL0 */
563
 
564
/* TB3IV Definitions */
565
#define TBIV_NONE              (0x0000)       /* No Interrupt pending */
566
#define TBIV_TBCCR1            (0x0002)       /* TBCCR1_CCIFG */
567
#define TBIV_TBCCR2            (0x0004)       /* TBCCR2_CCIFG */
568
#define TBIV_3                 (0x0006)       /* Reserved */
569
#define TBIV_4                 (0x0008)       /* Reserved */
570
#define TBIV_5                 (0x000A)       /* Reserved */
571
#define TBIV_6                 (0x000C)       /* Reserved */
572
#define TBIV_TBIFG             (0x000E)       /* TBIFG */
573
 
574
/************************************************************
575
* USCI
576
************************************************************/
577
#define __MSP430_HAS_USCI__                   /* Definition to show that Module is available */
578
 
579
SFR_8BIT(UCA0CTL0);                           /* USCI A0 Control Register 0 */
580
SFR_8BIT(UCA0CTL1);                           /* USCI A0 Control Register 1 */
581
SFR_8BIT(UCA0BR0);                            /* USCI A0 Baud Rate 0 */
582
SFR_8BIT(UCA0BR1);                            /* USCI A0 Baud Rate 1 */
583
SFR_8BIT(UCA0MCTL);                           /* USCI A0 Modulation Control */
584
SFR_8BIT(UCA0STAT);                           /* USCI A0 Status Register */
585
SFR_8BIT(UCA0RXBUF);                          /* USCI A0 Receive Buffer */
586
SFR_8BIT(UCA0TXBUF);                          /* USCI A0 Transmit Buffer */
587
SFR_8BIT(UCA0ABCTL);                          /* USCI A0 LIN Control */
588
SFR_8BIT(UCA0IRTCTL);                         /* USCI A0 IrDA Transmit Control */
589
SFR_8BIT(UCA0IRRCTL);                         /* USCI A0 IrDA Receive Control */
590
 
591
 
592
 
593
SFR_8BIT(UCB0CTL0);                           /* USCI B0 Control Register 0 */
594
SFR_8BIT(UCB0CTL1);                           /* USCI B0 Control Register 1 */
595
SFR_8BIT(UCB0BR0);                            /* USCI B0 Baud Rate 0 */
596
SFR_8BIT(UCB0BR1);                            /* USCI B0 Baud Rate 1 */
597
SFR_8BIT(UCB0I2CIE);                          /* USCI B0 I2C Interrupt Enable Register */
598
SFR_8BIT(UCB0STAT);                           /* USCI B0 Status Register */
599
SFR_8BIT(UCB0RXBUF);                          /* USCI B0 Receive Buffer */
600
SFR_8BIT(UCB0TXBUF);                          /* USCI B0 Transmit Buffer */
601
SFR_16BIT(UCB0I2COA);                         /* USCI B0 I2C Own Address */
602
SFR_16BIT(UCB0I2CSA);                         /* USCI B0 I2C Slave Address */
603
 
604
// UART-Mode Bits
605
#define UCPEN                  (0x80)         /* Async. Mode: Parity enable */
606
#define UCPAR                  (0x40)         /* Async. Mode: Parity     0:odd / 1:even */
607
#define UCMSB                  (0x20)         /* Async. Mode: MSB first  0:LSB / 1:MSB */
608
#define UC7BIT                 (0x10)         /* Async. Mode: Data Bits  0:8-bits / 1:7-bits */
609
#define UCSPB                  (0x08)         /* Async. Mode: Stop Bits  0:one / 1: two */
610
#define UCMODE1                (0x04)         /* Async. Mode: USCI Mode 1 */
611
#define UCMODE0                (0x02)         /* Async. Mode: USCI Mode 0 */
612
#define UCSYNC                 (0x01)         /* Sync-Mode  0:UART-Mode / 1:SPI-Mode */
613
 
614
// SPI-Mode Bits
615
#define UCCKPH                 (0x80)         /* Sync. Mode: Clock Phase */
616
#define UCCKPL                 (0x40)         /* Sync. Mode: Clock Polarity */
617
#define UCMST                  (0x08)         /* Sync. Mode: Master Select */
618
 
619
// I2C-Mode Bits
620
#define UCA10                  (0x80)         /* 10-bit Address Mode */
621
#define UCSLA10                (0x40)         /* 10-bit Slave Address Mode */
622
#define UCMM                   (0x20)         /* Multi-Master Environment */
623
//#define res               (0x10)    /* reserved */
624
#define UCMODE_0               (0x00)         /* Sync. Mode: USCI Mode: 0 */
625
#define UCMODE_1               (0x02)         /* Sync. Mode: USCI Mode: 1 */
626
#define UCMODE_2               (0x04)         /* Sync. Mode: USCI Mode: 2 */
627
#define UCMODE_3               (0x06)         /* Sync. Mode: USCI Mode: 3 */
628
 
629
// UART-Mode Bits
630
#define UCSSEL1                (0x80)         /* USCI 0 Clock Source Select 1 */
631
#define UCSSEL0                (0x40)         /* USCI 0 Clock Source Select 0 */
632
#define UCRXEIE                (0x20)         /* RX Error interrupt enable */
633
#define UCBRKIE                (0x10)         /* Break interrupt enable */
634
#define UCDORM                 (0x08)         /* Dormant (Sleep) Mode */
635
#define UCTXADDR               (0x04)         /* Send next Data as Address */
636
#define UCTXBRK                (0x02)         /* Send next Data as Break */
637
#define UCSWRST                (0x01)         /* USCI Software Reset */
638
 
639
// SPI-Mode Bits
640
//#define res               (0x20)    /* reserved */
641
//#define res               (0x10)    /* reserved */
642
//#define res               (0x08)    /* reserved */
643
//#define res               (0x04)    /* reserved */
644
//#define res               (0x02)    /* reserved */
645
 
646
// I2C-Mode Bits
647
//#define res               (0x20)    /* reserved */
648
#define UCTR                   (0x10)         /* Transmit/Receive Select/Flag */
649
#define UCTXNACK               (0x08)         /* Transmit NACK */
650
#define UCTXSTP                (0x04)         /* Transmit STOP */
651
#define UCTXSTT                (0x02)         /* Transmit START */
652
#define UCSSEL_0               (0x00)         /* USCI 0 Clock Source: 0 */
653
#define UCSSEL_1               (0x40)         /* USCI 0 Clock Source: 1 */
654
#define UCSSEL_2               (0x80)         /* USCI 0 Clock Source: 2 */
655
#define UCSSEL_3               (0xC0)         /* USCI 0 Clock Source: 3 */
656
 
657
#define UCBRF3                 (0x80)         /* USCI First Stage Modulation Select 3 */
658
#define UCBRF2                 (0x40)         /* USCI First Stage Modulation Select 2 */
659
#define UCBRF1                 (0x20)         /* USCI First Stage Modulation Select 1 */
660
#define UCBRF0                 (0x10)         /* USCI First Stage Modulation Select 0 */
661
#define UCBRS2                 (0x08)         /* USCI Second Stage Modulation Select 2 */
662
#define UCBRS1                 (0x04)         /* USCI Second Stage Modulation Select 1 */
663
#define UCBRS0                 (0x02)         /* USCI Second Stage Modulation Select 0 */
664
#define UCOS16                 (0x01)         /* USCI 16-times Oversampling enable */
665
 
666
#define UCBRF_0                (0x00)         /* USCI First Stage Modulation: 0 */
667
#define UCBRF_1                (0x10)         /* USCI First Stage Modulation: 1 */
668
#define UCBRF_2                (0x20)         /* USCI First Stage Modulation: 2 */
669
#define UCBRF_3                (0x30)         /* USCI First Stage Modulation: 3 */
670
#define UCBRF_4                (0x40)         /* USCI First Stage Modulation: 4 */
671
#define UCBRF_5                (0x50)         /* USCI First Stage Modulation: 5 */
672
#define UCBRF_6                (0x60)         /* USCI First Stage Modulation: 6 */
673
#define UCBRF_7                (0x70)         /* USCI First Stage Modulation: 7 */
674
#define UCBRF_8                (0x80)         /* USCI First Stage Modulation: 8 */
675
#define UCBRF_9                (0x90)         /* USCI First Stage Modulation: 9 */
676
#define UCBRF_10               (0xA0)         /* USCI First Stage Modulation: A */
677
#define UCBRF_11               (0xB0)         /* USCI First Stage Modulation: B */
678
#define UCBRF_12               (0xC0)         /* USCI First Stage Modulation: C */
679
#define UCBRF_13               (0xD0)         /* USCI First Stage Modulation: D */
680
#define UCBRF_14               (0xE0)         /* USCI First Stage Modulation: E */
681
#define UCBRF_15               (0xF0)         /* USCI First Stage Modulation: F */
682
 
683
#define UCBRS_0                (0x00)         /* USCI Second Stage Modulation: 0 */
684
#define UCBRS_1                (0x02)         /* USCI Second Stage Modulation: 1 */
685
#define UCBRS_2                (0x04)         /* USCI Second Stage Modulation: 2 */
686
#define UCBRS_3                (0x06)         /* USCI Second Stage Modulation: 3 */
687
#define UCBRS_4                (0x08)         /* USCI Second Stage Modulation: 4 */
688
#define UCBRS_5                (0x0A)         /* USCI Second Stage Modulation: 5 */
689
#define UCBRS_6                (0x0C)         /* USCI Second Stage Modulation: 6 */
690
#define UCBRS_7                (0x0E)         /* USCI Second Stage Modulation: 7 */
691
 
692
#define UCLISTEN               (0x80)         /* USCI Listen mode */
693
#define UCFE                   (0x40)         /* USCI Frame Error Flag */
694
#define UCOE                   (0x20)         /* USCI Overrun Error Flag */
695
#define UCPE                   (0x10)         /* USCI Parity Error Flag */
696
#define UCBRK                  (0x08)         /* USCI Break received */
697
#define UCRXERR                (0x04)         /* USCI RX Error Flag */
698
#define UCADDR                 (0x02)         /* USCI Address received Flag */
699
#define UCBUSY                 (0x01)         /* USCI Busy Flag */
700
#define UCIDLE                 (0x02)         /* USCI Idle line detected Flag */
701
 
702
//#define res               (0x80)    /* reserved */
703
//#define res               (0x40)    /* reserved */
704
//#define res               (0x20)    /* reserved */
705
//#define res               (0x10)    /* reserved */
706
#define UCNACKIE               (0x08)         /* NACK Condition interrupt enable */
707
#define UCSTPIE                (0x04)         /* STOP Condition interrupt enable */
708
#define UCSTTIE                (0x02)         /* START Condition interrupt enable */
709
#define UCALIE                 (0x01)         /* Arbitration Lost interrupt enable */
710
 
711
#define UCSCLLOW               (0x40)         /* SCL low */
712
#define UCGC                   (0x20)         /* General Call address received Flag */
713
#define UCBBUSY                (0x10)         /* Bus Busy Flag */
714
#define UCNACKIFG              (0x08)         /* NAK Condition interrupt Flag */
715
#define UCSTPIFG               (0x04)         /* STOP Condition interrupt Flag */
716
#define UCSTTIFG               (0x02)         /* START Condition interrupt Flag */
717
#define UCALIFG                (0x01)         /* Arbitration Lost interrupt Flag */
718
 
719
#define UCIRTXPL5              (0x80)         /* IRDA Transmit Pulse Length 5 */
720
#define UCIRTXPL4              (0x40)         /* IRDA Transmit Pulse Length 4 */
721
#define UCIRTXPL3              (0x20)         /* IRDA Transmit Pulse Length 3 */
722
#define UCIRTXPL2              (0x10)         /* IRDA Transmit Pulse Length 2 */
723
#define UCIRTXPL1              (0x08)         /* IRDA Transmit Pulse Length 1 */
724
#define UCIRTXPL0              (0x04)         /* IRDA Transmit Pulse Length 0 */
725
#define UCIRTXCLK              (0x02)         /* IRDA Transmit Pulse Clock Select */
726
#define UCIREN                 (0x01)         /* IRDA Encoder/Decoder enable */
727
 
728
#define UCIRRXFL5              (0x80)         /* IRDA Receive Filter Length 5 */
729
#define UCIRRXFL4              (0x40)         /* IRDA Receive Filter Length 4 */
730
#define UCIRRXFL3              (0x20)         /* IRDA Receive Filter Length 3 */
731
#define UCIRRXFL2              (0x10)         /* IRDA Receive Filter Length 2 */
732
#define UCIRRXFL1              (0x08)         /* IRDA Receive Filter Length 1 */
733
#define UCIRRXFL0              (0x04)         /* IRDA Receive Filter Length 0 */
734
#define UCIRRXPL               (0x02)         /* IRDA Receive Input Polarity */
735
#define UCIRRXFE               (0x01)         /* IRDA Receive Filter enable */
736
 
737
//#define res               (0x80)    /* reserved */
738
//#define res               (0x40)    /* reserved */
739
#define UCDELIM1               (0x20)         /* Break Sync Delimiter 1 */
740
#define UCDELIM0               (0x10)         /* Break Sync Delimiter 0 */
741
#define UCSTOE                 (0x08)         /* Sync-Field Timeout error */
742
#define UCBTOE                 (0x04)         /* Break Timeout error */
743
//#define res               (0x02)    /* reserved */
744
#define UCABDEN                (0x01)         /* Auto Baud Rate detect enable */
745
 
746
#define UCGCEN                 (0x8000)       /* I2C General Call enable */
747
#define UCOA9                  (0x0200)       /* I2C Own Address 9 */
748
#define UCOA8                  (0x0100)       /* I2C Own Address 8 */
749
#define UCOA7                  (0x0080)       /* I2C Own Address 7 */
750
#define UCOA6                  (0x0040)       /* I2C Own Address 6 */
751
#define UCOA5                  (0x0020)       /* I2C Own Address 5 */
752
#define UCOA4                  (0x0010)       /* I2C Own Address 4 */
753
#define UCOA3                  (0x0008)       /* I2C Own Address 3 */
754
#define UCOA2                  (0x0004)       /* I2C Own Address 2 */
755
#define UCOA1                  (0x0002)       /* I2C Own Address 1 */
756
#define UCOA0                  (0x0001)       /* I2C Own Address 0 */
757
 
758
#define UCSA9                  (0x0200)       /* I2C Slave Address 9 */
759
#define UCSA8                  (0x0100)       /* I2C Slave Address 8 */
760
#define UCSA7                  (0x0080)       /* I2C Slave Address 7 */
761
#define UCSA6                  (0x0040)       /* I2C Slave Address 6 */
762
#define UCSA5                  (0x0020)       /* I2C Slave Address 5 */
763
#define UCSA4                  (0x0010)       /* I2C Slave Address 4 */
764
#define UCSA3                  (0x0008)       /* I2C Slave Address 3 */
765
#define UCSA2                  (0x0004)       /* I2C Slave Address 2 */
766
#define UCSA1                  (0x0002)       /* I2C Slave Address 1 */
767
#define UCSA0                  (0x0001)       /* I2C Slave Address 0 */
768
 
769
/************************************************************
770
* WATCHDOG TIMER
771
************************************************************/
772
#define __MSP430_HAS_WDT__                    /* Definition to show that Module is available */
773
 
774
SFR_16BIT(WDTCTL);                            /* Watchdog Timer Control */
775
/* The bit names have been prefixed with "WDT" */
776
#define WDTIS0                 (0x0001)
777
#define WDTIS1                 (0x0002)
778
#define WDTSSEL                (0x0004)
779
#define WDTCNTCL               (0x0008)
780
#define WDTTMSEL               (0x0010)
781
#define WDTNMI                 (0x0020)
782
#define WDTNMIES               (0x0040)
783
#define WDTHOLD                (0x0080)
784
 
785
#define WDTPW                  (0x5A00)
786
 
787
/* WDT-interval times [1ms] coded with Bits 0-2 */
788
/* WDT is clocked by fSMCLK (assumed 1MHz) */
789
#define WDT_MDLY_32         (WDTPW+WDTTMSEL+WDTCNTCL)                         /* 32ms interval (default) */
790
#define WDT_MDLY_8          (WDTPW+WDTTMSEL+WDTCNTCL+WDTIS0)                  /* 8ms     " */
791
#define WDT_MDLY_0_5        (WDTPW+WDTTMSEL+WDTCNTCL+WDTIS1)                  /* 0.5ms   " */
792
#define WDT_MDLY_0_064      (WDTPW+WDTTMSEL+WDTCNTCL+WDTIS1+WDTIS0)           /* 0.064ms " */
793
/* WDT is clocked by fACLK (assumed 32KHz) */
794
#define WDT_ADLY_1000       (WDTPW+WDTTMSEL+WDTCNTCL+WDTSSEL)                 /* 1000ms  " */
795
#define WDT_ADLY_250        (WDTPW+WDTTMSEL+WDTCNTCL+WDTSSEL+WDTIS0)          /* 250ms   " */
796
#define WDT_ADLY_16         (WDTPW+WDTTMSEL+WDTCNTCL+WDTSSEL+WDTIS1)          /* 16ms    " */
797
#define WDT_ADLY_1_9        (WDTPW+WDTTMSEL+WDTCNTCL+WDTSSEL+WDTIS1+WDTIS0)   /* 1.9ms   " */
798
/* Watchdog mode -> reset after expired time */
799
/* WDT is clocked by fSMCLK (assumed 1MHz) */
800
#define WDT_MRST_32         (WDTPW+WDTCNTCL)                                  /* 32ms interval (default) */
801
#define WDT_MRST_8          (WDTPW+WDTCNTCL+WDTIS0)                           /* 8ms     " */
802
#define WDT_MRST_0_5        (WDTPW+WDTCNTCL+WDTIS1)                           /* 0.5ms   " */
803
#define WDT_MRST_0_064      (WDTPW+WDTCNTCL+WDTIS1+WDTIS0)                    /* 0.064ms " */
804
/* WDT is clocked by fACLK (assumed 32KHz) */
805
#define WDT_ARST_1000       (WDTPW+WDTCNTCL+WDTSSEL)                          /* 1000ms  " */
806
#define WDT_ARST_250        (WDTPW+WDTCNTCL+WDTSSEL+WDTIS0)                   /* 250ms   " */
807
#define WDT_ARST_16         (WDTPW+WDTCNTCL+WDTSSEL+WDTIS1)                   /* 16ms    " */
808
#define WDT_ARST_1_9        (WDTPW+WDTCNTCL+WDTSSEL+WDTIS1+WDTIS0)            /* 1.9ms   " */
809
 
810
/* INTERRUPT CONTROL */
811
/* These two bits are defined in the Special Function Registers */
812
/* #define WDTIE               0x01 */
813
/* #define WDTIFG              0x01 */
814
 
815
/************************************************************
816
* Calibration Data in Info Mem
817
************************************************************/
818
 
819
#ifndef __DisableCalData
820
 
821
SFR_8BIT(CALDCO_16MHZ);                       /* DCOCTL  Calibration Data for 16MHz */
822
SFR_8BIT(CALBC1_16MHZ);                       /* BCSCTL1 Calibration Data for 16MHz */
823
SFR_8BIT(CALDCO_12MHZ);                       /* DCOCTL  Calibration Data for 12MHz */
824
SFR_8BIT(CALBC1_12MHZ);                       /* BCSCTL1 Calibration Data for 12MHz */
825
SFR_8BIT(CALDCO_8MHZ);                        /* DCOCTL  Calibration Data for 8MHz */
826
SFR_8BIT(CALBC1_8MHZ);                        /* BCSCTL1 Calibration Data for 8MHz */
827
SFR_8BIT(CALDCO_1MHZ);                        /* DCOCTL  Calibration Data for 1MHz */
828
SFR_8BIT(CALBC1_1MHZ);                        /* BCSCTL1 Calibration Data for 1MHz */
829
 
830
#endif /* #ifndef __DisableCalData */
831
 
832
/************************************************************
833
* Interrupt Vectors (offset from 0xFFE0)
834
************************************************************/
835
 
836
#define VECTOR_NAME(name)       name##_ptr
837
#define EMIT_PRAGMA(x)          _Pragma(#x)
838
#define CREATE_VECTOR(name)     void (* const VECTOR_NAME(name))(void) = &name
839
#define PLACE_VECTOR(vector,section) EMIT_PRAGMA(DATA_SECTION(vector,section))
840
#define ISR_VECTOR(func,offset) CREATE_VECTOR(func); \
841
                                PLACE_VECTOR(VECTOR_NAME(func), offset)
842
 
843
 
844
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
845
#define TRAPINT_VECTOR          ".int00"                    /* 0xFFE0 Trap Vector for USCI29 Bug fix */
846
#else
847
#define TRAPINT_VECTOR          (0 * 1u)                     /* 0xFFE0 Trap Vector for USCI29 Bug fix */
848
/*#define TRAPINT_ISR(func)       ISR_VECTOR(func, ".int00")  */ /* 0xFFE0 Trap Vector for USCI29 Bug fix */ /* CCE V2 Style */
849
#endif
850
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
851
#define PORT1_VECTOR            ".int02"                    /* 0xFFE4 Port 1 */
852
#else
853
#define PORT1_VECTOR            (2 * 1u)                     /* 0xFFE4 Port 1 */
854
/*#define PORT1_ISR(func)         ISR_VECTOR(func, ".int02")  */ /* 0xFFE4 Port 1 */ /* CCE V2 Style */
855
#endif
856
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
857
#define PORT2_VECTOR            ".int03"                    /* 0xFFE6 Port 2 */
858
#else
859
#define PORT2_VECTOR            (3 * 1u)                     /* 0xFFE6 Port 2 */
860
/*#define PORT2_ISR(func)         ISR_VECTOR(func, ".int03")  */ /* 0xFFE6 Port 2 */ /* CCE V2 Style */
861
#endif
862
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
863
#define USCIAB0TX_VECTOR        ".int06"                    /* 0xFFEC USCI A0/B0 Transmit */
864
#else
865
#define USCIAB0TX_VECTOR        (6 * 1u)                     /* 0xFFEC USCI A0/B0 Transmit */
866
/*#define USCIAB0TX_ISR(func)     ISR_VECTOR(func, ".int06")  */ /* 0xFFEC USCI A0/B0 Transmit */ /* CCE V2 Style */
867
#endif
868
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
869
#define USCIAB0RX_VECTOR        ".int07"                    /* 0xFFEE USCI A0/B0 Receive */
870
#else
871
#define USCIAB0RX_VECTOR        (7 * 1u)                     /* 0xFFEE USCI A0/B0 Receive */
872
/*#define USCIAB0RX_ISR(func)     ISR_VECTOR(func, ".int07")  */ /* 0xFFEE USCI A0/B0 Receive */ /* CCE V2 Style */
873
#endif
874
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
875
#define TIMERA1_VECTOR          ".int08"                    /* 0xFFF0 Timer A CC1-2, TA */
876
#else
877
#define TIMERA1_VECTOR          (8 * 1u)                     /* 0xFFF0 Timer A CC1-2, TA */
878
/*#define TIMERA1_ISR(func)       ISR_VECTOR(func, ".int08")  */ /* 0xFFF0 Timer A CC1-2, TA */ /* CCE V2 Style */
879
#endif
880
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
881
#define TIMERA0_VECTOR          ".int09"                    /* 0xFFF2 Timer A CC0 */
882
#else
883
#define TIMERA0_VECTOR          (9 * 1u)                     /* 0xFFF2 Timer A CC0 */
884
/*#define TIMERA0_ISR(func)       ISR_VECTOR(func, ".int09")  */ /* 0xFFF2 Timer A CC0 */ /* CCE V2 Style */
885
#endif
886
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
887
#define WDT_VECTOR              ".int10"                    /* 0xFFF4 Watchdog Timer */
888
#else
889
#define WDT_VECTOR              (10 * 1u)                    /* 0xFFF4 Watchdog Timer */
890
/*#define WDT_ISR(func)           ISR_VECTOR(func, ".int10")  */ /* 0xFFF4 Watchdog Timer */ /* CCE V2 Style */
891
#endif
892
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
893
#define COMPARATORA_VECTOR      ".int11"                    /* 0xFFF6 Comparator A */
894
#else
895
#define COMPARATORA_VECTOR      (11 * 1u)                    /* 0xFFF6 Comparator A */
896
/*#define COMPARATORA_ISR(func)   ISR_VECTOR(func, ".int11")  */ /* 0xFFF6 Comparator A */ /* CCE V2 Style */
897
#endif
898
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
899
#define TIMERB1_VECTOR          ".int12"                    /* 0xFFF8 Timer B CC1-6, TB */
900
#else
901
#define TIMERB1_VECTOR          (12 * 1u)                    /* 0xFFF8 Timer B CC1-6, TB */
902
/*#define TIMERB1_ISR(func)       ISR_VECTOR(func, ".int12")  */ /* 0xFFF8 Timer B CC1-6, TB */ /* CCE V2 Style */
903
#endif
904
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
905
#define TIMERB0_VECTOR          ".int13"                    /* 0xFFFA Timer B CC0 */
906
#else
907
#define TIMERB0_VECTOR          (13 * 1u)                    /* 0xFFFA Timer B CC0 */
908
/*#define TIMERB0_ISR(func)       ISR_VECTOR(func, ".int13")  */ /* 0xFFFA Timer B CC0 */ /* CCE V2 Style */
909
#endif
910
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
911
#define NMI_VECTOR              ".int14"                    /* 0xFFFC Non-maskable */
912
#else
913
#define NMI_VECTOR              (14 * 1u)                    /* 0xFFFC Non-maskable */
914
/*#define NMI_ISR(func)           ISR_VECTOR(func, ".int14")  */ /* 0xFFFC Non-maskable */ /* CCE V2 Style */
915
#endif
916
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
917
#define RESET_VECTOR            ".reset"                    /* 0xFFFE Reset [Highest Priority] */
918
#else
919
#define RESET_VECTOR            (15 * 1u)                    /* 0xFFFE Reset [Highest Priority] */
920
/*#define RESET_ISR(func)         ISR_VECTOR(func, ".int15")  */ /* 0xFFFE Reset [Highest Priority] */ /* CCE V2 Style */
921
#endif
922
 
923
/************************************************************
924
* End of Modules
925
************************************************************/
926
 
927
#ifdef __cplusplus
928
}
929
#endif /* extern "C" */
930
 
931
#endif /* #ifndef __msp430x23x0 */
932