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
* MSP430x13x devices.
14
*
15
* Texas Instruments, Version 2.4
16
*
17
* Rev. 1.2, Additional Timer B bit definitions.
18
*           Renamed XTOFF to XT2OFF.
19
* Rev. 1.3, Removed leading 0 to aviod interpretation as octal
20
*            values under C
21
* Rev. 1.4, Corrected LPMx_EXIT to reference new intrinsic    _bic_SR_register_on_exit
22
*           Changed TAIV and TBIV to be read-only
23
* Rev. 1.5, Enclose all #define statements with parentheses
24
* Rev. 1.6, Defined vectors for USART (in addition to UART)
25
* Rev. 1.7, Added USART special function labels (UxME, UxIE, UxIFG)
26
* Rev. 2.1, Alignment of defintions in Users Guide and of version numbers
27
* Rev. 2.2, Fixed type in ADC12 bit definitions (replaced ADC10 with ADC12)
28
* Rev. 2.3, Removed unused def of TASSEL2 / TBSSEL2
29
* Rev. 2.4, added definitions for Interrupt Vectors xxIV
30
*
31
********************************************************************/
32
 
33
#ifndef __msp430x13x
34
#define __msp430x13x
35
 
36
#ifdef __cplusplus
37
extern "C" {
38
#endif
39
 
40
 
41
/*----------------------------------------------------------------------------*/
42
/* PERIPHERAL FILE MAP                                                        */
43
/*----------------------------------------------------------------------------*/
44
 
45
/* External references resolved by a device-specific linker command file */
46
#define SFR_8BIT(address)   extern volatile unsigned char address
47
#define SFR_16BIT(address)  extern volatile unsigned int address
48
 
49
 
50
/************************************************************
51
* STANDARD BITS
52
************************************************************/
53
 
54
#define BIT0                   (0x0001)
55
#define BIT1                   (0x0002)
56
#define BIT2                   (0x0004)
57
#define BIT3                   (0x0008)
58
#define BIT4                   (0x0010)
59
#define BIT5                   (0x0020)
60
#define BIT6                   (0x0040)
61
#define BIT7                   (0x0080)
62
#define BIT8                   (0x0100)
63
#define BIT9                   (0x0200)
64
#define BITA                   (0x0400)
65
#define BITB                   (0x0800)
66
#define BITC                   (0x1000)
67
#define BITD                   (0x2000)
68
#define BITE                   (0x4000)
69
#define BITF                   (0x8000)
70
 
71
/************************************************************
72
* STATUS REGISTER BITS
73
************************************************************/
74
 
75
#define C                      (0x0001)
76
#define Z                      (0x0002)
77
#define N                      (0x0004)
78
#define V                      (0x0100)
79
#define GIE                    (0x0008)
80
#define CPUOFF                 (0x0010)
81
#define OSCOFF                 (0x0020)
82
#define SCG0                   (0x0040)
83
#define SCG1                   (0x0080)
84
 
85
/* Low Power Modes coded with Bits 4-7 in SR */
86
 
87
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
88
#define LPM0                   (CPUOFF)
89
#define LPM1                   (SCG0+CPUOFF)
90
#define LPM2                   (SCG1+CPUOFF)
91
#define LPM3                   (SCG1+SCG0+CPUOFF)
92
#define LPM4                   (SCG1+SCG0+OSCOFF+CPUOFF)
93
/* End #defines for assembler */
94
 
95
#else /* Begin #defines for C */
96
#define LPM0_bits              (CPUOFF)
97
#define LPM1_bits              (SCG0+CPUOFF)
98
#define LPM2_bits              (SCG1+CPUOFF)
99
#define LPM3_bits              (SCG1+SCG0+CPUOFF)
100
#define LPM4_bits              (SCG1+SCG0+OSCOFF+CPUOFF)
101
 
102
#include "in430.h"
103
 
104
#define LPM0         _bis_SR_register(LPM0_bits)         /* Enter Low Power Mode 0 */
105
#define LPM0_EXIT    _bic_SR_register_on_exit(LPM0_bits) /* Exit Low Power Mode 0 */
106
#define LPM1         _bis_SR_register(LPM1_bits)         /* Enter Low Power Mode 1 */
107
#define LPM1_EXIT    _bic_SR_register_on_exit(LPM1_bits) /* Exit Low Power Mode 1 */
108
#define LPM2         _bis_SR_register(LPM2_bits)         /* Enter Low Power Mode 2 */
109
#define LPM2_EXIT    _bic_SR_register_on_exit(LPM2_bits) /* Exit Low Power Mode 2 */
110
#define LPM3         _bis_SR_register(LPM3_bits)         /* Enter Low Power Mode 3 */
111
#define LPM3_EXIT    _bic_SR_register_on_exit(LPM3_bits) /* Exit Low Power Mode 3 */
112
#define LPM4         _bis_SR_register(LPM4_bits)         /* Enter Low Power Mode 4 */
113
#define LPM4_EXIT    _bic_SR_register_on_exit(LPM4_bits) /* Exit Low Power Mode 4 */
114
#endif /* End #defines for C */
115
 
116
/************************************************************
117
* PERIPHERAL FILE MAP
118
************************************************************/
119
 
120
/************************************************************
121
* SPECIAL FUNCTION REGISTER ADDRESSES + CONTROL BITS
122
************************************************************/
123
 
124
SFR_8BIT(IE1);                                /* Interrupt Enable 1 */
125
#define U0IE                   IE1            /* UART0 Interrupt Enable Register */
126
#define WDTIE                  (0x01)
127
#define OFIE                   (0x02)
128
#define NMIIE                  (0x10)
129
#define ACCVIE                 (0x20)
130
#define URXIE0                 (0x40)
131
#define UTXIE0                 (0x80)
132
 
133
SFR_8BIT(IFG1);                               /* Interrupt Flag 1 */
134
#define U0IFG                  IFG1           /* UART0 Interrupt Flag Register */
135
#define WDTIFG                 (0x01)
136
#define OFIFG                  (0x02)
137
#define NMIIFG                 (0x10)
138
#define URXIFG0                (0x40)
139
#define UTXIFG0                (0x80)
140
 
141
SFR_8BIT(ME1);                                /* Module Enable 1 */
142
#define U0ME                   ME1            /* UART0 Module Enable Register */
143
#define URXE0                  (0x40)
144
#define UTXE0                  (0x80)
145
#define USPIE0                 (0x40)
146
 
147
/************************************************************
148
* WATCHDOG TIMER
149
************************************************************/
150
#define __MSP430_HAS_WDT__                    /* Definition to show that Module is available */
151
 
152
SFR_16BIT(WDTCTL);                            /* Watchdog Timer Control */
153
/* The bit names have been prefixed with "WDT" */
154
#define WDTIS0                 (0x0001)
155
#define WDTIS1                 (0x0002)
156
#define WDTSSEL                (0x0004)
157
#define WDTCNTCL               (0x0008)
158
#define WDTTMSEL               (0x0010)
159
#define WDTNMI                 (0x0020)
160
#define WDTNMIES               (0x0040)
161
#define WDTHOLD                (0x0080)
162
 
163
#define WDTPW                  (0x5A00)
164
 
165
/* WDT-interval times [1ms] coded with Bits 0-2 */
166
/* WDT is clocked by fSMCLK (assumed 1MHz) */
167
#define WDT_MDLY_32         (WDTPW+WDTTMSEL+WDTCNTCL)                         /* 32ms interval (default) */
168
#define WDT_MDLY_8          (WDTPW+WDTTMSEL+WDTCNTCL+WDTIS0)                  /* 8ms     " */
169
#define WDT_MDLY_0_5        (WDTPW+WDTTMSEL+WDTCNTCL+WDTIS1)                  /* 0.5ms   " */
170
#define WDT_MDLY_0_064      (WDTPW+WDTTMSEL+WDTCNTCL+WDTIS1+WDTIS0)           /* 0.064ms " */
171
/* WDT is clocked by fACLK (assumed 32KHz) */
172
#define WDT_ADLY_1000       (WDTPW+WDTTMSEL+WDTCNTCL+WDTSSEL)                 /* 1000ms  " */
173
#define WDT_ADLY_250        (WDTPW+WDTTMSEL+WDTCNTCL+WDTSSEL+WDTIS0)          /* 250ms   " */
174
#define WDT_ADLY_16         (WDTPW+WDTTMSEL+WDTCNTCL+WDTSSEL+WDTIS1)          /* 16ms    " */
175
#define WDT_ADLY_1_9        (WDTPW+WDTTMSEL+WDTCNTCL+WDTSSEL+WDTIS1+WDTIS0)   /* 1.9ms   " */
176
/* Watchdog mode -> reset after expired time */
177
/* WDT is clocked by fSMCLK (assumed 1MHz) */
178
#define WDT_MRST_32         (WDTPW+WDTCNTCL)                                  /* 32ms interval (default) */
179
#define WDT_MRST_8          (WDTPW+WDTCNTCL+WDTIS0)                           /* 8ms     " */
180
#define WDT_MRST_0_5        (WDTPW+WDTCNTCL+WDTIS1)                           /* 0.5ms   " */
181
#define WDT_MRST_0_064      (WDTPW+WDTCNTCL+WDTIS1+WDTIS0)                    /* 0.064ms " */
182
/* WDT is clocked by fACLK (assumed 32KHz) */
183
#define WDT_ARST_1000       (WDTPW+WDTCNTCL+WDTSSEL)                          /* 1000ms  " */
184
#define WDT_ARST_250        (WDTPW+WDTCNTCL+WDTSSEL+WDTIS0)                   /* 250ms   " */
185
#define WDT_ARST_16         (WDTPW+WDTCNTCL+WDTSSEL+WDTIS1)                   /* 16ms    " */
186
#define WDT_ARST_1_9        (WDTPW+WDTCNTCL+WDTSSEL+WDTIS1+WDTIS0)            /* 1.9ms   " */
187
 
188
/* INTERRUPT CONTROL */
189
/* These two bits are defined in the Special Function Registers */
190
/* #define WDTIE               0x01 */
191
/* #define WDTIFG              0x01 */
192
 
193
/************************************************************
194
* DIGITAL I/O Port1/2
195
************************************************************/
196
#define __MSP430_HAS_PORT1__                  /* Definition to show that Module is available */
197
#define __MSP430_HAS_PORT2__                  /* Definition to show that Module is available */
198
 
199
SFR_8BIT(P1IN);                               /* Port 1 Input */
200
SFR_8BIT(P1OUT);                              /* Port 1 Output */
201
SFR_8BIT(P1DIR);                              /* Port 1 Direction */
202
SFR_8BIT(P1IFG);                              /* Port 1 Interrupt Flag */
203
SFR_8BIT(P1IES);                              /* Port 1 Interrupt Edge Select */
204
SFR_8BIT(P1IE);                               /* Port 1 Interrupt Enable */
205
SFR_8BIT(P1SEL);                              /* Port 1 Selection */
206
 
207
SFR_8BIT(P2IN);                               /* Port 2 Input */
208
SFR_8BIT(P2OUT);                              /* Port 2 Output */
209
SFR_8BIT(P2DIR);                              /* Port 2 Direction */
210
SFR_8BIT(P2IFG);                              /* Port 2 Interrupt Flag */
211
SFR_8BIT(P2IES);                              /* Port 2 Interrupt Edge Select */
212
SFR_8BIT(P2IE);                               /* Port 2 Interrupt Enable */
213
SFR_8BIT(P2SEL);                              /* Port 2 Selection */
214
 
215
/************************************************************
216
* DIGITAL I/O Port3/4
217
************************************************************/
218
#define __MSP430_HAS_PORT3__                  /* Definition to show that Module is available */
219
#define __MSP430_HAS_PORT4__                  /* Definition to show that Module is available */
220
 
221
SFR_8BIT(P3IN);                               /* Port 3 Input */
222
SFR_8BIT(P3OUT);                              /* Port 3 Output */
223
SFR_8BIT(P3DIR);                              /* Port 3 Direction */
224
SFR_8BIT(P3SEL);                              /* Port 3 Selection */
225
 
226
SFR_8BIT(P4IN);                               /* Port 4 Input */
227
SFR_8BIT(P4OUT);                              /* Port 4 Output */
228
SFR_8BIT(P4DIR);                              /* Port 4 Direction */
229
SFR_8BIT(P4SEL);                              /* Port 4 Selection */
230
 
231
/************************************************************
232
* DIGITAL I/O Port5/6
233
************************************************************/
234
#define __MSP430_HAS_PORT5__                  /* Definition to show that Module is available */
235
#define __MSP430_HAS_PORT6__                  /* Definition to show that Module is available */
236
 
237
SFR_8BIT(P5IN);                               /* Port 5 Input */
238
SFR_8BIT(P5OUT);                              /* Port 5 Output */
239
SFR_8BIT(P5DIR);                              /* Port 5 Direction */
240
SFR_8BIT(P5SEL);                              /* Port 5 Selection */
241
 
242
SFR_8BIT(P6IN);                               /* Port 6 Input */
243
SFR_8BIT(P6OUT);                              /* Port 6 Output */
244
SFR_8BIT(P6DIR);                              /* Port 6 Direction */
245
SFR_8BIT(P6SEL);                              /* Port 6 Selection */
246
 
247
/************************************************************
248
* USART
249
************************************************************/
250
 
251
/* UxCTL */
252
#define PENA                   (0x80)         /* Parity enable */
253
#define PEV                    (0x40)         /* Parity 0:odd / 1:even */
254
#define SPB                    (0x20)         /* Stop Bits 0:one / 1: two */
255
#define CHAR                   (0x10)         /* Data 0:7-bits / 1:8-bits */
256
#define LISTEN                 (0x08)         /* Listen mode */
257
#define SYNC                   (0x04)         /* UART / SPI mode */
258
#define MM                     (0x02)         /* Master Mode off/on */
259
#define SWRST                  (0x01)         /* USART Software Reset */
260
 
261
/* UxTCTL */
262
#define CKPH                   (0x80)         /* SPI: Clock Phase */
263
#define CKPL                   (0x40)         /* Clock Polarity */
264
#define SSEL1                  (0x20)         /* Clock Source Select 1 */
265
#define SSEL0                  (0x10)         /* Clock Source Select 0 */
266
#define URXSE                  (0x08)         /* Receive Start edge select */
267
#define TXWAKE                 (0x04)         /* TX Wake up mode */
268
#define STC                    (0x02)         /* SPI: STC enable 0:on / 1:off */
269
#define TXEPT                  (0x01)         /* TX Buffer empty */
270
 
271
/* UxRCTL */
272
#define FE                     (0x80)         /* Frame Error */
273
#define PE                     (0x40)         /* Parity Error */
274
#define OE                     (0x20)         /* Overrun Error */
275
#define BRK                    (0x10)         /* Break detected */
276
#define URXEIE                 (0x08)         /* RX Error interrupt enable */
277
#define URXWIE                 (0x04)         /* RX Wake up interrupt enable */
278
#define RXWAKE                 (0x02)         /* RX Wake up detect */
279
#define RXERR                  (0x01)         /* RX Error Error */
280
 
281
/************************************************************
282
* USART 0
283
************************************************************/
284
#define __MSP430_HAS_UART0__                  /* Definition to show that Module is available */
285
 
286
SFR_8BIT(U0CTL);                              /* USART 0 Control */
287
SFR_8BIT(U0TCTL);                             /* USART 0 Transmit Control */
288
SFR_8BIT(U0RCTL);                             /* USART 0 Receive Control */
289
SFR_8BIT(U0MCTL);                             /* USART 0 Modulation Control */
290
SFR_8BIT(U0BR0);                              /* USART 0 Baud Rate 0 */
291
SFR_8BIT(U0BR1);                              /* USART 0 Baud Rate 1 */
292
SFR_8BIT(U0RXBUF);                            /* USART 0 Receive Buffer */
293
SFR_8BIT(U0TXBUF);                            /* USART 0 Transmit Buffer */
294
 
295
/* Alternate register names */
296
 
297
#define UCTL0                  U0CTL          /* USART 0 Control */
298
#define UTCTL0                 U0TCTL         /* USART 0 Transmit Control */
299
#define URCTL0                 U0RCTL         /* USART 0 Receive Control */
300
#define UMCTL0                 U0MCTL         /* USART 0 Modulation Control */
301
#define UBR00                  U0BR0          /* USART 0 Baud Rate 0 */
302
#define UBR10                  U0BR1          /* USART 0 Baud Rate 1 */
303
#define RXBUF0                 U0RXBUF        /* USART 0 Receive Buffer */
304
#define TXBUF0                 U0TXBUF        /* USART 0 Transmit Buffer */
305
#define UCTL0_                 U0CTL_         /* USART 0 Control */
306
#define UTCTL0_                U0TCTL_        /* USART 0 Transmit Control */
307
#define URCTL0_                U0RCTL_        /* USART 0 Receive Control */
308
#define UMCTL0_                U0MCTL_        /* USART 0 Modulation Control */
309
#define UBR00_                 U0BR0_         /* USART 0 Baud Rate 0 */
310
#define UBR10_                 U0BR1_         /* USART 0 Baud Rate 1 */
311
#define RXBUF0_                U0RXBUF_       /* USART 0 Receive Buffer */
312
#define TXBUF0_                U0TXBUF_       /* USART 0 Transmit Buffer */
313
#define UCTL_0                 U0CTL          /* USART 0 Control */
314
#define UTCTL_0                U0TCTL         /* USART 0 Transmit Control */
315
#define URCTL_0                U0RCTL         /* USART 0 Receive Control */
316
#define UMCTL_0                U0MCTL         /* USART 0 Modulation Control */
317
#define UBR0_0                 U0BR0          /* USART 0 Baud Rate 0 */
318
#define UBR1_0                 U0BR1          /* USART 0 Baud Rate 1 */
319
#define RXBUF_0                U0RXBUF        /* USART 0 Receive Buffer */
320
#define TXBUF_0                U0TXBUF        /* USART 0 Transmit Buffer */
321
#define UCTL_0_                U0CTL_         /* USART 0 Control */
322
#define UTCTL_0_               U0TCTL_        /* USART 0 Transmit Control */
323
#define URCTL_0_               U0RCTL_        /* USART 0 Receive Control */
324
#define UMCTL_0_               U0MCTL_        /* USART 0 Modulation Control */
325
#define UBR0_0_                U0BR0_         /* USART 0 Baud Rate 0 */
326
#define UBR1_0_                U0BR1_         /* USART 0 Baud Rate 1 */
327
#define RXBUF_0_               U0RXBUF_       /* USART 0 Receive Buffer */
328
#define TXBUF_0_               U0TXBUF_       /* USART 0 Transmit Buffer */
329
 
330
/************************************************************
331
* Timer A3
332
************************************************************/
333
#define __MSP430_HAS_TA3__                    /* Definition to show that Module is available */
334
 
335
SFR_16BIT(TAIV);                              /* Timer A Interrupt Vector Word */
336
SFR_16BIT(TACTL);                             /* Timer A Control */
337
SFR_16BIT(TACCTL0);                           /* Timer A Capture/Compare Control 0 */
338
SFR_16BIT(TACCTL1);                           /* Timer A Capture/Compare Control 1 */
339
SFR_16BIT(TACCTL2);                           /* Timer A Capture/Compare Control 2 */
340
SFR_16BIT(TAR);                               /* Timer A Counter Register */
341
SFR_16BIT(TACCR0);                            /* Timer A Capture/Compare 0 */
342
SFR_16BIT(TACCR1);                            /* Timer A Capture/Compare 1 */
343
SFR_16BIT(TACCR2);                            /* Timer A Capture/Compare 2 */
344
 
345
/* Alternate register names */
346
#define CCTL0                  TACCTL0        /* Timer A Capture/Compare Control 0 */
347
#define CCTL1                  TACCTL1        /* Timer A Capture/Compare Control 1 */
348
#define CCTL2                  TACCTL2        /* Timer A Capture/Compare Control 2 */
349
#define CCR0                   TACCR0         /* Timer A Capture/Compare 0 */
350
#define CCR1                   TACCR1         /* Timer A Capture/Compare 1 */
351
#define CCR2                   TACCR2         /* Timer A Capture/Compare 2 */
352
#define CCTL0_                 TACCTL0_       /* Timer A Capture/Compare Control 0 */
353
#define CCTL1_                 TACCTL1_       /* Timer A Capture/Compare Control 1 */
354
#define CCTL2_                 TACCTL2_       /* Timer A Capture/Compare Control 2 */
355
#define CCR0_                  TACCR0_        /* Timer A Capture/Compare 0 */
356
#define CCR1_                  TACCR1_        /* Timer A Capture/Compare 1 */
357
#define CCR2_                  TACCR2_        /* Timer A Capture/Compare 2 */
358
/* Alternate register names - 5xx style */
359
#define TA0IV                  TAIV           /* Timer A Interrupt Vector Word */
360
#define TA0CTL                 TACTL          /* Timer A Control */
361
#define TA0CCTL0               TACCTL0        /* Timer A Capture/Compare Control 0 */
362
#define TA0CCTL1               TACCTL1        /* Timer A Capture/Compare Control 1 */
363
#define TA0CCTL2               TACCTL2        /* Timer A Capture/Compare Control 2 */
364
#define TA0R                   TAR            /* Timer A Counter Register */
365
#define TA0CCR0                TACCR0         /* Timer A Capture/Compare 0 */
366
#define TA0CCR1                TACCR1         /* Timer A Capture/Compare 1 */
367
#define TA0CCR2                TACCR2         /* Timer A Capture/Compare 2 */
368
#define TA0IV_                 TAIV_          /* Timer A Interrupt Vector Word */
369
#define TA0CTL_                TACTL_         /* Timer A Control */
370
#define TA0CCTL0_              TACCTL0_       /* Timer A Capture/Compare Control 0 */
371
#define TA0CCTL1_              TACCTL1_       /* Timer A Capture/Compare Control 1 */
372
#define TA0CCTL2_              TACCTL2_       /* Timer A Capture/Compare Control 2 */
373
#define TA0R_                  TAR_           /* Timer A Counter Register */
374
#define TA0CCR0_               TACCR0_        /* Timer A Capture/Compare 0 */
375
#define TA0CCR1_               TACCR1_        /* Timer A Capture/Compare 1 */
376
#define TA0CCR2_               TACCR2_        /* Timer A Capture/Compare 2 */
377
 
378
#define TASSEL1                (0x0200)       /* Timer A clock source select 0 */
379
#define TASSEL0                (0x0100)       /* Timer A clock source select 1 */
380
#define ID1                    (0x0080)       /* Timer A clock input divider 1 */
381
#define ID0                    (0x0040)       /* Timer A clock input divider 0 */
382
#define MC1                    (0x0020)       /* Timer A mode control 1 */
383
#define MC0                    (0x0010)       /* Timer A mode control 0 */
384
#define TACLR                  (0x0004)       /* Timer A counter clear */
385
#define TAIE                   (0x0002)       /* Timer A counter interrupt enable */
386
#define TAIFG                  (0x0001)       /* Timer A counter interrupt flag */
387
 
388
#define MC_0                   (0*0x10u)      /* Timer A mode control: 0 - Stop */
389
#define MC_1                   (1*0x10u)      /* Timer A mode control: 1 - Up to CCR0 */
390
#define MC_2                   (2*0x10u)      /* Timer A mode control: 2 - Continous up */
391
#define MC_3                   (3*0x10u)      /* Timer A mode control: 3 - Up/Down */
392
#define ID_0                   (0*0x40u)      /* Timer A input divider: 0 - /1 */
393
#define ID_1                   (1*0x40u)      /* Timer A input divider: 1 - /2 */
394
#define ID_2                   (2*0x40u)      /* Timer A input divider: 2 - /4 */
395
#define ID_3                   (3*0x40u)      /* Timer A input divider: 3 - /8 */
396
#define TASSEL_0               (0*0x100u)     /* Timer A clock source select: 0 - TACLK */
397
#define TASSEL_1               (1*0x100u)     /* Timer A clock source select: 1 - ACLK  */
398
#define TASSEL_2               (2*0x100u)     /* Timer A clock source select: 2 - SMCLK */
399
#define TASSEL_3               (3*0x100u)     /* Timer A clock source select: 3 - INCLK */
400
 
401
#define CM1                    (0x8000)       /* Capture mode 1 */
402
#define CM0                    (0x4000)       /* Capture mode 0 */
403
#define CCIS1                  (0x2000)       /* Capture input select 1 */
404
#define CCIS0                  (0x1000)       /* Capture input select 0 */
405
#define SCS                    (0x0800)       /* Capture sychronize */
406
#define SCCI                   (0x0400)       /* Latched capture signal (read) */
407
#define CAP                    (0x0100)       /* Capture mode: 1 /Compare mode : 0 */
408
#define OUTMOD2                (0x0080)       /* Output mode 2 */
409
#define OUTMOD1                (0x0040)       /* Output mode 1 */
410
#define OUTMOD0                (0x0020)       /* Output mode 0 */
411
#define CCIE                   (0x0010)       /* Capture/compare interrupt enable */
412
#define CCI                    (0x0008)       /* Capture input signal (read) */
413
#define OUT                    (0x0004)       /* PWM Output signal if output mode 0 */
414
#define COV                    (0x0002)       /* Capture/compare overflow flag */
415
#define CCIFG                  (0x0001)       /* Capture/compare interrupt flag */
416
 
417
#define OUTMOD_0               (0*0x20u)      /* PWM output mode: 0 - output only */
418
#define OUTMOD_1               (1*0x20u)      /* PWM output mode: 1 - set */
419
#define OUTMOD_2               (2*0x20u)      /* PWM output mode: 2 - PWM toggle/reset */
420
#define OUTMOD_3               (3*0x20u)      /* PWM output mode: 3 - PWM set/reset */
421
#define OUTMOD_4               (4*0x20u)      /* PWM output mode: 4 - toggle */
422
#define OUTMOD_5               (5*0x20u)      /* PWM output mode: 5 - Reset */
423
#define OUTMOD_6               (6*0x20u)      /* PWM output mode: 6 - PWM toggle/set */
424
#define OUTMOD_7               (7*0x20u)      /* PWM output mode: 7 - PWM reset/set */
425
#define CCIS_0                 (0*0x1000u)    /* Capture input select: 0 - CCIxA */
426
#define CCIS_1                 (1*0x1000u)    /* Capture input select: 1 - CCIxB */
427
#define CCIS_2                 (2*0x1000u)    /* Capture input select: 2 - GND */
428
#define CCIS_3                 (3*0x1000u)    /* Capture input select: 3 - Vcc */
429
#define CM_0                   (0*0x4000u)    /* Capture mode: 0 - disabled */
430
#define CM_1                   (1*0x4000u)    /* Capture mode: 1 - pos. edge */
431
#define CM_2                   (2*0x4000u)    /* Capture mode: 1 - neg. edge */
432
#define CM_3                   (3*0x4000u)    /* Capture mode: 1 - both edges */
433
 
434
/* TA3IV Definitions */
435
#define TAIV_NONE              (0x0000)       /* No Interrupt pending */
436
#define TAIV_TACCR1            (0x0002)       /* TACCR1_CCIFG */
437
#define TAIV_TACCR2            (0x0004)       /* TACCR2_CCIFG */
438
#define TAIV_6                 (0x0006)       /* Reserved */
439
#define TAIV_8                 (0x0008)       /* Reserved */
440
#define TAIV_TAIFG             (0x000A)       /* TAIFG */
441
 
442
/************************************************************
443
* Timer B3
444
************************************************************/
445
#define __MSP430_HAS_TB3__                    /* Definition to show that Module is available */
446
 
447
SFR_16BIT(TBIV);                              /* Timer B Interrupt Vector Word */
448
SFR_16BIT(TBCTL);                             /* Timer B Control */
449
SFR_16BIT(TBCCTL0);                           /* Timer B Capture/Compare Control 0 */
450
SFR_16BIT(TBCCTL1);                           /* Timer B Capture/Compare Control 1 */
451
SFR_16BIT(TBCCTL2);                           /* Timer B Capture/Compare Control 2 */
452
SFR_16BIT(TBR);                               /* Timer B Counter Register */
453
SFR_16BIT(TBCCR0);                            /* Timer B Capture/Compare 0 */
454
SFR_16BIT(TBCCR1);                            /* Timer B Capture/Compare 1 */
455
SFR_16BIT(TBCCR2);                            /* Timer B Capture/Compare 2 */
456
 
457
/* Alternate register names - 5xx style */
458
#define TB0IV                  TBIV           /* Timer B Interrupt Vector Word */
459
#define TB0CTL                 TBCTL          /* Timer B Control */
460
#define TB0CCTL0               TBCCTL0        /* Timer B Capture/Compare Control 0 */
461
#define TB0CCTL1               TBCCTL1        /* Timer B Capture/Compare Control 1 */
462
#define TB0CCTL2               TBCCTL2        /* Timer B Capture/Compare Control 2 */
463
#define TB0R                   TBR            /* Timer B Counter Register */
464
#define TB0CCR0                TBCCR0         /* Timer B Capture/Compare 0 */
465
#define TB0CCR1                TBCCR1         /* Timer B Capture/Compare 1 */
466
#define TB0CCR2                TBCCR2         /* Timer B Capture/Compare 2 */
467
#define TB0IV_                 TBIV_          /* Timer B Interrupt Vector Word */
468
#define TB0CTL_                TBCTL_         /* Timer B Control */
469
#define TB0CCTL0_              TBCCTL0_       /* Timer B Capture/Compare Control 0 */
470
#define TB0CCTL1_              TBCCTL1_       /* Timer B Capture/Compare Control 1 */
471
#define TB0CCTL2_              TBCCTL2_       /* Timer B Capture/Compare Control 2 */
472
#define TB0R_                  TBR_           /* Timer B Counter Register */
473
#define TB0CCR0_               TBCCR0_        /* Timer B Capture/Compare 0 */
474
#define TB0CCR1_               TBCCR1_        /* Timer B Capture/Compare 1 */
475
#define TB0CCR2_               TBCCR2_        /* Timer B Capture/Compare 2 */
476
 
477
#define TBCLGRP1               (0x4000)       /* Timer B Compare latch load group 1 */
478
#define TBCLGRP0               (0x2000)       /* Timer B Compare latch load group 0 */
479
#define CNTL1                  (0x1000)       /* Counter lenght 1 */
480
#define CNTL0                  (0x0800)       /* Counter lenght 0 */
481
#define TBSSEL1                (0x0200)       /* Clock source 1 */
482
#define TBSSEL0                (0x0100)       /* Clock source 0 */
483
#define TBCLR                  (0x0004)       /* Timer B counter clear */
484
#define TBIE                   (0x0002)       /* Timer B interrupt enable */
485
#define TBIFG                  (0x0001)       /* Timer B interrupt flag */
486
 
487
#define SHR1                   (0x4000)       /* Timer B Compare latch load group 1 */
488
#define SHR0                   (0x2000)       /* Timer B Compare latch load group 0 */
489
 
490
#define TBSSEL_0               (0*0x0100u)    /* Clock Source: TBCLK */
491
#define TBSSEL_1               (1*0x0100u)    /* Clock Source: ACLK  */
492
#define TBSSEL_2               (2*0x0100u)    /* Clock Source: SMCLK */
493
#define TBSSEL_3               (3*0x0100u)    /* Clock Source: INCLK */
494
#define CNTL_0                 (0*0x0800u)    /* Counter lenght: 16 bit */
495
#define CNTL_1                 (1*0x0800u)    /* Counter lenght: 12 bit */
496
#define CNTL_2                 (2*0x0800u)    /* Counter lenght: 10 bit */
497
#define CNTL_3                 (3*0x0800u)    /* Counter lenght:  8 bit */
498
#define SHR_0                  (0*0x2000u)    /* Timer B Group: 0 - individually */
499
#define SHR_1                  (1*0x2000u)    /* Timer B Group: 1 - 3 groups (1-2, 3-4, 5-6) */
500
#define SHR_2                  (2*0x2000u)    /* Timer B Group: 2 - 2 groups (1-3, 4-6)*/
501
#define SHR_3                  (3*0x2000u)    /* Timer B Group: 3 - 1 group (all) */
502
#define TBCLGRP_0              (0*0x2000u)    /* Timer B Group: 0 - individually */
503
#define TBCLGRP_1              (1*0x2000u)    /* Timer B Group: 1 - 3 groups (1-2, 3-4, 5-6) */
504
#define TBCLGRP_2              (2*0x2000u)    /* Timer B Group: 2 - 2 groups (1-3, 4-6)*/
505
#define TBCLGRP_3              (3*0x2000u)    /* Timer B Group: 3 - 1 group (all) */
506
 
507
/* Additional Timer B Control Register bits are defined in Timer A */
508
 
509
#define CLLD1                  (0x0400)       /* Compare latch load source 1 */
510
#define CLLD0                  (0x0200)       /* Compare latch load source 0 */
511
 
512
#define SLSHR1                 (0x0400)       /* Compare latch load source 1 */
513
#define SLSHR0                 (0x0200)       /* Compare latch load source 0 */
514
 
515
#define SLSHR_0                (0*0x0200u)    /* Compare latch load sourec : 0 - immediate */
516
#define SLSHR_1                (1*0x0200u)    /* Compare latch load sourec : 1 - TBR counts to 0 */
517
#define SLSHR_2                (2*0x0200u)    /* Compare latch load sourec : 2 - up/down */
518
#define SLSHR_3                (3*0x0200u)    /* Compare latch load sourec : 3 - TBR counts to TBCTL0 */
519
 
520
#define CLLD_0                 (0*0x0200u)    /* Compare latch load sourec : 0 - immediate */
521
#define CLLD_1                 (1*0x0200u)    /* Compare latch load sourec : 1 - TBR counts to 0 */
522
#define CLLD_2                 (2*0x0200u)    /* Compare latch load sourec : 2 - up/down */
523
#define CLLD_3                 (3*0x0200u)    /* Compare latch load sourec : 3 - TBR counts to TBCTL0 */
524
 
525
/* TB3IV Definitions */
526
#define TBIV_NONE              (0x0000)       /* No Interrupt pending */
527
#define TBIV_TBCCR1            (0x0002)       /* TBCCR1_CCIFG */
528
#define TBIV_TBCCR2            (0x0004)       /* TBCCR2_CCIFG */
529
#define TBIV_3                 (0x0006)       /* Reserved */
530
#define TBIV_4                 (0x0008)       /* Reserved */
531
#define TBIV_5                 (0x000A)       /* Reserved */
532
#define TBIV_6                 (0x000C)       /* Reserved */
533
#define TBIV_TBIFG             (0x000E)       /* TBIFG */
534
 
535
/************************************************************
536
* Basic Clock Module
537
************************************************************/
538
#define __MSP430_HAS_BASIC_CLOCK__                /* Definition to show that Module is available */
539
 
540
SFR_8BIT(DCOCTL);                             /* DCO Clock Frequency Control */
541
SFR_8BIT(BCSCTL1);                            /* Basic Clock System Control 1 */
542
SFR_8BIT(BCSCTL2);                            /* Basic Clock System Control 2 */
543
 
544
#define MOD0                   (0x01)         /* Modulation Bit 0 */
545
#define MOD1                   (0x02)         /* Modulation Bit 1 */
546
#define MOD2                   (0x04)         /* Modulation Bit 2 */
547
#define MOD3                   (0x08)         /* Modulation Bit 3 */
548
#define MOD4                   (0x10)         /* Modulation Bit 4 */
549
#define DCO0                   (0x20)         /* DCO Select Bit 0 */
550
#define DCO1                   (0x40)         /* DCO Select Bit 1 */
551
#define DCO2                   (0x80)         /* DCO Select Bit 2 */
552
 
553
#define RSEL0                  (0x01)         /* Range Select Bit 0 */
554
#define RSEL1                  (0x02)         /* Range Select Bit 1 */
555
#define RSEL2                  (0x04)         /* Range Select Bit 2 */
556
#define XT5V                   (0x08)         /* XT5V should always be reset */
557
#define DIVA0                  (0x10)         /* ACLK Divider 0 */
558
#define DIVA1                  (0x20)         /* ACLK Divider 1 */
559
#define XTS                    (0x40)         /* LFXTCLK 0:Low Freq. / 1: High Freq. */
560
#define XT2OFF                 (0x80)         /* Enable XT2CLK */
561
 
562
#define DIVA_0                 (0x00)         /* ACLK Divider 0: /1 */
563
#define DIVA_1                 (0x10)         /* ACLK Divider 1: /2 */
564
#define DIVA_2                 (0x20)         /* ACLK Divider 2: /4 */
565
#define DIVA_3                 (0x30)         /* ACLK Divider 3: /8 */
566
 
567
#define DCOR                   (0x01)         /* Enable External Resistor : 1 */
568
#define DIVS0                  (0x02)         /* SMCLK Divider 0 */
569
#define DIVS1                  (0x04)         /* SMCLK Divider 1 */
570
#define SELS                   (0x08)         /* SMCLK Source Select 0:DCOCLK / 1:XT2CLK/LFXTCLK */
571
#define DIVM0                  (0x10)         /* MCLK Divider 0 */
572
#define DIVM1                  (0x20)         /* MCLK Divider 1 */
573
#define SELM0                  (0x40)         /* MCLK Source Select 0 */
574
#define SELM1                  (0x80)         /* MCLK Source Select 1 */
575
 
576
#define DIVS_0                 (0x00)         /* SMCLK Divider 0: /1 */
577
#define DIVS_1                 (0x02)         /* SMCLK Divider 1: /2 */
578
#define DIVS_2                 (0x04)         /* SMCLK Divider 2: /4 */
579
#define DIVS_3                 (0x06)         /* SMCLK Divider 3: /8 */
580
 
581
#define DIVM_0                 (0x00)         /* MCLK Divider 0: /1 */
582
#define DIVM_1                 (0x10)         /* MCLK Divider 1: /2 */
583
#define DIVM_2                 (0x20)         /* MCLK Divider 2: /4 */
584
#define DIVM_3                 (0x30)         /* MCLK Divider 3: /8 */
585
 
586
#define SELM_0                 (0x00)         /* MCLK Source Select 0: DCOCLK */
587
#define SELM_1                 (0x40)         /* MCLK Source Select 1: DCOCLK */
588
#define SELM_2                 (0x80)         /* MCLK Source Select 2: XT2CLK/LFXTCLK */
589
#define SELM_3                 (0xC0)         /* MCLK Source Select 3: LFXTCLK */
590
 
591
/*************************************************************
592
* Flash Memory
593
*************************************************************/
594
#define __MSP430_HAS_FLASH__                  /* Definition to show that Module is available */
595
 
596
SFR_16BIT(FCTL1);                             /* FLASH Control 1 */
597
SFR_16BIT(FCTL2);                             /* FLASH Control 2 */
598
SFR_16BIT(FCTL3);                             /* FLASH Control 3 */
599
 
600
#define FRKEY                  (0x9600)       /* Flash key returned by read */
601
#define FWKEY                  (0xA500)       /* Flash key for write */
602
#define FXKEY                  (0x3300)       /* for use with XOR instruction */
603
 
604
#define ERASE                  (0x0002)       /* Enable bit for Flash segment erase */
605
#define MERAS                  (0x0004)       /* Enable bit for Flash mass erase */
606
#define WRT                    (0x0040)       /* Enable bit for Flash write */
607
#define BLKWRT                 (0x0080)       /* Enable bit for Flash segment write */
608
#define SEGWRT                 (0x0080)       /* old definition */ /* Enable bit for Flash segment write */
609
 
610
#define FN0                    (0x0001)       /* Divide Flash clock by 1 to 64 using FN0 to FN5 according to: */
611
#define FN1                    (0x0002)       /*  32*FN5 + 16*FN4 + 8*FN3 + 4*FN2 + 2*FN1 + FN0 + 1 */
612
#ifndef FN2
613
#define FN2                    (0x0004)
614
#endif
615
#ifndef FN3
616
#define FN3                    (0x0008)
617
#endif
618
#ifndef FN4
619
#define FN4                    (0x0010)
620
#endif
621
#define FN5                    (0x0020)
622
#define FSSEL0                 (0x0040)       /* Flash clock select 0 */        /* to distinguish from USART SSELx */
623
#define FSSEL1                 (0x0080)       /* Flash clock select 1 */
624
 
625
#define FSSEL_0                (0x0000)       /* Flash clock select: 0 - ACLK */
626
#define FSSEL_1                (0x0040)       /* Flash clock select: 1 - MCLK */
627
#define FSSEL_2                (0x0080)       /* Flash clock select: 2 - SMCLK */
628
#define FSSEL_3                (0x00C0)       /* Flash clock select: 3 - SMCLK */
629
 
630
#define BUSY                   (0x0001)       /* Flash busy: 1 */
631
#define KEYV                   (0x0002)       /* Flash Key violation flag */
632
#define ACCVIFG                (0x0004)       /* Flash Access violation flag */
633
#define WAIT                   (0x0008)       /* Wait flag for segment write */
634
#define LOCK                   (0x0010)       /* Lock bit: 1 - Flash is locked (read only) */
635
#define EMEX                   (0x0020)       /* Flash Emergency Exit */
636
 
637
/************************************************************
638
* Comparator A
639
************************************************************/
640
#define __MSP430_HAS_COMPA__                  /* Definition to show that Module is available */
641
 
642
SFR_8BIT(CACTL1);                             /* Comparator A Control 1 */
643
SFR_8BIT(CACTL2);                             /* Comparator A Control 2 */
644
SFR_8BIT(CAPD);                               /* Comparator A Port Disable */
645
 
646
#define CAIFG                  (0x01)         /* Comp. A Interrupt Flag */
647
#define CAIE                   (0x02)         /* Comp. A Interrupt Enable */
648
#define CAIES                  (0x04)         /* Comp. A Int. Edge Select: 0:rising / 1:falling */
649
#define CAON                   (0x08)         /* Comp. A enable */
650
#define CAREF0                 (0x10)         /* Comp. A Internal Reference Select 0 */
651
#define CAREF1                 (0x20)         /* Comp. A Internal Reference Select 1 */
652
#define CARSEL                 (0x40)         /* Comp. A Internal Reference Enable */
653
#define CAEX                   (0x80)         /* Comp. A Exchange Inputs */
654
 
655
#define CAREF_0                (0x00)         /* Comp. A Int. Ref. Select 0 : Off */
656
#define CAREF_1                (0x10)         /* Comp. A Int. Ref. Select 1 : 0.25*Vcc */
657
#define CAREF_2                (0x20)         /* Comp. A Int. Ref. Select 2 : 0.5*Vcc */
658
#define CAREF_3                (0x30)         /* Comp. A Int. Ref. Select 3 : Vt*/
659
 
660
#define CAOUT                  (0x01)         /* Comp. A Output */
661
#define CAF                    (0x02)         /* Comp. A Enable Output Filter */
662
#define P2CA0                  (0x04)         /* Comp. A Connect External Signal to CA0 : 1 */
663
#define P2CA1                  (0x08)         /* Comp. A Connect External Signal to CA1 : 1 */
664
#define CACTL24                (0x10)
665
#define CACTL25                (0x20)
666
#define CACTL26                (0x40)
667
#define CACTL27                (0x80)
668
 
669
#define CAPD0                  (0x01)         /* Comp. A Disable Input Buffer of Port Register .0 */
670
#define CAPD1                  (0x02)         /* Comp. A Disable Input Buffer of Port Register .1 */
671
#define CAPD2                  (0x04)         /* Comp. A Disable Input Buffer of Port Register .2 */
672
#define CAPD3                  (0x08)         /* Comp. A Disable Input Buffer of Port Register .3 */
673
#define CAPD4                  (0x10)         /* Comp. A Disable Input Buffer of Port Register .4 */
674
#define CAPD5                  (0x20)         /* Comp. A Disable Input Buffer of Port Register .5 */
675
#define CAPD6                  (0x40)         /* Comp. A Disable Input Buffer of Port Register .6 */
676
#define CAPD7                  (0x80)         /* Comp. A Disable Input Buffer of Port Register .7 */
677
 
678
/************************************************************
679
* ADC12
680
************************************************************/
681
#define __MSP430_HAS_ADC12__                  /* Definition to show that Module is available */
682
 
683
SFR_16BIT(ADC12CTL0);                         /* ADC12 Control 0 */
684
SFR_16BIT(ADC12CTL1);                         /* ADC12 Control 1 */
685
SFR_16BIT(ADC12IFG);                          /* ADC12 Interrupt Flag */
686
SFR_16BIT(ADC12IE);                           /* ADC12 Interrupt Enable */
687
SFR_16BIT(ADC12IV);                           /* ADC12 Interrupt Vector Word */
688
 
689
#define ADC12MEM_              (0x0140)       /* ADC12 Conversion Memory */
690
#ifdef __ASM_HEADER__
691
#define ADC12MEM               (ADC12MEM_)    /* ADC12 Conversion Memory (for assembler) */
692
#else
693
#define ADC12MEM               ((int*)        ADC12MEM_) /* ADC12 Conversion Memory (for C) */
694
#endif
695
SFR_16BIT(ADC12MEM0);                         /* ADC12 Conversion Memory 0 */
696
SFR_16BIT(ADC12MEM1);                         /* ADC12 Conversion Memory 1 */
697
SFR_16BIT(ADC12MEM2);                         /* ADC12 Conversion Memory 2 */
698
SFR_16BIT(ADC12MEM3);                         /* ADC12 Conversion Memory 3 */
699
SFR_16BIT(ADC12MEM4);                         /* ADC12 Conversion Memory 4 */
700
SFR_16BIT(ADC12MEM5);                         /* ADC12 Conversion Memory 5 */
701
SFR_16BIT(ADC12MEM6);                         /* ADC12 Conversion Memory 6 */
702
SFR_16BIT(ADC12MEM7);                         /* ADC12 Conversion Memory 7 */
703
SFR_16BIT(ADC12MEM8);                         /* ADC12 Conversion Memory 8 */
704
SFR_16BIT(ADC12MEM9);                         /* ADC12 Conversion Memory 9 */
705
SFR_16BIT(ADC12MEM10);                        /* ADC12 Conversion Memory 10 */
706
SFR_16BIT(ADC12MEM11);                        /* ADC12 Conversion Memory 11 */
707
SFR_16BIT(ADC12MEM12);                        /* ADC12 Conversion Memory 12 */
708
SFR_16BIT(ADC12MEM13);                        /* ADC12 Conversion Memory 13 */
709
SFR_16BIT(ADC12MEM14);                        /* ADC12 Conversion Memory 14 */
710
SFR_16BIT(ADC12MEM15);                        /* ADC12 Conversion Memory 15 */
711
 
712
#define ADC12MCTL_             (0x0080)       /* ADC12 Memory Control */
713
#ifdef __ASM_HEADER__
714
#define ADC12MCTL              (ADC12MCTL_)   /* ADC12 Memory Control (for assembler) */
715
#else
716
#define ADC12MCTL              ((char*)       ADC12MCTL_) /* ADC12 Memory Control (for C) */
717
#endif
718
SFR_8BIT(ADC12MCTL0);                         /* ADC12 Memory Control 0 */
719
SFR_8BIT(ADC12MCTL1);                         /* ADC12 Memory Control 1 */
720
SFR_8BIT(ADC12MCTL2);                         /* ADC12 Memory Control 2 */
721
SFR_8BIT(ADC12MCTL3);                         /* ADC12 Memory Control 3 */
722
SFR_8BIT(ADC12MCTL4);                         /* ADC12 Memory Control 4 */
723
SFR_8BIT(ADC12MCTL5);                         /* ADC12 Memory Control 5 */
724
SFR_8BIT(ADC12MCTL6);                         /* ADC12 Memory Control 6 */
725
SFR_8BIT(ADC12MCTL7);                         /* ADC12 Memory Control 7 */
726
SFR_8BIT(ADC12MCTL8);                         /* ADC12 Memory Control 8 */
727
SFR_8BIT(ADC12MCTL9);                         /* ADC12 Memory Control 9 */
728
SFR_8BIT(ADC12MCTL10);                        /* ADC12 Memory Control 10 */
729
SFR_8BIT(ADC12MCTL11);                        /* ADC12 Memory Control 11 */
730
SFR_8BIT(ADC12MCTL12);                        /* ADC12 Memory Control 12 */
731
SFR_8BIT(ADC12MCTL13);                        /* ADC12 Memory Control 13 */
732
SFR_8BIT(ADC12MCTL14);                        /* ADC12 Memory Control 14 */
733
SFR_8BIT(ADC12MCTL15);                        /* ADC12 Memory Control 15 */
734
 
735
/* ADC12CTL0 */
736
#define ADC12SC                (0x001)        /* ADC12 Start Conversion */
737
#define ENC                    (0x002)        /* ADC12 Enable Conversion */
738
#define ADC12TOVIE             (0x004)        /* ADC12 Timer Overflow interrupt enable */
739
#define ADC12OVIE              (0x008)        /* ADC12 Overflow interrupt enable */
740
#define ADC12ON                (0x010)        /* ADC12 On/enable */
741
#define REFON                  (0x020)        /* ADC12 Reference on */
742
#define REF2_5V                (0x040)        /* ADC12 Ref 0:1.5V / 1:2.5V */
743
#define MSC                    (0x080)        /* ADC12 Multiple SampleConversion */
744
#define SHT00                  (0x0100)       /* ADC12 Sample Hold 0 Select 0 */
745
#define SHT01                  (0x0200)       /* ADC12 Sample Hold 0 Select 1 */
746
#define SHT02                  (0x0400)       /* ADC12 Sample Hold 0 Select 2 */
747
#define SHT03                  (0x0800)       /* ADC12 Sample Hold 0 Select 3 */
748
#define SHT10                  (0x1000)       /* ADC12 Sample Hold 0 Select 0 */
749
#define SHT11                  (0x2000)       /* ADC12 Sample Hold 1 Select 1 */
750
#define SHT12                  (0x4000)       /* ADC12 Sample Hold 2 Select 2 */
751
#define SHT13                  (0x8000)       /* ADC12 Sample Hold 3 Select 3 */
752
#define MSH                    (0x080)
753
 
754
#define SHT0_0                 (0*0x100u)     /* ADC12 Sample Hold 0 Select Bit: 0 */
755
#define SHT0_1                 (1*0x100u)     /* ADC12 Sample Hold 0 Select Bit: 1 */
756
#define SHT0_2                 (2*0x100u)     /* ADC12 Sample Hold 0 Select Bit: 2 */
757
#define SHT0_3                 (3*0x100u)     /* ADC12 Sample Hold 0 Select Bit: 3 */
758
#define SHT0_4                 (4*0x100u)     /* ADC12 Sample Hold 0 Select Bit: 4 */
759
#define SHT0_5                 (5*0x100u)     /* ADC12 Sample Hold 0 Select Bit: 5 */
760
#define SHT0_6                 (6*0x100u)     /* ADC12 Sample Hold 0 Select Bit: 6 */
761
#define SHT0_7                 (7*0x100u)     /* ADC12 Sample Hold 0 Select Bit: 7 */
762
#define SHT0_8                 (8*0x100u)     /* ADC12 Sample Hold 0 Select Bit: 8 */
763
#define SHT0_9                 (9*0x100u)     /* ADC12 Sample Hold 0 Select Bit: 9 */
764
#define SHT0_10                (10*0x100u)    /* ADC12 Sample Hold 0 Select Bit: 10 */
765
#define SHT0_11                (11*0x100u)    /* ADC12 Sample Hold 0 Select Bit: 11 */
766
#define SHT0_12                (12*0x100u)    /* ADC12 Sample Hold 0 Select Bit: 12 */
767
#define SHT0_13                (13*0x100u)    /* ADC12 Sample Hold 0 Select Bit: 13 */
768
#define SHT0_14                (14*0x100u)    /* ADC12 Sample Hold 0 Select Bit: 14 */
769
#define SHT0_15                (15*0x100u)    /* ADC12 Sample Hold 0 Select Bit: 15 */
770
 
771
#define SHT1_0                 (0*0x1000u)    /* ADC12 Sample Hold 1 Select Bit: 0 */
772
#define SHT1_1                 (1*0x1000u)    /* ADC12 Sample Hold 1 Select Bit: 1 */
773
#define SHT1_2                 (2*0x1000u)    /* ADC12 Sample Hold 1 Select Bit: 2 */
774
#define SHT1_3                 (3*0x1000u)    /* ADC12 Sample Hold 1 Select Bit: 3 */
775
#define SHT1_4                 (4*0x1000u)    /* ADC12 Sample Hold 1 Select Bit: 4 */
776
#define SHT1_5                 (5*0x1000u)    /* ADC12 Sample Hold 1 Select Bit: 5 */
777
#define SHT1_6                 (6*0x1000u)    /* ADC12 Sample Hold 1 Select Bit: 6 */
778
#define SHT1_7                 (7*0x1000u)    /* ADC12 Sample Hold 1 Select Bit: 7 */
779
#define SHT1_8                 (8*0x1000u)    /* ADC12 Sample Hold 1 Select Bit: 8 */
780
#define SHT1_9                 (9*0x1000u)    /* ADC12 Sample Hold 1 Select Bit: 9 */
781
#define SHT1_10                (10*0x1000u)   /* ADC12 Sample Hold 1 Select Bit: 10 */
782
#define SHT1_11                (11*0x1000u)   /* ADC12 Sample Hold 1 Select Bit: 11 */
783
#define SHT1_12                (12*0x1000u)   /* ADC12 Sample Hold 1 Select Bit: 12 */
784
#define SHT1_13                (13*0x1000u)   /* ADC12 Sample Hold 1 Select Bit: 13 */
785
#define SHT1_14                (14*0x1000u)   /* ADC12 Sample Hold 1 Select Bit: 14 */
786
#define SHT1_15                (15*0x1000u)   /* ADC12 Sample Hold 1 Select Bit: 15 */
787
 
788
/* ADC12CTL1 */
789
#define ADC12BUSY              (0x0001)       /* ADC12 Busy */
790
#define CONSEQ0                (0x0002)       /* ADC12 Conversion Sequence Select 0 */
791
#define CONSEQ1                (0x0004)       /* ADC12 Conversion Sequence Select 1 */
792
#define ADC12SSEL0             (0x0008)       /* ADC12 Clock Source Select 0 */
793
#define ADC12SSEL1             (0x0010)       /* ADC12 Clock Source Select 1 */
794
#define ADC12DIV0              (0x0020)       /* ADC12 Clock Divider Select 0 */
795
#define ADC12DIV1              (0x0040)       /* ADC12 Clock Divider Select 1 */
796
#define ADC12DIV2              (0x0080)       /* ADC12 Clock Divider Select 2 */
797
#define ISSH                   (0x0100)       /* ADC12 Invert Sample Hold Signal */
798
#define SHP                    (0x0200)       /* ADC12 Sample/Hold Pulse Mode */
799
#define SHS0                   (0x0400)       /* ADC12 Sample/Hold Source 0 */
800
#define SHS1                   (0x0800)       /* ADC12 Sample/Hold Source 1 */
801
#define CSTARTADD0             (0x1000)       /* ADC12 Conversion Start Address 0 */
802
#define CSTARTADD1             (0x2000)       /* ADC12 Conversion Start Address 1 */
803
#define CSTARTADD2             (0x4000)       /* ADC12 Conversion Start Address 2 */
804
#define CSTARTADD3             (0x8000)       /* ADC12 Conversion Start Address 3 */
805
 
806
#define CONSEQ_0               (0*2u)         /* ADC12 Conversion Sequence Select: 0 */
807
#define CONSEQ_1               (1*2u)         /* ADC12 Conversion Sequence Select: 1 */
808
#define CONSEQ_2               (2*2u)         /* ADC12 Conversion Sequence Select: 2 */
809
#define CONSEQ_3               (3*2u)         /* ADC12 Conversion Sequence Select: 3 */
810
#define ADC12SSEL_0            (0*8u)         /* ADC12 Clock Source Select: 0 */
811
#define ADC12SSEL_1            (1*8u)         /* ADC12 Clock Source Select: 1 */
812
#define ADC12SSEL_2            (2*8u)         /* ADC12 Clock Source Select: 2 */
813
#define ADC12SSEL_3            (3*8u)         /* ADC12 Clock Source Select: 3 */
814
#define ADC12DIV_0             (0*0x20u)      /* ADC12 Clock Divider Select: 0 */
815
#define ADC12DIV_1             (1*0x20u)      /* ADC12 Clock Divider Select: 1 */
816
#define ADC12DIV_2             (2*0x20u)      /* ADC12 Clock Divider Select: 2 */
817
#define ADC12DIV_3             (3*0x20u)      /* ADC12 Clock Divider Select: 3 */
818
#define ADC12DIV_4             (4*0x20u)      /* ADC12 Clock Divider Select: 4 */
819
#define ADC12DIV_5             (5*0x20u)      /* ADC12 Clock Divider Select: 5 */
820
#define ADC12DIV_6             (6*0x20u)      /* ADC12 Clock Divider Select: 6 */
821
#define ADC12DIV_7             (7*0x20u)      /* ADC12 Clock Divider Select: 7 */
822
#define SHS_0                  (0*0x400u)     /* ADC12 Sample/Hold Source: 0 */
823
#define SHS_1                  (1*0x400u)     /* ADC12 Sample/Hold Source: 1 */
824
#define SHS_2                  (2*0x400u)     /* ADC12 Sample/Hold Source: 2 */
825
#define SHS_3                  (3*0x400u)     /* ADC12 Sample/Hold Source: 3 */
826
#define CSTARTADD_0            (0*0x1000u)    /* ADC12 Conversion Start Address: 0 */
827
#define CSTARTADD_1            (1*0x1000u)    /* ADC12 Conversion Start Address: 1 */
828
#define CSTARTADD_2            (2*0x1000u)    /* ADC12 Conversion Start Address: 2 */
829
#define CSTARTADD_3            (3*0x1000u)    /* ADC12 Conversion Start Address: 3 */
830
#define CSTARTADD_4            (4*0x1000u)    /* ADC12 Conversion Start Address: 4 */
831
#define CSTARTADD_5            (5*0x1000u)    /* ADC12 Conversion Start Address: 5 */
832
#define CSTARTADD_6            (6*0x1000u)    /* ADC12 Conversion Start Address: 6 */
833
#define CSTARTADD_7            (7*0x1000u)    /* ADC12 Conversion Start Address: 7 */
834
#define CSTARTADD_8            (8*0x1000u)    /* ADC12 Conversion Start Address: 8 */
835
#define CSTARTADD_9            (9*0x1000u)    /* ADC12 Conversion Start Address: 9 */
836
#define CSTARTADD_10           (10*0x1000u)   /* ADC12 Conversion Start Address: 10 */
837
#define CSTARTADD_11           (11*0x1000u)   /* ADC12 Conversion Start Address: 11 */
838
#define CSTARTADD_12           (12*0x1000u)   /* ADC12 Conversion Start Address: 12 */
839
#define CSTARTADD_13           (13*0x1000u)   /* ADC12 Conversion Start Address: 13 */
840
#define CSTARTADD_14           (14*0x1000u)   /* ADC12 Conversion Start Address: 14 */
841
#define CSTARTADD_15           (15*0x1000u)   /* ADC12 Conversion Start Address: 15 */
842
 
843
/* ADC12MCTLx */
844
#define INCH0                  (0x0001)       /* ADC12 Input Channel Select Bit 0 */
845
#define INCH1                  (0x0002)       /* ADC12 Input Channel Select Bit 1 */
846
#define INCH2                  (0x0004)       /* ADC12 Input Channel Select Bit 2 */
847
#define INCH3                  (0x0008)       /* ADC12 Input Channel Select Bit 3 */
848
#define SREF0                  (0x0010)       /* ADC12 Select Reference Bit 0 */
849
#define SREF1                  (0x0020)       /* ADC12 Select Reference Bit 1 */
850
#define SREF2                  (0x0040)       /* ADC12 Select Reference Bit 2 */
851
#define EOS                    (0x0080)       /* ADC12 End of Sequence */
852
 
853
#define INCH_0                 (0)            /* ADC12 Input Channel 0 */
854
#define INCH_1                 (1)            /* ADC12 Input Channel 1 */
855
#define INCH_2                 (2)            /* ADC12 Input Channel 2 */
856
#define INCH_3                 (3)            /* ADC12 Input Channel 3 */
857
#define INCH_4                 (4)            /* ADC12 Input Channel 4 */
858
#define INCH_5                 (5)            /* ADC12 Input Channel 5 */
859
#define INCH_6                 (6)            /* ADC12 Input Channel 6 */
860
#define INCH_7                 (7)            /* ADC12 Input Channel 7 */
861
#define INCH_8                 (8)            /* ADC12 Input Channel 8 */
862
#define INCH_9                 (9)            /* ADC12 Input Channel 9 */
863
#define INCH_10                (10)           /* ADC12 Input Channel 10 */
864
#define INCH_11                (11)           /* ADC12 Input Channel 11 */
865
#define INCH_12                (12)           /* ADC12 Input Channel 12 */
866
#define INCH_13                (13)           /* ADC12 Input Channel 13 */
867
#define INCH_14                (14)           /* ADC12 Input Channel 14 */
868
#define INCH_15                (15)           /* ADC12 Input Channel 15 */
869
 
870
#define SREF_0                 (0*0x10u)      /* ADC12 Select Reference 0 */
871
#define SREF_1                 (1*0x10u)      /* ADC12 Select Reference 1 */
872
#define SREF_2                 (2*0x10u)      /* ADC12 Select Reference 2 */
873
#define SREF_3                 (3*0x10u)      /* ADC12 Select Reference 3 */
874
#define SREF_4                 (4*0x10u)      /* ADC12 Select Reference 4 */
875
#define SREF_5                 (5*0x10u)      /* ADC12 Select Reference 5 */
876
#define SREF_6                 (6*0x10u)      /* ADC12 Select Reference 6 */
877
#define SREF_7                 (7*0x10u)      /* ADC12 Select Reference 7 */
878
 
879
/* ADC12IV Definitions */
880
#define ADC12IV_NONE           (0x0000)       /* No Interrupt pending */
881
#define ADC12IV_ADC12OVIFG     (0x0002)       /* ADC12OVIFG */
882
#define ADC12IV_ADC12TOVIFG    (0x0004)       /* ADC12TOVIFG */
883
#define ADC12IV_ADC12IFG0      (0x0006)       /* ADC12IFG0 */
884
#define ADC12IV_ADC12IFG1      (0x0008)       /* ADC12IFG1 */
885
#define ADC12IV_ADC12IFG2      (0x000A)       /* ADC12IFG2 */
886
#define ADC12IV_ADC12IFG3      (0x000C)       /* ADC12IFG3 */
887
#define ADC12IV_ADC12IFG4      (0x000E)       /* ADC12IFG4 */
888
#define ADC12IV_ADC12IFG5      (0x0010)       /* ADC12IFG5 */
889
#define ADC12IV_ADC12IFG6      (0x0012)       /* ADC12IFG6 */
890
#define ADC12IV_ADC12IFG7      (0x0014)       /* ADC12IFG7 */
891
#define ADC12IV_ADC12IFG8      (0x0016)       /* ADC12IFG8 */
892
#define ADC12IV_ADC12IFG9      (0x0018)       /* ADC12IFG9 */
893
#define ADC12IV_ADC12IFG10     (0x001A)       /* ADC12IFG10 */
894
#define ADC12IV_ADC12IFG11     (0x001C)       /* ADC12IFG11 */
895
#define ADC12IV_ADC12IFG12     (0x001E)       /* ADC12IFG12 */
896
#define ADC12IV_ADC12IFG13     (0x0020)       /* ADC12IFG13 */
897
#define ADC12IV_ADC12IFG14     (0x0022)       /* ADC12IFG14 */
898
#define ADC12IV_ADC12IFG15     (0x0024)       /* ADC12IFG15 */
899
 
900
/************************************************************
901
* Interrupt Vectors (offset from 0xFFE0)
902
************************************************************/
903
 
904
#define VECTOR_NAME(name)       name##_ptr
905
#define EMIT_PRAGMA(x)          _Pragma(#x)
906
#define CREATE_VECTOR(name)     void (* const VECTOR_NAME(name))(void) = &name
907
#define PLACE_VECTOR(vector,section) EMIT_PRAGMA(DATA_SECTION(vector,section))
908
#define ISR_VECTOR(func,offset) CREATE_VECTOR(func); \
909
                                PLACE_VECTOR(VECTOR_NAME(func), offset)
910
 
911
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
912
#define PORT2_VECTOR            ".int01"                    /* 0xFFE2 Port 2 */
913
#else
914
#define PORT2_VECTOR            (1 * 1u)                     /* 0xFFE2 Port 2 */
915
/*#define PORT2_ISR(func)         ISR_VECTOR(func, ".int01")  */ /* 0xFFE2 Port 2 */ /* CCE V2 Style */
916
#endif
917
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
918
#define PORT1_VECTOR            ".int04"                    /* 0xFFE8 Port 1 */
919
#else
920
#define PORT1_VECTOR            (4 * 1u)                     /* 0xFFE8 Port 1 */
921
/*#define PORT1_ISR(func)         ISR_VECTOR(func, ".int04")  */ /* 0xFFE8 Port 1 */ /* CCE V2 Style */
922
#endif
923
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
924
#define TIMERA1_VECTOR          ".int05"                    /* 0xFFEA Timer A CC1-2, TA */
925
#else
926
#define TIMERA1_VECTOR          (5 * 1u)                     /* 0xFFEA Timer A CC1-2, TA */
927
/*#define TIMERA1_ISR(func)       ISR_VECTOR(func, ".int05")  */ /* 0xFFEA Timer A CC1-2, TA */ /* CCE V2 Style */
928
#endif
929
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
930
#define TIMERA0_VECTOR          ".int06"                    /* 0xFFEC Timer A CC0 */
931
#else
932
#define TIMERA0_VECTOR          (6 * 1u)                     /* 0xFFEC Timer A CC0 */
933
/*#define TIMERA0_ISR(func)       ISR_VECTOR(func, ".int06")  */ /* 0xFFEC Timer A CC0 */ /* CCE V2 Style */
934
#endif
935
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
936
#define ADC12_VECTOR            ".int07"                    /* 0xFFEE ADC */
937
#else
938
#define ADC12_VECTOR            (7 * 1u)                     /* 0xFFEE ADC */
939
/*#define ADC12_ISR(func)         ISR_VECTOR(func, ".int07")  */ /* 0xFFEE ADC */ /* CCE V2 Style */
940
#endif
941
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
942
#define USART0TX_VECTOR         ".int08"                    /* 0xFFF0 USART 0 Transmit */
943
#else
944
#define USART0TX_VECTOR         (8 * 1u)                     /* 0xFFF0 USART 0 Transmit */
945
/*#define USART0TX_ISR(func)      ISR_VECTOR(func, ".int08")  */ /* 0xFFF0 USART 0 Transmit */ /* CCE V2 Style */
946
#endif
947
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
948
#define USART0RX_VECTOR         ".int09"                    /* 0xFFF2 USART 0 Receive */
949
#else
950
#define USART0RX_VECTOR         (9 * 1u)                     /* 0xFFF2 USART 0 Receive */
951
/*#define USART0RX_ISR(func)      ISR_VECTOR(func, ".int09")  */ /* 0xFFF2 USART 0 Receive */ /* CCE V2 Style */
952
#endif
953
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
954
#define WDT_VECTOR              ".int10"                    /* 0xFFF4 Watchdog Timer */
955
#else
956
#define WDT_VECTOR              (10 * 1u)                    /* 0xFFF4 Watchdog Timer */
957
/*#define WDT_ISR(func)           ISR_VECTOR(func, ".int10")  */ /* 0xFFF4 Watchdog Timer */ /* CCE V2 Style */
958
#endif
959
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
960
#define COMPARATORA_VECTOR      ".int11"                    /* 0xFFF6 Comparator A */
961
#else
962
#define COMPARATORA_VECTOR      (11 * 1u)                    /* 0xFFF6 Comparator A */
963
/*#define COMPARATORA_ISR(func)   ISR_VECTOR(func, ".int11")  */ /* 0xFFF6 Comparator A */ /* CCE V2 Style */
964
#endif
965
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
966
#define TIMERB1_VECTOR          ".int12"                    /* 0xFFF8 Timer B CC1-2, TB */
967
#else
968
#define TIMERB1_VECTOR          (12 * 1u)                    /* 0xFFF8 Timer B CC1-2, TB */
969
/*#define TIMERB1_ISR(func)       ISR_VECTOR(func, ".int12")  */ /* 0xFFF8 Timer B CC1-2, TB */ /* CCE V2 Style */
970
#endif
971
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
972
#define TIMERB0_VECTOR          ".int13"                    /* 0xFFFA Timer B CC0 */
973
#else
974
#define TIMERB0_VECTOR          (13 * 1u)                    /* 0xFFFA Timer B CC0 */
975
/*#define TIMERB0_ISR(func)       ISR_VECTOR(func, ".int13")  */ /* 0xFFFA Timer B CC0 */ /* CCE V2 Style */
976
#endif
977
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
978
#define NMI_VECTOR              ".int14"                    /* 0xFFFC Non-maskable */
979
#else
980
#define NMI_VECTOR              (14 * 1u)                    /* 0xFFFC Non-maskable */
981
/*#define NMI_ISR(func)           ISR_VECTOR(func, ".int14")  */ /* 0xFFFC Non-maskable */ /* CCE V2 Style */
982
#endif
983
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
984
#define RESET_VECTOR            ".reset"                    /* 0xFFFE Reset [Highest Priority] */
985
#else
986
#define RESET_VECTOR            (15 * 1u)                    /* 0xFFFE Reset [Highest Priority] */
987
/*#define RESET_ISR(func)         ISR_VECTOR(func, ".int15")  */ /* 0xFFFE Reset [Highest Priority] */ /* CCE V2 Style */
988
#endif
989
 
990
 
991
/************************************************************
992
* End of Modules
993
************************************************************/
994
 
995
#ifdef __cplusplus
996
}
997
#endif /* extern "C" */
998
 
999
#endif /* #ifndef __msp430x13x */
1000