Subversion Repositories DevTools

Rev

Details | Last modification | View Log | RSS feed

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