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
* MSP430F438 device.
8
*
9
* Texas Instruments, Version 2.5
10
*
11
* Rev. 2.0,  Fixed some address of the OPAMP registers
12
* Rev. 2.1,  Alignment of defintions in Users Guide and of version numbers
13
* Rev. 2.2,  Fixed some defintions of the OPAMP registers
14
* Rev. 2.21, Added DAC12OPS
15
* Rev. 2.22, Removed definition of LCDLOWR (not available at 4xx devices)
16
* Rev. 2.3, Fixed type in ADC12 bit definitions (replaced ADC10 with ADC12)
17
*           Added DMA request definitions
18
* Rev. 2.3, Changed definition in OPAMP section to accord Users Guide
19
* Rev. 2.1, Removed definitions for DMA channel 1 + 2
20
* Rev. 2.2, Removed unused def of TASSEL2 / TBSSEL2
21
* Rev. 2.3, Added VLD bits in SVS module
22
* Rev. 2.4, Removed definitions for BTRESET
23
* Rev. 2.5, added definitions for Interrupt Vectors xxIV
24
*
25
********************************************************************/
26
 
27
#ifndef __MSP430F438
28
#define __MSP430F438
29
 
30
#ifdef __cplusplus
31
extern "C" {
32
#endif
33
 
34
 
35
/*----------------------------------------------------------------------------*/
36
/* PERIPHERAL FILE MAP                                                        */
37
/*----------------------------------------------------------------------------*/
38
 
39
/* External references resolved by a device-specific linker command file */
40
#define SFR_8BIT(address)   extern volatile unsigned char address
41
#define SFR_16BIT(address)  extern volatile unsigned int address
42
 
43
 
44
/************************************************************
45
* STANDARD BITS
46
************************************************************/
47
 
48
#define BIT0                   (0x0001)
49
#define BIT1                   (0x0002)
50
#define BIT2                   (0x0004)
51
#define BIT3                   (0x0008)
52
#define BIT4                   (0x0010)
53
#define BIT5                   (0x0020)
54
#define BIT6                   (0x0040)
55
#define BIT7                   (0x0080)
56
#define BIT8                   (0x0100)
57
#define BIT9                   (0x0200)
58
#define BITA                   (0x0400)
59
#define BITB                   (0x0800)
60
#define BITC                   (0x1000)
61
#define BITD                   (0x2000)
62
#define BITE                   (0x4000)
63
#define BITF                   (0x8000)
64
 
65
/************************************************************
66
* STATUS REGISTER BITS
67
************************************************************/
68
 
69
#define C                      (0x0001)
70
#define Z                      (0x0002)
71
#define N                      (0x0004)
72
#define V                      (0x0100)
73
#define GIE                    (0x0008)
74
#define CPUOFF                 (0x0010)
75
#define OSCOFF                 (0x0020)
76
#define SCG0                   (0x0040)
77
#define SCG1                   (0x0080)
78
 
79
/* Low Power Modes coded with Bits 4-7 in SR */
80
 
81
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
82
#define LPM0                   (CPUOFF)
83
#define LPM1                   (SCG0+CPUOFF)
84
#define LPM2                   (SCG1+CPUOFF)
85
#define LPM3                   (SCG1+SCG0+CPUOFF)
86
#define LPM4                   (SCG1+SCG0+OSCOFF+CPUOFF)
87
/* End #defines for assembler */
88
 
89
#else /* Begin #defines for C */
90
#define LPM0_bits              (CPUOFF)
91
#define LPM1_bits              (SCG0+CPUOFF)
92
#define LPM2_bits              (SCG1+CPUOFF)
93
#define LPM3_bits              (SCG1+SCG0+CPUOFF)
94
#define LPM4_bits              (SCG1+SCG0+OSCOFF+CPUOFF)
95
 
96
#include "in430.h"
97
 
98
#define LPM0         _bis_SR_register(LPM0_bits)         /* Enter Low Power Mode 0 */
99
#define LPM0_EXIT    _bic_SR_register_on_exit(LPM0_bits) /* Exit Low Power Mode 0 */
100
#define LPM1         _bis_SR_register(LPM1_bits)         /* Enter Low Power Mode 1 */
101
#define LPM1_EXIT    _bic_SR_register_on_exit(LPM1_bits) /* Exit Low Power Mode 1 */
102
#define LPM2         _bis_SR_register(LPM2_bits)         /* Enter Low Power Mode 2 */
103
#define LPM2_EXIT    _bic_SR_register_on_exit(LPM2_bits) /* Exit Low Power Mode 2 */
104
#define LPM3         _bis_SR_register(LPM3_bits)         /* Enter Low Power Mode 3 */
105
#define LPM3_EXIT    _bic_SR_register_on_exit(LPM3_bits) /* Exit Low Power Mode 3 */
106
#define LPM4         _bis_SR_register(LPM4_bits)         /* Enter Low Power Mode 4 */
107
#define LPM4_EXIT    _bic_SR_register_on_exit(LPM4_bits) /* Exit Low Power Mode 4 */
108
#endif /* End #defines for C */
109
 
110
/************************************************************
111
* PERIPHERAL FILE MAP
112
************************************************************/
113
 
114
/************************************************************
115
* SPECIAL FUNCTION REGISTER ADDRESSES + CONTROL BITS
116
************************************************************/
117
 
118
SFR_8BIT(IE1);                                /* Interrupt Enable 1 */
119
#define U0IE                   IE1            /* UART0 Interrupt Enable Register */
120
#define WDTIE                  (0x01)
121
#define OFIE                   (0x02)
122
#define NMIIE                  (0x10)
123
#define ACCVIE                 (0x20)
124
#define URXIE0                 (0x40)
125
#define UTXIE0                 (0x80)
126
 
127
SFR_8BIT(IFG1);                               /* Interrupt Flag 1 */
128
#define U0IFG                  IFG1           /* UART0 Interrupt Flag Register */
129
#define WDTIFG                 (0x01)
130
#define OFIFG                  (0x02)
131
#define NMIIFG                 (0x10)
132
#define URXIFG0                (0x40)
133
#define UTXIFG0                (0x80)
134
 
135
SFR_8BIT(ME1);                                /* Module Enable 1 */
136
#define U0ME                   ME1            /* UART0 Module Enable Register */
137
#define URXE0                  (0x40)
138
#define UTXE0                  (0x80)
139
#define USPIE0                 (0x40)
140
 
141
SFR_8BIT(IE2);                                /* Interrupt Enable 2 */
142
#define BTIE                   (0x80)
143
 
144
SFR_8BIT(IFG2);                               /* Interrupt Flag 2 */
145
#define BTIFG                  (0x80)
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
* BASIC TIMER
249
************************************************************/
250
#define __MSP430_HAS_BT__                     /* Definition to show that Module is available */
251
 
252
SFR_8BIT(BTCTL);                              /* Basic Timer Control */
253
/* The bit names have been prefixed with "BT" */
254
#define BTIP0                  (0x01)
255
#define BTIP1                  (0x02)
256
#define BTIP2                  (0x04)
257
#define BTFRFQ0                (0x08)
258
#define BTFRFQ1                (0x10)
259
#define BTDIV                  (0x20)         /* fCLK2 = ACLK:256 */
260
#define BTHOLD                 (0x40)         /* BT1 is held if this bit is set */
261
#define BTSSEL                 (0x80)         /* fBT = fMCLK (main clock) */
262
 
263
SFR_8BIT(BTCNT1);                             /* Basic Timer Count 1 */
264
SFR_8BIT(BTCNT2);                             /* Basic Timer Count 2 */
265
 
266
/* Frequency of the BTCNT2 coded with Bit 5 and 7 in BTCTL */
267
#define BT_fCLK2_ACLK          (0x00)
268
#define BT_fCLK2_ACLK_DIV256   (BTDIV)
269
#define BT_fCLK2_MCLK          (BTSSEL)
270
 
271
/* Interrupt interval time fINT coded with Bits 0-2 in BTCTL */
272
#define BT_fCLK2_DIV2          (0x00)         /* fINT = fCLK2:2 (default) */
273
#define BT_fCLK2_DIV4          (BTIP0)        /* fINT = fCLK2:4 */
274
#define BT_fCLK2_DIV8          (BTIP1)        /* fINT = fCLK2:8 */
275
#define BT_fCLK2_DIV16         (BTIP1+BTIP0)  /* fINT = fCLK2:16 */
276
#define BT_fCLK2_DIV32         (BTIP2)        /* fINT = fCLK2:32 */
277
#define BT_fCLK2_DIV64         (BTIP2+BTIP0)  /* fINT = fCLK2:64 */
278
#define BT_fCLK2_DIV128        (BTIP2+BTIP1)  /* fINT = fCLK2:128 */
279
#define BT_fCLK2_DIV256     (BTIP2+BTIP1+BTIP0)       /* fINT = fCLK2:256 */
280
/* Frequency of LCD coded with Bits 3-4 */
281
#define BT_fLCD_DIV32          (0x00)         /* fLCD = fACLK:32 (default) */
282
#define BT_fLCD_DIV64          (BTFRFQ0)      /* fLCD = fACLK:64 */
283
#define BT_fLCD_DIV128         (BTFRFQ1)      /* fLCD = fACLK:128 */
284
#define BT_fLCD_DIV256      (BTFRFQ1+BTFRFQ0)         /* fLCD = fACLK:256 */
285
/* LCD frequency values with fBT=fACLK */
286
#define BT_fLCD_1K             (0x00)         /* fACLK:32 (default) */
287
#define BT_fLCD_512            (BTFRFQ0)      /* fACLK:64 */
288
#define BT_fLCD_256            (BTFRFQ1)      /* fACLK:128 */
289
#define BT_fLCD_128         (BTFRFQ1+BTFRFQ0)         /* fACLK:256 */
290
/* LCD frequency values with fBT=fMCLK */
291
#define BT_fLCD_31K            (BTSSEL)       /* fMCLK:32 */
292
#define BT_fLCD_15_5K       (BTSSEL+BTFRFQ0)          /* fMCLK:64 */
293
#define BT_fLCD_7_8K        (BTSSEL+BTFRFQ1+BTFRFQ0)  /* fMCLK:256 */
294
/* with assumed vlues of fACLK=32KHz, fMCLK=1MHz */
295
/* fBT=fACLK is thought for longer interval times */
296
#define BT_ADLY_0_064          (0x00)         /* 0.064ms interval (default) */
297
#define BT_ADLY_0_125          (BTIP0)        /* 0.125ms    " */
298
#define BT_ADLY_0_25           (BTIP1)        /* 0.25ms     " */
299
#define BT_ADLY_0_5            (BTIP1+BTIP0)  /* 0.5ms      " */
300
#define BT_ADLY_1              (BTIP2)        /* 1ms        " */
301
#define BT_ADLY_2              (BTIP2+BTIP0)  /* 2ms        " */
302
#define BT_ADLY_4              (BTIP2+BTIP1)  /* 4ms        " */
303
#define BT_ADLY_8           (BTIP2+BTIP1+BTIP0)       /* 8ms        " */
304
#define BT_ADLY_16             (BTDIV)        /* 16ms       " */
305
#define BT_ADLY_32             (BTDIV+BTIP0)  /* 32ms       " */
306
#define BT_ADLY_64             (BTDIV+BTIP1)  /* 64ms       " */
307
#define BT_ADLY_125         (BTDIV+BTIP1+BTIP0)       /* 125ms      " */
308
#define BT_ADLY_250            (BTDIV+BTIP2)  /* 250ms      " */
309
#define BT_ADLY_500         (BTDIV+BTIP2+BTIP0)       /* 500ms      " */
310
#define BT_ADLY_1000        (BTDIV+BTIP2+BTIP1)       /* 1000ms     " */
311
#define BT_ADLY_2000        (BTDIV+BTIP2+BTIP1+BTIP0) /* 2000ms     " */
312
/* fCLK2=fMCLK (1MHz) is thought for short interval times */
313
/* the timing for short intervals is more precise than ACLK */
314
/* NOTE */
315
/* Be sure that the SCFQCTL-Register is set to 01Fh so that fMCLK=1MHz */
316
/* Too low interval time results in interrupts too frequent for the processor to handle! */
317
#define BT_MDLY_0_002          (BTSSEL)       /* 0.002ms interval       *** interval times */
318
#define BT_MDLY_0_004          (BTSSEL+BTIP0) /* 0.004ms    "           *** too short for */
319
#define BT_MDLY_0_008          (BTSSEL+BTIP1) /* 0.008ms    "           *** interrupt */
320
#define BT_MDLY_0_016       (BTSSEL+BTIP1+BTIP0)      /* 0.016ms    "           *** handling */
321
#define BT_MDLY_0_032          (BTSSEL+BTIP2) /* 0.032ms    " */
322
#define BT_MDLY_0_064       (BTSSEL+BTIP2+BTIP0)      /* 0.064ms    " */
323
#define BT_MDLY_0_125       (BTSSEL+BTIP2+BTIP1)      /* 0.125ms    " */
324
#define BT_MDLY_0_25        (BTSSEL+BTIP2+BTIP1+BTIP0)/* 0.25ms     " */
325
 
326
/* Reset/Hold coded with Bits 6-7 in BT(1)CTL */
327
/* this is for BT */
328
//#define BTRESET_CNT1        (BTRESET)           /* BTCNT1 is reset while BTRESET is set */
329
//#define BTRESET_CNT1_2      (BTRESET+BTDIV)     /* BTCNT1 .AND. BTCNT2 are reset while ~ is set */
330
/* this is for BT1 */
331
#define BTHOLD_CNT1            (BTHOLD)       /* BTCNT1 is held while BTHOLD is set */
332
#define BTHOLD_CNT1_2          (BTHOLD+BTDIV) /* BT1CNT1 .AND. BT1CNT2 are held while ~ is set */
333
 
334
/* INTERRUPT CONTROL BITS */
335
/* #define BTIE                0x80 */
336
/* #define BTIFG               0x80 */
337
 
338
/************************************************************
339
* SYSTEM CLOCK, FLL+
340
************************************************************/
341
#define __MSP430_HAS_FLLPLUS__                /* Definition to show that Module is available */
342
 
343
SFR_8BIT(SCFI0);                              /* System Clock Frequency Integrator 0 */
344
#define FN_2                   (0x04)         /* fDCOCLK =   1.4-12MHz*/
345
#define FN_3                   (0x08)         /* fDCOCLK =   2.2-17Mhz*/
346
#define FN_4                   (0x10)         /* fDCOCLK =   3.2-25Mhz*/
347
#define FN_8                   (0x20)         /* fDCOCLK =     5-40Mhz*/
348
#define FLLD0                  (0x40)         /* Loop Divider Bit : 0 */
349
#define FLLD1                  (0x80)         /* Loop Divider Bit : 1 */
350
 
351
#define FLLD_1                 (0x00)         /* Multiply Selected Loop Freq. By 1 */
352
#define FLLD_2                 (0x40)         /* Multiply Selected Loop Freq. By 2 */
353
#define FLLD_4                 (0x80)         /* Multiply Selected Loop Freq. By 4 */
354
#define FLLD_8                 (0xC0)         /* Multiply Selected Loop Freq. By 8 */
355
 
356
SFR_8BIT(SCFI1);                              /* System Clock Frequency Integrator 1 */
357
SFR_8BIT(SCFQCTL);                            /* System Clock Frequency Control */
358
/* System clock frequency values fMCLK coded with Bits 0-6 in SCFQCTL */
359
/* #define SCFQ_32K            0x00                        fMCLK=1*fACLK       only a range from */
360
#define SCFQ_64K               (0x01)         /* fMCLK=2*fACLK          1+1 to 127+1 is possible */
361
#define SCFQ_128K              (0x03)         /* fMCLK=4*fACLK */
362
#define SCFQ_256K              (0x07)         /* fMCLK=8*fACLK */
363
#define SCFQ_512K              (0x0F)         /* fMCLK=16*fACLK */
364
#define SCFQ_1M                (0x1F)         /* fMCLK=32*fACLK */
365
#define SCFQ_2M                (0x3F)         /* fMCLK=64*fACLK */
366
#define SCFQ_4M                (0x7F)         /* fMCLK=128*fACLK */
367
#define SCFQ_M                 (0x80)         /* Modulation Disable */
368
 
369
SFR_8BIT(FLL_CTL0);                           /* FLL+ Control 0 */
370
#define DCOF                   (0x01)         /* DCO Fault Flag */
371
#define LFOF                   (0x02)         /* Low Frequency Oscillator Fault Flag */
372
#define XT1OF                  (0x04)         /* High Frequency Oscillator 1 Fault Flag */
373
#define XT2OF                  (0x08)         /* High Frequency Oscillator 2 Fault Flag */
374
#define OSCCAP0                (0x10)         /* XIN/XOUT Cap 0 */
375
#define OSCCAP1                (0x20)         /* XIN/XOUT Cap 1 */
376
#define XTS_FLL                (0x40)         /* 1: Selects high-freq. oscillator */
377
#define DCOPLUS                (0x80)         /* DCO+ Enable */
378
 
379
#define XCAP0PF                (0x00)         /* XIN Cap = XOUT Cap = 0pf */
380
#define XCAP10PF               (0x10)         /* XIN Cap = XOUT Cap = 10pf */
381
#define XCAP14PF               (0x20)         /* XIN Cap = XOUT Cap = 14pf */
382
#define XCAP18PF               (0x30)         /* XIN Cap = XOUT Cap = 18pf */
383
#define OSCCAP_0               (0x00)         /* XIN Cap = XOUT Cap = 0pf */
384
#define OSCCAP_1               (0x10)         /* XIN Cap = XOUT Cap = 10pf */
385
#define OSCCAP_2               (0x20)         /* XIN Cap = XOUT Cap = 14pf */
386
#define OSCCAP_3               (0x30)         /* XIN Cap = XOUT Cap = 18pf */
387
 
388
SFR_8BIT(FLL_CTL1);                           /* FLL+ Control 1 */
389
#define FLL_DIV0               (0x01)         /* FLL+ Divide Px.x/ACLK 0 */
390
#define FLL_DIV1               (0x02)         /* FLL+ Divide Px.x/ACLK 1 */
391
#define SELS                   (0x04)         /* Peripheral Module Clock Source (0: DCO, 1: XT2) */
392
#define SELM0                  (0x08)         /* MCLK Source Select 0 */
393
#define SELM1                  (0x10)         /* MCLK Source Select 1 */
394
#define XT2OFF                 (0x20)         /* High Frequency Oscillator 2 (XT2) disable */
395
#define SMCLKOFF               (0x40)         /* Peripheral Module Clock (SMCLK) disable */
396
 
397
#define FLL_DIV_1              (0x00)         /* FLL+ Divide Px.x/ACLK By 1 */
398
#define FLL_DIV_2              (0x01)         /* FLL+ Divide Px.x/ACLK By 2 */
399
#define FLL_DIV_4              (0x02)         /* FLL+ Divide Px.x/ACLK By 4 */
400
#define FLL_DIV_8              (0x03)         /* FLL+ Divide Px.x/ACLK By 8 */
401
 
402
#define SELM_DCO               (0x00)         /* Select DCO for CPU MCLK */
403
#define SELM_XT2               (0x10)         /* Select XT2 for CPU MCLK */
404
#define SELM_A                 (0x18)         /* Select A (from LFXT1) for CPU MCLK */
405
 
406
/* INTERRUPT CONTROL BITS */
407
/* These two bits are defined in the Special Function Registers */
408
/* #define OFIFG               0x02 */
409
/* #define OFIE                0x02 */
410
 
411
/************************************************************
412
* Brown-Out, Supply Voltage Supervision (SVS)
413
************************************************************/
414
#define __MSP430_HAS_SVS__                    /* Definition to show that Module is available */
415
 
416
SFR_8BIT(SVSCTL);                             /* SVS Control */
417
#define SVSFG                  (0x01)         /* SVS Flag */
418
#define SVSOP                  (0x02)         /* SVS output (read only) */
419
#define SVSON                  (0x04)         /* Switches the SVS on/off */
420
#define PORON                  (0x08)         /* Enable POR Generation if Low Voltage */
421
#define VLD0                   (0x10)
422
#define VLD1                   (0x20)
423
#define VLD2                   (0x40)
424
#define VLD3                   (0x80)
425
 
426
#define VLDON                  (0x10)
427
#define VLDOFF                 (0x00)
428
#define VLD_1_8V               (0x10)
429
 
430
/************************************************************
431
* LCD
432
************************************************************/
433
#define __MSP430_HAS_LCD4__                   /* Definition to show that Module is available */
434
 
435
SFR_8BIT(LCDCTL);                             /* LCD Control */
436
/* the names of the mode bits are different from the spec */
437
#define LCDON                  (0x01)
438
//#define LCDLOWR             (0x02)
439
#define LCDSON                 (0x04)
440
#define LCDMX0                 (0x08)
441
#define LCDMX1                 (0x10)
442
#define LCDP0                  (0x20)
443
#define LCDP1                  (0x40)
444
#define LCDP2                  (0x80)
445
/* Display modes coded with Bits 2-4 */
446
#define LCDSTATIC              (LCDSON)
447
#define LCD2MUX                (LCDMX0+LCDSON)
448
#define LCD3MUX                (LCDMX1+LCDSON)
449
#define LCD4MUX                (LCDMX1+LCDMX0+LCDSON)
450
/* Group select code with Bits 5-7                     Seg.lines   Dig.output */
451
#define LCDSG0                 (0x00)         /* ---------   Port Only (default) */
452
#define LCDSG0_1               (LCDP0)        /* S0  - S15   see Datasheet */
453
#define LCDSG0_2               (LCDP1)        /* S0  - S19   see Datasheet */
454
#define LCDSG0_3               (LCDP1+LCDP0)  /* S0  - S23   see Datasheet */
455
#define LCDSG0_4               (LCDP2)        /* S0  - S27   see Datasheet */
456
#define LCDSG0_5               (LCDP2+LCDP0)  /* S0  - S31   see Datasheet */
457
#define LCDSG0_6               (LCDP2+LCDP1)  /* S0  - S35   see Datasheet */
458
#define LCDSG0_7            (LCDP2+LCDP1+LCDP0)       /* S0  - S39   see Datasheet */
459
/* NOTE: YOU CAN ONLY USE THE 'S' OR 'G' DECLARATIONS FOR A COMMAND */
460
/* MOV  #LCDSG0_3+LCDOG2_7,&LCDCTL ACTUALY MEANS MOV  #LCDP1,&LCDCTL! */
461
#define LCDOG1_7               (0x00)         /* ---------   Port Only (default) */
462
#define LCDOG2_7               (LCDP0)        /* S0  - S15   see Datasheet */
463
#define LCDOG3_7               (LCDP1)        /* S0  - S19   see Datasheet */
464
#define LCDOG4_7               (LCDP1+LCDP0)  /* S0  - S23   see Datasheet */
465
#define LCDOG5_7               (LCDP2)        /* S0  - S27   see Datasheet */
466
#define LCDOG6_7               (LCDP2+LCDP0)  /* S0  - S31   see Datasheet */
467
#define LCDOG7                 (LCDP2+LCDP1)  /* S0  - S35   see Datasheet */
468
#define LCDOGOFF            (LCDP2+LCDP1+LCDP0)       /* S0  - S39   see Datasheet */
469
 
470
#define LCDMEM_                (0x0091)       /* LCD Memory */
471
#ifdef __ASM_HEADER__
472
#define LCDMEM                 (LCDMEM_)      /* LCD Memory (for assembler) */
473
#else
474
#define LCDMEM                 ((char*)       LCDMEM_) /* LCD Memory (for C) */
475
#endif
476
SFR_8BIT(LCDM1);                              /* LCD Memory 1 */
477
SFR_8BIT(LCDM2);                              /* LCD Memory 2 */
478
SFR_8BIT(LCDM3);                              /* LCD Memory 3 */
479
SFR_8BIT(LCDM4);                              /* LCD Memory 4 */
480
SFR_8BIT(LCDM5);                              /* LCD Memory 5 */
481
SFR_8BIT(LCDM6);                              /* LCD Memory 6 */
482
SFR_8BIT(LCDM7);                              /* LCD Memory 7 */
483
SFR_8BIT(LCDM8);                              /* LCD Memory 8 */
484
SFR_8BIT(LCDM9);                              /* LCD Memory 9 */
485
SFR_8BIT(LCDM10);                             /* LCD Memory 10 */
486
SFR_8BIT(LCDM11);                             /* LCD Memory 11 */
487
SFR_8BIT(LCDM12);                             /* LCD Memory 12 */
488
SFR_8BIT(LCDM13);                             /* LCD Memory 13 */
489
SFR_8BIT(LCDM14);                             /* LCD Memory 14 */
490
SFR_8BIT(LCDM15);                             /* LCD Memory 15 */
491
SFR_8BIT(LCDM16);                             /* LCD Memory 16 */
492
SFR_8BIT(LCDM17);                             /* LCD Memory 17 */
493
SFR_8BIT(LCDM18);                             /* LCD Memory 18 */
494
SFR_8BIT(LCDM19);                             /* LCD Memory 19 */
495
SFR_8BIT(LCDM20);                             /* LCD Memory 20 */
496
 
497
#define LCDMA                  (LCDM10)       /* LCD Memory A */
498
#define LCDMB                  (LCDM11)       /* LCD Memory B */
499
#define LCDMC                  (LCDM12)       /* LCD Memory C */
500
#define LCDMD                  (LCDM13)       /* LCD Memory D */
501
#define LCDME                  (LCDM14)       /* LCD Memory E */
502
#define LCDMF                  (LCDM15)       /* LCD Memory F */
503
 
504
/************************************************************
505
* USART
506
************************************************************/
507
 
508
/* UxCTL */
509
#define PENA                   (0x80)         /* Parity enable */
510
#define PEV                    (0x40)         /* Parity 0:odd / 1:even */
511
#define SPB                    (0x20)         /* Stop Bits 0:one / 1: two */
512
#define CHAR                   (0x10)         /* Data 0:7-bits / 1:8-bits */
513
#define LISTEN                 (0x08)         /* Listen mode */
514
#define SYNC                   (0x04)         /* UART / SPI mode */
515
#define MM                     (0x02)         /* Master Mode off/on */
516
#define SWRST                  (0x01)         /* USART Software Reset */
517
 
518
/* UxTCTL */
519
#define CKPH                   (0x80)         /* SPI: Clock Phase */
520
#define CKPL                   (0x40)         /* Clock Polarity */
521
#define SSEL1                  (0x20)         /* Clock Source Select 1 */
522
#define SSEL0                  (0x10)         /* Clock Source Select 0 */
523
#define URXSE                  (0x08)         /* Receive Start edge select */
524
#define TXWAKE                 (0x04)         /* TX Wake up mode */
525
#define STC                    (0x02)         /* SPI: STC enable 0:on / 1:off */
526
#define TXEPT                  (0x01)         /* TX Buffer empty */
527
 
528
/* UxRCTL */
529
#define FE                     (0x80)         /* Frame Error */
530
#define PE                     (0x40)         /* Parity Error */
531
#define OE                     (0x20)         /* Overrun Error */
532
#define BRK                    (0x10)         /* Break detected */
533
#define URXEIE                 (0x08)         /* RX Error interrupt enable */
534
#define URXWIE                 (0x04)         /* RX Wake up interrupt enable */
535
#define RXWAKE                 (0x02)         /* RX Wake up detect */
536
#define RXERR                  (0x01)         /* RX Error Error */
537
 
538
/************************************************************
539
* USART 0
540
************************************************************/
541
#define __MSP430_HAS_UART0__                  /* Definition to show that Module is available */
542
 
543
SFR_8BIT(U0CTL);                              /* USART 0 Control */
544
SFR_8BIT(U0TCTL);                             /* USART 0 Transmit Control */
545
SFR_8BIT(U0RCTL);                             /* USART 0 Receive Control */
546
SFR_8BIT(U0MCTL);                             /* USART 0 Modulation Control */
547
SFR_8BIT(U0BR0);                              /* USART 0 Baud Rate 0 */
548
SFR_8BIT(U0BR1);                              /* USART 0 Baud Rate 1 */
549
SFR_8BIT(U0RXBUF);                            /* USART 0 Receive Buffer */
550
SFR_8BIT(U0TXBUF);                            /* USART 0 Transmit Buffer */
551
 
552
/* Alternate register names */
553
 
554
#define UCTL0                  U0CTL          /* USART 0 Control */
555
#define UTCTL0                 U0TCTL         /* USART 0 Transmit Control */
556
#define URCTL0                 U0RCTL         /* USART 0 Receive Control */
557
#define UMCTL0                 U0MCTL         /* USART 0 Modulation Control */
558
#define UBR00                  U0BR0          /* USART 0 Baud Rate 0 */
559
#define UBR10                  U0BR1          /* USART 0 Baud Rate 1 */
560
#define RXBUF0                 U0RXBUF        /* USART 0 Receive Buffer */
561
#define TXBUF0                 U0TXBUF        /* USART 0 Transmit Buffer */
562
#define UCTL0_                 U0CTL_         /* USART 0 Control */
563
#define UTCTL0_                U0TCTL_        /* USART 0 Transmit Control */
564
#define URCTL0_                U0RCTL_        /* USART 0 Receive Control */
565
#define UMCTL0_                U0MCTL_        /* USART 0 Modulation Control */
566
#define UBR00_                 U0BR0_         /* USART 0 Baud Rate 0 */
567
#define UBR10_                 U0BR1_         /* USART 0 Baud Rate 1 */
568
#define RXBUF0_                U0RXBUF_       /* USART 0 Receive Buffer */
569
#define TXBUF0_                U0TXBUF_       /* USART 0 Transmit Buffer */
570
#define UCTL_0                 U0CTL          /* USART 0 Control */
571
#define UTCTL_0                U0TCTL         /* USART 0 Transmit Control */
572
#define URCTL_0                U0RCTL         /* USART 0 Receive Control */
573
#define UMCTL_0                U0MCTL         /* USART 0 Modulation Control */
574
#define UBR0_0                 U0BR0          /* USART 0 Baud Rate 0 */
575
#define UBR1_0                 U0BR1          /* USART 0 Baud Rate 1 */
576
#define RXBUF_0                U0RXBUF        /* USART 0 Receive Buffer */
577
#define TXBUF_0                U0TXBUF        /* USART 0 Transmit Buffer */
578
#define UCTL_0_                U0CTL_         /* USART 0 Control */
579
#define UTCTL_0_               U0TCTL_        /* USART 0 Transmit Control */
580
#define URCTL_0_               U0RCTL_        /* USART 0 Receive Control */
581
#define UMCTL_0_               U0MCTL_        /* USART 0 Modulation Control */
582
#define UBR0_0_                U0BR0_         /* USART 0 Baud Rate 0 */
583
#define UBR1_0_                U0BR1_         /* USART 0 Baud Rate 1 */
584
#define RXBUF_0_               U0RXBUF_       /* USART 0 Receive Buffer */
585
#define TXBUF_0_               U0TXBUF_       /* USART 0 Transmit Buffer */
586
 
587
/************************************************************
588
* Timer A3
589
************************************************************/
590
#define __MSP430_HAS_TA3__                    /* Definition to show that Module is available */
591
 
592
SFR_16BIT(TAIV);                              /* Timer A Interrupt Vector Word */
593
SFR_16BIT(TACTL);                             /* Timer A Control */
594
SFR_16BIT(TACCTL0);                           /* Timer A Capture/Compare Control 0 */
595
SFR_16BIT(TACCTL1);                           /* Timer A Capture/Compare Control 1 */
596
SFR_16BIT(TACCTL2);                           /* Timer A Capture/Compare Control 2 */
597
SFR_16BIT(TAR);                               /* Timer A Counter Register */
598
SFR_16BIT(TACCR0);                            /* Timer A Capture/Compare 0 */
599
SFR_16BIT(TACCR1);                            /* Timer A Capture/Compare 1 */
600
SFR_16BIT(TACCR2);                            /* Timer A Capture/Compare 2 */
601
 
602
/* Alternate register names */
603
#define CCTL0                  TACCTL0        /* Timer A Capture/Compare Control 0 */
604
#define CCTL1                  TACCTL1        /* Timer A Capture/Compare Control 1 */
605
#define CCTL2                  TACCTL2        /* Timer A Capture/Compare Control 2 */
606
#define CCR0                   TACCR0         /* Timer A Capture/Compare 0 */
607
#define CCR1                   TACCR1         /* Timer A Capture/Compare 1 */
608
#define CCR2                   TACCR2         /* Timer A Capture/Compare 2 */
609
#define CCTL0_                 TACCTL0_       /* Timer A Capture/Compare Control 0 */
610
#define CCTL1_                 TACCTL1_       /* Timer A Capture/Compare Control 1 */
611
#define CCTL2_                 TACCTL2_       /* Timer A Capture/Compare Control 2 */
612
#define CCR0_                  TACCR0_        /* Timer A Capture/Compare 0 */
613
#define CCR1_                  TACCR1_        /* Timer A Capture/Compare 1 */
614
#define CCR2_                  TACCR2_        /* Timer A Capture/Compare 2 */
615
/* Alternate register names - 5xx style */
616
#define TA0IV                  TAIV           /* Timer A Interrupt Vector Word */
617
#define TA0CTL                 TACTL          /* Timer A Control */
618
#define TA0CCTL0               TACCTL0        /* Timer A Capture/Compare Control 0 */
619
#define TA0CCTL1               TACCTL1        /* Timer A Capture/Compare Control 1 */
620
#define TA0CCTL2               TACCTL2        /* Timer A Capture/Compare Control 2 */
621
#define TA0R                   TAR            /* Timer A Counter Register */
622
#define TA0CCR0                TACCR0         /* Timer A Capture/Compare 0 */
623
#define TA0CCR1                TACCR1         /* Timer A Capture/Compare 1 */
624
#define TA0CCR2                TACCR2         /* Timer A Capture/Compare 2 */
625
#define TA0IV_                 TAIV_          /* Timer A Interrupt Vector Word */
626
#define TA0CTL_                TACTL_         /* Timer A Control */
627
#define TA0CCTL0_              TACCTL0_       /* Timer A Capture/Compare Control 0 */
628
#define TA0CCTL1_              TACCTL1_       /* Timer A Capture/Compare Control 1 */
629
#define TA0CCTL2_              TACCTL2_       /* Timer A Capture/Compare Control 2 */
630
#define TA0R_                  TAR_           /* Timer A Counter Register */
631
#define TA0CCR0_               TACCR0_        /* Timer A Capture/Compare 0 */
632
#define TA0CCR1_               TACCR1_        /* Timer A Capture/Compare 1 */
633
#define TA0CCR2_               TACCR2_        /* Timer A Capture/Compare 2 */
634
 
635
#define TASSEL1                (0x0200)       /* Timer A clock source select 0 */
636
#define TASSEL0                (0x0100)       /* Timer A clock source select 1 */
637
#define ID1                    (0x0080)       /* Timer A clock input divider 1 */
638
#define ID0                    (0x0040)       /* Timer A clock input divider 0 */
639
#define MC1                    (0x0020)       /* Timer A mode control 1 */
640
#define MC0                    (0x0010)       /* Timer A mode control 0 */
641
#define TACLR                  (0x0004)       /* Timer A counter clear */
642
#define TAIE                   (0x0002)       /* Timer A counter interrupt enable */
643
#define TAIFG                  (0x0001)       /* Timer A counter interrupt flag */
644
 
645
#define MC_0                   (0*0x10u)      /* Timer A mode control: 0 - Stop */
646
#define MC_1                   (1*0x10u)      /* Timer A mode control: 1 - Up to CCR0 */
647
#define MC_2                   (2*0x10u)      /* Timer A mode control: 2 - Continous up */
648
#define MC_3                   (3*0x10u)      /* Timer A mode control: 3 - Up/Down */
649
#define ID_0                   (0*0x40u)      /* Timer A input divider: 0 - /1 */
650
#define ID_1                   (1*0x40u)      /* Timer A input divider: 1 - /2 */
651
#define ID_2                   (2*0x40u)      /* Timer A input divider: 2 - /4 */
652
#define ID_3                   (3*0x40u)      /* Timer A input divider: 3 - /8 */
653
#define TASSEL_0               (0*0x100u)     /* Timer A clock source select: 0 - TACLK */
654
#define TASSEL_1               (1*0x100u)     /* Timer A clock source select: 1 - ACLK  */
655
#define TASSEL_2               (2*0x100u)     /* Timer A clock source select: 2 - SMCLK */
656
#define TASSEL_3               (3*0x100u)     /* Timer A clock source select: 3 - INCLK */
657
 
658
#define CM1                    (0x8000)       /* Capture mode 1 */
659
#define CM0                    (0x4000)       /* Capture mode 0 */
660
#define CCIS1                  (0x2000)       /* Capture input select 1 */
661
#define CCIS0                  (0x1000)       /* Capture input select 0 */
662
#define SCS                    (0x0800)       /* Capture sychronize */
663
#define SCCI                   (0x0400)       /* Latched capture signal (read) */
664
#define CAP                    (0x0100)       /* Capture mode: 1 /Compare mode : 0 */
665
#define OUTMOD2                (0x0080)       /* Output mode 2 */
666
#define OUTMOD1                (0x0040)       /* Output mode 1 */
667
#define OUTMOD0                (0x0020)       /* Output mode 0 */
668
#define CCIE                   (0x0010)       /* Capture/compare interrupt enable */
669
#define CCI                    (0x0008)       /* Capture input signal (read) */
670
#define OUT                    (0x0004)       /* PWM Output signal if output mode 0 */
671
#define COV                    (0x0002)       /* Capture/compare overflow flag */
672
#define CCIFG                  (0x0001)       /* Capture/compare interrupt flag */
673
 
674
#define OUTMOD_0               (0*0x20u)      /* PWM output mode: 0 - output only */
675
#define OUTMOD_1               (1*0x20u)      /* PWM output mode: 1 - set */
676
#define OUTMOD_2               (2*0x20u)      /* PWM output mode: 2 - PWM toggle/reset */
677
#define OUTMOD_3               (3*0x20u)      /* PWM output mode: 3 - PWM set/reset */
678
#define OUTMOD_4               (4*0x20u)      /* PWM output mode: 4 - toggle */
679
#define OUTMOD_5               (5*0x20u)      /* PWM output mode: 5 - Reset */
680
#define OUTMOD_6               (6*0x20u)      /* PWM output mode: 6 - PWM toggle/set */
681
#define OUTMOD_7               (7*0x20u)      /* PWM output mode: 7 - PWM reset/set */
682
#define CCIS_0                 (0*0x1000u)    /* Capture input select: 0 - CCIxA */
683
#define CCIS_1                 (1*0x1000u)    /* Capture input select: 1 - CCIxB */
684
#define CCIS_2                 (2*0x1000u)    /* Capture input select: 2 - GND */
685
#define CCIS_3                 (3*0x1000u)    /* Capture input select: 3 - Vcc */
686
#define CM_0                   (0*0x4000u)    /* Capture mode: 0 - disabled */
687
#define CM_1                   (1*0x4000u)    /* Capture mode: 1 - pos. edge */
688
#define CM_2                   (2*0x4000u)    /* Capture mode: 1 - neg. edge */
689
#define CM_3                   (3*0x4000u)    /* Capture mode: 1 - both edges */
690
 
691
/* TA3IV Definitions */
692
#define TAIV_NONE              (0x0000)       /* No Interrupt pending */
693
#define TAIV_TACCR1            (0x0002)       /* TACCR1_CCIFG */
694
#define TAIV_TACCR2            (0x0004)       /* TACCR2_CCIFG */
695
#define TAIV_6                 (0x0006)       /* Reserved */
696
#define TAIV_8                 (0x0008)       /* Reserved */
697
#define TAIV_TAIFG             (0x000A)       /* TAIFG */
698
 
699
/************************************************************
700
* Timer B3
701
************************************************************/
702
#define __MSP430_HAS_TB3__                    /* Definition to show that Module is available */
703
 
704
SFR_16BIT(TBIV);                              /* Timer B Interrupt Vector Word */
705
SFR_16BIT(TBCTL);                             /* Timer B Control */
706
SFR_16BIT(TBCCTL0);                           /* Timer B Capture/Compare Control 0 */
707
SFR_16BIT(TBCCTL1);                           /* Timer B Capture/Compare Control 1 */
708
SFR_16BIT(TBCCTL2);                           /* Timer B Capture/Compare Control 2 */
709
SFR_16BIT(TBR);                               /* Timer B Counter Register */
710
SFR_16BIT(TBCCR0);                            /* Timer B Capture/Compare 0 */
711
SFR_16BIT(TBCCR1);                            /* Timer B Capture/Compare 1 */
712
SFR_16BIT(TBCCR2);                            /* Timer B Capture/Compare 2 */
713
 
714
/* Alternate register names - 5xx style */
715
#define TB0IV                  TBIV           /* Timer B Interrupt Vector Word */
716
#define TB0CTL                 TBCTL          /* Timer B Control */
717
#define TB0CCTL0               TBCCTL0        /* Timer B Capture/Compare Control 0 */
718
#define TB0CCTL1               TBCCTL1        /* Timer B Capture/Compare Control 1 */
719
#define TB0CCTL2               TBCCTL2        /* Timer B Capture/Compare Control 2 */
720
#define TB0R                   TBR            /* Timer B Counter Register */
721
#define TB0CCR0                TBCCR0         /* Timer B Capture/Compare 0 */
722
#define TB0CCR1                TBCCR1         /* Timer B Capture/Compare 1 */
723
#define TB0CCR2                TBCCR2         /* Timer B Capture/Compare 2 */
724
#define TB0IV_                 TBIV_          /* Timer B Interrupt Vector Word */
725
#define TB0CTL_                TBCTL_         /* Timer B Control */
726
#define TB0CCTL0_              TBCCTL0_       /* Timer B Capture/Compare Control 0 */
727
#define TB0CCTL1_              TBCCTL1_       /* Timer B Capture/Compare Control 1 */
728
#define TB0CCTL2_              TBCCTL2_       /* Timer B Capture/Compare Control 2 */
729
#define TB0R_                  TBR_           /* Timer B Counter Register */
730
#define TB0CCR0_               TBCCR0_        /* Timer B Capture/Compare 0 */
731
#define TB0CCR1_               TBCCR1_        /* Timer B Capture/Compare 1 */
732
#define TB0CCR2_               TBCCR2_        /* Timer B Capture/Compare 2 */
733
 
734
#define TBCLGRP1               (0x4000)       /* Timer B Compare latch load group 1 */
735
#define TBCLGRP0               (0x2000)       /* Timer B Compare latch load group 0 */
736
#define CNTL1                  (0x1000)       /* Counter lenght 1 */
737
#define CNTL0                  (0x0800)       /* Counter lenght 0 */
738
#define TBSSEL1                (0x0200)       /* Clock source 1 */
739
#define TBSSEL0                (0x0100)       /* Clock source 0 */
740
#define TBCLR                  (0x0004)       /* Timer B counter clear */
741
#define TBIE                   (0x0002)       /* Timer B interrupt enable */
742
#define TBIFG                  (0x0001)       /* Timer B interrupt flag */
743
 
744
#define SHR1                   (0x4000)       /* Timer B Compare latch load group 1 */
745
#define SHR0                   (0x2000)       /* Timer B Compare latch load group 0 */
746
 
747
#define TBSSEL_0               (0*0x0100u)    /* Clock Source: TBCLK */
748
#define TBSSEL_1               (1*0x0100u)    /* Clock Source: ACLK  */
749
#define TBSSEL_2               (2*0x0100u)    /* Clock Source: SMCLK */
750
#define TBSSEL_3               (3*0x0100u)    /* Clock Source: INCLK */
751
#define CNTL_0                 (0*0x0800u)    /* Counter lenght: 16 bit */
752
#define CNTL_1                 (1*0x0800u)    /* Counter lenght: 12 bit */
753
#define CNTL_2                 (2*0x0800u)    /* Counter lenght: 10 bit */
754
#define CNTL_3                 (3*0x0800u)    /* Counter lenght:  8 bit */
755
#define SHR_0                  (0*0x2000u)    /* Timer B Group: 0 - individually */
756
#define SHR_1                  (1*0x2000u)    /* Timer B Group: 1 - 3 groups (1-2, 3-4, 5-6) */
757
#define SHR_2                  (2*0x2000u)    /* Timer B Group: 2 - 2 groups (1-3, 4-6)*/
758
#define SHR_3                  (3*0x2000u)    /* Timer B Group: 3 - 1 group (all) */
759
#define TBCLGRP_0              (0*0x2000u)    /* Timer B Group: 0 - individually */
760
#define TBCLGRP_1              (1*0x2000u)    /* Timer B Group: 1 - 3 groups (1-2, 3-4, 5-6) */
761
#define TBCLGRP_2              (2*0x2000u)    /* Timer B Group: 2 - 2 groups (1-3, 4-6)*/
762
#define TBCLGRP_3              (3*0x2000u)    /* Timer B Group: 3 - 1 group (all) */
763
 
764
/* Additional Timer B Control Register bits are defined in Timer A */
765
 
766
#define CLLD1                  (0x0400)       /* Compare latch load source 1 */
767
#define CLLD0                  (0x0200)       /* Compare latch load source 0 */
768
 
769
#define SLSHR1                 (0x0400)       /* Compare latch load source 1 */
770
#define SLSHR0                 (0x0200)       /* Compare latch load source 0 */
771
 
772
#define SLSHR_0                (0*0x0200u)    /* Compare latch load sourec : 0 - immediate */
773
#define SLSHR_1                (1*0x0200u)    /* Compare latch load sourec : 1 - TBR counts to 0 */
774
#define SLSHR_2                (2*0x0200u)    /* Compare latch load sourec : 2 - up/down */
775
#define SLSHR_3                (3*0x0200u)    /* Compare latch load sourec : 3 - TBR counts to TBCTL0 */
776
 
777
#define CLLD_0                 (0*0x0200u)    /* Compare latch load sourec : 0 - immediate */
778
#define CLLD_1                 (1*0x0200u)    /* Compare latch load sourec : 1 - TBR counts to 0 */
779
#define CLLD_2                 (2*0x0200u)    /* Compare latch load sourec : 2 - up/down */
780
#define CLLD_3                 (3*0x0200u)    /* Compare latch load sourec : 3 - TBR counts to TBCTL0 */
781
 
782
/* TB3IV Definitions */
783
#define TBIV_NONE              (0x0000)       /* No Interrupt pending */
784
#define TBIV_TBCCR1            (0x0002)       /* TBCCR1_CCIFG */
785
#define TBIV_TBCCR2            (0x0004)       /* TBCCR2_CCIFG */
786
#define TBIV_3                 (0x0006)       /* Reserved */
787
#define TBIV_4                 (0x0008)       /* Reserved */
788
#define TBIV_5                 (0x000A)       /* Reserved */
789
#define TBIV_6                 (0x000C)       /* Reserved */
790
#define TBIV_TBIFG             (0x000E)       /* TBIFG */
791
 
792
/*************************************************************
793
* Flash Memory
794
*************************************************************/
795
#define __MSP430_HAS_FLASH__                  /* Definition to show that Module is available */
796
 
797
SFR_16BIT(FCTL1);                             /* FLASH Control 1 */
798
SFR_16BIT(FCTL2);                             /* FLASH Control 2 */
799
SFR_16BIT(FCTL3);                             /* FLASH Control 3 */
800
 
801
#define FRKEY                  (0x9600)       /* Flash key returned by read */
802
#define FWKEY                  (0xA500)       /* Flash key for write */
803
#define FXKEY                  (0x3300)       /* for use with XOR instruction */
804
 
805
#define ERASE                  (0x0002)       /* Enable bit for Flash segment erase */
806
#define MERAS                  (0x0004)       /* Enable bit for Flash mass erase */
807
#define WRT                    (0x0040)       /* Enable bit for Flash write */
808
#define BLKWRT                 (0x0080)       /* Enable bit for Flash segment write */
809
#define SEGWRT                 (0x0080)       /* old definition */ /* Enable bit for Flash segment write */
810
 
811
#define FN0                    (0x0001)       /* Divide Flash clock by 1 to 64 using FN0 to FN5 according to: */
812
#define FN1                    (0x0002)       /*  32*FN5 + 16*FN4 + 8*FN3 + 4*FN2 + 2*FN1 + FN0 + 1 */
813
#ifndef FN2
814
#define FN2                    (0x0004)
815
#endif
816
#ifndef FN3
817
#define FN3                    (0x0008)
818
#endif
819
#ifndef FN4
820
#define FN4                    (0x0010)
821
#endif
822
#define FN5                    (0x0020)
823
#define FSSEL0                 (0x0040)       /* Flash clock select 0 */        /* to distinguish from USART SSELx */
824
#define FSSEL1                 (0x0080)       /* Flash clock select 1 */
825
 
826
#define FSSEL_0                (0x0000)       /* Flash clock select: 0 - ACLK */
827
#define FSSEL_1                (0x0040)       /* Flash clock select: 1 - MCLK */
828
#define FSSEL_2                (0x0080)       /* Flash clock select: 2 - SMCLK */
829
#define FSSEL_3                (0x00C0)       /* Flash clock select: 3 - SMCLK */
830
 
831
#define BUSY                   (0x0001)       /* Flash busy: 1 */
832
#define KEYV                   (0x0002)       /* Flash Key violation flag */
833
#define ACCVIFG                (0x0004)       /* Flash Access violation flag */
834
#define WAIT                   (0x0008)       /* Wait flag for segment write */
835
#define LOCK                   (0x0010)       /* Lock bit: 1 - Flash is locked (read only) */
836
#define EMEX                   (0x0020)       /* Flash Emergency Exit */
837
 
838
/************************************************************
839
* Comparator A
840
************************************************************/
841
#define __MSP430_HAS_COMPA__                  /* Definition to show that Module is available */
842
 
843
SFR_8BIT(CACTL1);                             /* Comparator A Control 1 */
844
SFR_8BIT(CACTL2);                             /* Comparator A Control 2 */
845
SFR_8BIT(CAPD);                               /* Comparator A Port Disable */
846
 
847
#define CAIFG                  (0x01)         /* Comp. A Interrupt Flag */
848
#define CAIE                   (0x02)         /* Comp. A Interrupt Enable */
849
#define CAIES                  (0x04)         /* Comp. A Int. Edge Select: 0:rising / 1:falling */
850
#define CAON                   (0x08)         /* Comp. A enable */
851
#define CAREF0                 (0x10)         /* Comp. A Internal Reference Select 0 */
852
#define CAREF1                 (0x20)         /* Comp. A Internal Reference Select 1 */
853
#define CARSEL                 (0x40)         /* Comp. A Internal Reference Enable */
854
#define CAEX                   (0x80)         /* Comp. A Exchange Inputs */
855
 
856
#define CAREF_0                (0x00)         /* Comp. A Int. Ref. Select 0 : Off */
857
#define CAREF_1                (0x10)         /* Comp. A Int. Ref. Select 1 : 0.25*Vcc */
858
#define CAREF_2                (0x20)         /* Comp. A Int. Ref. Select 2 : 0.5*Vcc */
859
#define CAREF_3                (0x30)         /* Comp. A Int. Ref. Select 3 : Vt*/
860
 
861
#define CAOUT                  (0x01)         /* Comp. A Output */
862
#define CAF                    (0x02)         /* Comp. A Enable Output Filter */
863
#define P2CA0                  (0x04)         /* Comp. A Connect External Signal to CA0 : 1 */
864
#define P2CA1                  (0x08)         /* Comp. A Connect External Signal to CA1 : 1 */
865
#define CACTL24                (0x10)
866
#define CACTL25                (0x20)
867
#define CACTL26                (0x40)
868
#define CACTL27                (0x80)
869
 
870
#define CAPD0                  (0x01)         /* Comp. A Disable Input Buffer of Port Register .0 */
871
#define CAPD1                  (0x02)         /* Comp. A Disable Input Buffer of Port Register .1 */
872
#define CAPD2                  (0x04)         /* Comp. A Disable Input Buffer of Port Register .2 */
873
#define CAPD3                  (0x08)         /* Comp. A Disable Input Buffer of Port Register .3 */
874
#define CAPD4                  (0x10)         /* Comp. A Disable Input Buffer of Port Register .4 */
875
#define CAPD5                  (0x20)         /* Comp. A Disable Input Buffer of Port Register .5 */
876
#define CAPD6                  (0x40)         /* Comp. A Disable Input Buffer of Port Register .6 */
877
#define CAPD7                  (0x80)         /* Comp. A Disable Input Buffer of Port Register .7 */
878
 
879
/************************************************************
880
* ADC12
881
************************************************************/
882
#define __MSP430_HAS_ADC12__                  /* Definition to show that Module is available */
883
 
884
SFR_16BIT(ADC12CTL0);                         /* ADC12 Control 0 */
885
SFR_16BIT(ADC12CTL1);                         /* ADC12 Control 1 */
886
SFR_16BIT(ADC12IFG);                          /* ADC12 Interrupt Flag */
887
SFR_16BIT(ADC12IE);                           /* ADC12 Interrupt Enable */
888
SFR_16BIT(ADC12IV);                           /* ADC12 Interrupt Vector Word */
889
 
890
#define ADC12MEM_              (0x0140)       /* ADC12 Conversion Memory */
891
#ifdef __ASM_HEADER__
892
#define ADC12MEM               (ADC12MEM_)    /* ADC12 Conversion Memory (for assembler) */
893
#else
894
#define ADC12MEM               ((int*)        ADC12MEM_) /* ADC12 Conversion Memory (for C) */
895
#endif
896
SFR_16BIT(ADC12MEM0);                         /* ADC12 Conversion Memory 0 */
897
SFR_16BIT(ADC12MEM1);                         /* ADC12 Conversion Memory 1 */
898
SFR_16BIT(ADC12MEM2);                         /* ADC12 Conversion Memory 2 */
899
SFR_16BIT(ADC12MEM3);                         /* ADC12 Conversion Memory 3 */
900
SFR_16BIT(ADC12MEM4);                         /* ADC12 Conversion Memory 4 */
901
SFR_16BIT(ADC12MEM5);                         /* ADC12 Conversion Memory 5 */
902
SFR_16BIT(ADC12MEM6);                         /* ADC12 Conversion Memory 6 */
903
SFR_16BIT(ADC12MEM7);                         /* ADC12 Conversion Memory 7 */
904
SFR_16BIT(ADC12MEM8);                         /* ADC12 Conversion Memory 8 */
905
SFR_16BIT(ADC12MEM9);                         /* ADC12 Conversion Memory 9 */
906
SFR_16BIT(ADC12MEM10);                        /* ADC12 Conversion Memory 10 */
907
SFR_16BIT(ADC12MEM11);                        /* ADC12 Conversion Memory 11 */
908
SFR_16BIT(ADC12MEM12);                        /* ADC12 Conversion Memory 12 */
909
SFR_16BIT(ADC12MEM13);                        /* ADC12 Conversion Memory 13 */
910
SFR_16BIT(ADC12MEM14);                        /* ADC12 Conversion Memory 14 */
911
SFR_16BIT(ADC12MEM15);                        /* ADC12 Conversion Memory 15 */
912
 
913
#define ADC12MCTL_             (0x0080)       /* ADC12 Memory Control */
914
#ifdef __ASM_HEADER__
915
#define ADC12MCTL              (ADC12MCTL_)   /* ADC12 Memory Control (for assembler) */
916
#else
917
#define ADC12MCTL              ((char*)       ADC12MCTL_) /* ADC12 Memory Control (for C) */
918
#endif
919
SFR_8BIT(ADC12MCTL0);                         /* ADC12 Memory Control 0 */
920
SFR_8BIT(ADC12MCTL1);                         /* ADC12 Memory Control 1 */
921
SFR_8BIT(ADC12MCTL2);                         /* ADC12 Memory Control 2 */
922
SFR_8BIT(ADC12MCTL3);                         /* ADC12 Memory Control 3 */
923
SFR_8BIT(ADC12MCTL4);                         /* ADC12 Memory Control 4 */
924
SFR_8BIT(ADC12MCTL5);                         /* ADC12 Memory Control 5 */
925
SFR_8BIT(ADC12MCTL6);                         /* ADC12 Memory Control 6 */
926
SFR_8BIT(ADC12MCTL7);                         /* ADC12 Memory Control 7 */
927
SFR_8BIT(ADC12MCTL8);                         /* ADC12 Memory Control 8 */
928
SFR_8BIT(ADC12MCTL9);                         /* ADC12 Memory Control 9 */
929
SFR_8BIT(ADC12MCTL10);                        /* ADC12 Memory Control 10 */
930
SFR_8BIT(ADC12MCTL11);                        /* ADC12 Memory Control 11 */
931
SFR_8BIT(ADC12MCTL12);                        /* ADC12 Memory Control 12 */
932
SFR_8BIT(ADC12MCTL13);                        /* ADC12 Memory Control 13 */
933
SFR_8BIT(ADC12MCTL14);                        /* ADC12 Memory Control 14 */
934
SFR_8BIT(ADC12MCTL15);                        /* ADC12 Memory Control 15 */
935
 
936
/* ADC12CTL0 */
937
#define ADC12SC                (0x001)        /* ADC12 Start Conversion */
938
#define ENC                    (0x002)        /* ADC12 Enable Conversion */
939
#define ADC12TOVIE             (0x004)        /* ADC12 Timer Overflow interrupt enable */
940
#define ADC12OVIE              (0x008)        /* ADC12 Overflow interrupt enable */
941
#define ADC12ON                (0x010)        /* ADC12 On/enable */
942
#define REFON                  (0x020)        /* ADC12 Reference on */
943
#define REF2_5V                (0x040)        /* ADC12 Ref 0:1.5V / 1:2.5V */
944
#define MSC                    (0x080)        /* ADC12 Multiple SampleConversion */
945
#define SHT00                  (0x0100)       /* ADC12 Sample Hold 0 Select 0 */
946
#define SHT01                  (0x0200)       /* ADC12 Sample Hold 0 Select 1 */
947
#define SHT02                  (0x0400)       /* ADC12 Sample Hold 0 Select 2 */
948
#define SHT03                  (0x0800)       /* ADC12 Sample Hold 0 Select 3 */
949
#define SHT10                  (0x1000)       /* ADC12 Sample Hold 0 Select 0 */
950
#define SHT11                  (0x2000)       /* ADC12 Sample Hold 1 Select 1 */
951
#define SHT12                  (0x4000)       /* ADC12 Sample Hold 2 Select 2 */
952
#define SHT13                  (0x8000)       /* ADC12 Sample Hold 3 Select 3 */
953
#define MSH                    (0x080)
954
 
955
#define SHT0_0                 (0*0x100u)     /* ADC12 Sample Hold 0 Select Bit: 0 */
956
#define SHT0_1                 (1*0x100u)     /* ADC12 Sample Hold 0 Select Bit: 1 */
957
#define SHT0_2                 (2*0x100u)     /* ADC12 Sample Hold 0 Select Bit: 2 */
958
#define SHT0_3                 (3*0x100u)     /* ADC12 Sample Hold 0 Select Bit: 3 */
959
#define SHT0_4                 (4*0x100u)     /* ADC12 Sample Hold 0 Select Bit: 4 */
960
#define SHT0_5                 (5*0x100u)     /* ADC12 Sample Hold 0 Select Bit: 5 */
961
#define SHT0_6                 (6*0x100u)     /* ADC12 Sample Hold 0 Select Bit: 6 */
962
#define SHT0_7                 (7*0x100u)     /* ADC12 Sample Hold 0 Select Bit: 7 */
963
#define SHT0_8                 (8*0x100u)     /* ADC12 Sample Hold 0 Select Bit: 8 */
964
#define SHT0_9                 (9*0x100u)     /* ADC12 Sample Hold 0 Select Bit: 9 */
965
#define SHT0_10                (10*0x100u)    /* ADC12 Sample Hold 0 Select Bit: 10 */
966
#define SHT0_11                (11*0x100u)    /* ADC12 Sample Hold 0 Select Bit: 11 */
967
#define SHT0_12                (12*0x100u)    /* ADC12 Sample Hold 0 Select Bit: 12 */
968
#define SHT0_13                (13*0x100u)    /* ADC12 Sample Hold 0 Select Bit: 13 */
969
#define SHT0_14                (14*0x100u)    /* ADC12 Sample Hold 0 Select Bit: 14 */
970
#define SHT0_15                (15*0x100u)    /* ADC12 Sample Hold 0 Select Bit: 15 */
971
 
972
#define SHT1_0                 (0*0x1000u)    /* ADC12 Sample Hold 1 Select Bit: 0 */
973
#define SHT1_1                 (1*0x1000u)    /* ADC12 Sample Hold 1 Select Bit: 1 */
974
#define SHT1_2                 (2*0x1000u)    /* ADC12 Sample Hold 1 Select Bit: 2 */
975
#define SHT1_3                 (3*0x1000u)    /* ADC12 Sample Hold 1 Select Bit: 3 */
976
#define SHT1_4                 (4*0x1000u)    /* ADC12 Sample Hold 1 Select Bit: 4 */
977
#define SHT1_5                 (5*0x1000u)    /* ADC12 Sample Hold 1 Select Bit: 5 */
978
#define SHT1_6                 (6*0x1000u)    /* ADC12 Sample Hold 1 Select Bit: 6 */
979
#define SHT1_7                 (7*0x1000u)    /* ADC12 Sample Hold 1 Select Bit: 7 */
980
#define SHT1_8                 (8*0x1000u)    /* ADC12 Sample Hold 1 Select Bit: 8 */
981
#define SHT1_9                 (9*0x1000u)    /* ADC12 Sample Hold 1 Select Bit: 9 */
982
#define SHT1_10                (10*0x1000u)   /* ADC12 Sample Hold 1 Select Bit: 10 */
983
#define SHT1_11                (11*0x1000u)   /* ADC12 Sample Hold 1 Select Bit: 11 */
984
#define SHT1_12                (12*0x1000u)   /* ADC12 Sample Hold 1 Select Bit: 12 */
985
#define SHT1_13                (13*0x1000u)   /* ADC12 Sample Hold 1 Select Bit: 13 */
986
#define SHT1_14                (14*0x1000u)   /* ADC12 Sample Hold 1 Select Bit: 14 */
987
#define SHT1_15                (15*0x1000u)   /* ADC12 Sample Hold 1 Select Bit: 15 */
988
 
989
/* ADC12CTL1 */
990
#define ADC12BUSY              (0x0001)       /* ADC12 Busy */
991
#define CONSEQ0                (0x0002)       /* ADC12 Conversion Sequence Select 0 */
992
#define CONSEQ1                (0x0004)       /* ADC12 Conversion Sequence Select 1 */
993
#define ADC12SSEL0             (0x0008)       /* ADC12 Clock Source Select 0 */
994
#define ADC12SSEL1             (0x0010)       /* ADC12 Clock Source Select 1 */
995
#define ADC12DIV0              (0x0020)       /* ADC12 Clock Divider Select 0 */
996
#define ADC12DIV1              (0x0040)       /* ADC12 Clock Divider Select 1 */
997
#define ADC12DIV2              (0x0080)       /* ADC12 Clock Divider Select 2 */
998
#define ISSH                   (0x0100)       /* ADC12 Invert Sample Hold Signal */
999
#define SHP                    (0x0200)       /* ADC12 Sample/Hold Pulse Mode */
1000
#define SHS0                   (0x0400)       /* ADC12 Sample/Hold Source 0 */
1001
#define SHS1                   (0x0800)       /* ADC12 Sample/Hold Source 1 */
1002
#define CSTARTADD0             (0x1000)       /* ADC12 Conversion Start Address 0 */
1003
#define CSTARTADD1             (0x2000)       /* ADC12 Conversion Start Address 1 */
1004
#define CSTARTADD2             (0x4000)       /* ADC12 Conversion Start Address 2 */
1005
#define CSTARTADD3             (0x8000)       /* ADC12 Conversion Start Address 3 */
1006
 
1007
#define CONSEQ_0               (0*2u)         /* ADC12 Conversion Sequence Select: 0 */
1008
#define CONSEQ_1               (1*2u)         /* ADC12 Conversion Sequence Select: 1 */
1009
#define CONSEQ_2               (2*2u)         /* ADC12 Conversion Sequence Select: 2 */
1010
#define CONSEQ_3               (3*2u)         /* ADC12 Conversion Sequence Select: 3 */
1011
#define ADC12SSEL_0            (0*8u)         /* ADC12 Clock Source Select: 0 */
1012
#define ADC12SSEL_1            (1*8u)         /* ADC12 Clock Source Select: 1 */
1013
#define ADC12SSEL_2            (2*8u)         /* ADC12 Clock Source Select: 2 */
1014
#define ADC12SSEL_3            (3*8u)         /* ADC12 Clock Source Select: 3 */
1015
#define ADC12DIV_0             (0*0x20u)      /* ADC12 Clock Divider Select: 0 */
1016
#define ADC12DIV_1             (1*0x20u)      /* ADC12 Clock Divider Select: 1 */
1017
#define ADC12DIV_2             (2*0x20u)      /* ADC12 Clock Divider Select: 2 */
1018
#define ADC12DIV_3             (3*0x20u)      /* ADC12 Clock Divider Select: 3 */
1019
#define ADC12DIV_4             (4*0x20u)      /* ADC12 Clock Divider Select: 4 */
1020
#define ADC12DIV_5             (5*0x20u)      /* ADC12 Clock Divider Select: 5 */
1021
#define ADC12DIV_6             (6*0x20u)      /* ADC12 Clock Divider Select: 6 */
1022
#define ADC12DIV_7             (7*0x20u)      /* ADC12 Clock Divider Select: 7 */
1023
#define SHS_0                  (0*0x400u)     /* ADC12 Sample/Hold Source: 0 */
1024
#define SHS_1                  (1*0x400u)     /* ADC12 Sample/Hold Source: 1 */
1025
#define SHS_2                  (2*0x400u)     /* ADC12 Sample/Hold Source: 2 */
1026
#define SHS_3                  (3*0x400u)     /* ADC12 Sample/Hold Source: 3 */
1027
#define CSTARTADD_0            (0*0x1000u)    /* ADC12 Conversion Start Address: 0 */
1028
#define CSTARTADD_1            (1*0x1000u)    /* ADC12 Conversion Start Address: 1 */
1029
#define CSTARTADD_2            (2*0x1000u)    /* ADC12 Conversion Start Address: 2 */
1030
#define CSTARTADD_3            (3*0x1000u)    /* ADC12 Conversion Start Address: 3 */
1031
#define CSTARTADD_4            (4*0x1000u)    /* ADC12 Conversion Start Address: 4 */
1032
#define CSTARTADD_5            (5*0x1000u)    /* ADC12 Conversion Start Address: 5 */
1033
#define CSTARTADD_6            (6*0x1000u)    /* ADC12 Conversion Start Address: 6 */
1034
#define CSTARTADD_7            (7*0x1000u)    /* ADC12 Conversion Start Address: 7 */
1035
#define CSTARTADD_8            (8*0x1000u)    /* ADC12 Conversion Start Address: 8 */
1036
#define CSTARTADD_9            (9*0x1000u)    /* ADC12 Conversion Start Address: 9 */
1037
#define CSTARTADD_10           (10*0x1000u)   /* ADC12 Conversion Start Address: 10 */
1038
#define CSTARTADD_11           (11*0x1000u)   /* ADC12 Conversion Start Address: 11 */
1039
#define CSTARTADD_12           (12*0x1000u)   /* ADC12 Conversion Start Address: 12 */
1040
#define CSTARTADD_13           (13*0x1000u)   /* ADC12 Conversion Start Address: 13 */
1041
#define CSTARTADD_14           (14*0x1000u)   /* ADC12 Conversion Start Address: 14 */
1042
#define CSTARTADD_15           (15*0x1000u)   /* ADC12 Conversion Start Address: 15 */
1043
 
1044
/* ADC12MCTLx */
1045
#define INCH0                  (0x0001)       /* ADC12 Input Channel Select Bit 0 */
1046
#define INCH1                  (0x0002)       /* ADC12 Input Channel Select Bit 1 */
1047
#define INCH2                  (0x0004)       /* ADC12 Input Channel Select Bit 2 */
1048
#define INCH3                  (0x0008)       /* ADC12 Input Channel Select Bit 3 */
1049
#define SREF0                  (0x0010)       /* ADC12 Select Reference Bit 0 */
1050
#define SREF1                  (0x0020)       /* ADC12 Select Reference Bit 1 */
1051
#define SREF2                  (0x0040)       /* ADC12 Select Reference Bit 2 */
1052
#define EOS                    (0x0080)       /* ADC12 End of Sequence */
1053
 
1054
#define INCH_0                 (0)            /* ADC12 Input Channel 0 */
1055
#define INCH_1                 (1)            /* ADC12 Input Channel 1 */
1056
#define INCH_2                 (2)            /* ADC12 Input Channel 2 */
1057
#define INCH_3                 (3)            /* ADC12 Input Channel 3 */
1058
#define INCH_4                 (4)            /* ADC12 Input Channel 4 */
1059
#define INCH_5                 (5)            /* ADC12 Input Channel 5 */
1060
#define INCH_6                 (6)            /* ADC12 Input Channel 6 */
1061
#define INCH_7                 (7)            /* ADC12 Input Channel 7 */
1062
#define INCH_8                 (8)            /* ADC12 Input Channel 8 */
1063
#define INCH_9                 (9)            /* ADC12 Input Channel 9 */
1064
#define INCH_10                (10)           /* ADC12 Input Channel 10 */
1065
#define INCH_11                (11)           /* ADC12 Input Channel 11 */
1066
#define INCH_12                (12)           /* ADC12 Input Channel 12 */
1067
#define INCH_13                (13)           /* ADC12 Input Channel 13 */
1068
#define INCH_14                (14)           /* ADC12 Input Channel 14 */
1069
#define INCH_15                (15)           /* ADC12 Input Channel 15 */
1070
 
1071
#define SREF_0                 (0*0x10u)      /* ADC12 Select Reference 0 */
1072
#define SREF_1                 (1*0x10u)      /* ADC12 Select Reference 1 */
1073
#define SREF_2                 (2*0x10u)      /* ADC12 Select Reference 2 */
1074
#define SREF_3                 (3*0x10u)      /* ADC12 Select Reference 3 */
1075
#define SREF_4                 (4*0x10u)      /* ADC12 Select Reference 4 */
1076
#define SREF_5                 (5*0x10u)      /* ADC12 Select Reference 5 */
1077
#define SREF_6                 (6*0x10u)      /* ADC12 Select Reference 6 */
1078
#define SREF_7                 (7*0x10u)      /* ADC12 Select Reference 7 */
1079
 
1080
/* ADC12IV Definitions */
1081
#define ADC12IV_NONE           (0x0000)       /* No Interrupt pending */
1082
#define ADC12IV_ADC12OVIFG     (0x0002)       /* ADC12OVIFG */
1083
#define ADC12IV_ADC12TOVIFG    (0x0004)       /* ADC12TOVIFG */
1084
#define ADC12IV_ADC12IFG0      (0x0006)       /* ADC12IFG0 */
1085
#define ADC12IV_ADC12IFG1      (0x0008)       /* ADC12IFG1 */
1086
#define ADC12IV_ADC12IFG2      (0x000A)       /* ADC12IFG2 */
1087
#define ADC12IV_ADC12IFG3      (0x000C)       /* ADC12IFG3 */
1088
#define ADC12IV_ADC12IFG4      (0x000E)       /* ADC12IFG4 */
1089
#define ADC12IV_ADC12IFG5      (0x0010)       /* ADC12IFG5 */
1090
#define ADC12IV_ADC12IFG6      (0x0012)       /* ADC12IFG6 */
1091
#define ADC12IV_ADC12IFG7      (0x0014)       /* ADC12IFG7 */
1092
#define ADC12IV_ADC12IFG8      (0x0016)       /* ADC12IFG8 */
1093
#define ADC12IV_ADC12IFG9      (0x0018)       /* ADC12IFG9 */
1094
#define ADC12IV_ADC12IFG10     (0x001A)       /* ADC12IFG10 */
1095
#define ADC12IV_ADC12IFG11     (0x001C)       /* ADC12IFG11 */
1096
#define ADC12IV_ADC12IFG12     (0x001E)       /* ADC12IFG12 */
1097
#define ADC12IV_ADC12IFG13     (0x0020)       /* ADC12IFG13 */
1098
#define ADC12IV_ADC12IFG14     (0x0022)       /* ADC12IFG14 */
1099
#define ADC12IV_ADC12IFG15     (0x0024)       /* ADC12IFG15 */
1100
 
1101
/************************************************************
1102
* DAC12
1103
************************************************************/
1104
#define __MSP430_HAS_DAC12_2__                /* Definition to show that Module is available */
1105
 
1106
SFR_16BIT(DAC12_0CTL);                        /* DAC12_0 Control */
1107
SFR_16BIT(DAC12_1CTL);                        /* DAC12_1 Control */
1108
 
1109
#define DAC12GRP               (0x0001)       /* DAC12 group */
1110
#define DAC12ENC               (0x0002)       /* DAC12 enable conversion */
1111
#define DAC12IFG               (0x0004)       /* DAC12 interrupt flag */
1112
#define DAC12IE                (0x0008)       /* DAC12 interrupt enable */
1113
#define DAC12DF                (0x0010)       /* DAC12 data format */
1114
#define DAC12AMP0              (0x0020)       /* DAC12 amplifier bit 0 */
1115
#define DAC12AMP1              (0x0040)       /* DAC12 amplifier bit 1 */
1116
#define DAC12AMP2              (0x0080)       /* DAC12 amplifier bit 2 */
1117
#define DAC12IR                (0x0100)       /* DAC12 input reference and output range */
1118
#define DAC12CALON             (0x0200)       /* DAC12 calibration */
1119
#define DAC12LSEL0             (0x0400)       /* DAC12 load select bit 0 */
1120
#define DAC12LSEL1             (0x0800)       /* DAC12 load select bit 1 */
1121
#define DAC12RES               (0x1000)       /* DAC12 resolution */
1122
#define DAC12SREF0             (0x2000)       /* DAC12 reference bit 0 */
1123
#define DAC12SREF1             (0x4000)       /* DAC12 reference bit 1 */
1124
#define DAC12OPS               (0x8000)       /* DAC12 Operation Amp. */
1125
 
1126
#define DAC12AMP_0             (0*0x0020u)    /* DAC12 amplifier 0: off,    3-state */
1127
#define DAC12AMP_1             (1*0x0020u)    /* DAC12 amplifier 1: off,    off */
1128
#define DAC12AMP_2             (2*0x0020u)    /* DAC12 amplifier 2: low,    low */
1129
#define DAC12AMP_3             (3*0x0020u)    /* DAC12 amplifier 3: low,    medium */
1130
#define DAC12AMP_4             (4*0x0020u)    /* DAC12 amplifier 4: low,    high */
1131
#define DAC12AMP_5             (5*0x0020u)    /* DAC12 amplifier 5: medium, medium */
1132
#define DAC12AMP_6             (6*0x0020u)    /* DAC12 amplifier 6: medium, high */
1133
#define DAC12AMP_7             (7*0x0020u)    /* DAC12 amplifier 7: high,   high */
1134
 
1135
#define DAC12LSEL_0            (0*0x0400u)    /* DAC12 load select 0: direct */
1136
#define DAC12LSEL_1            (1*0x0400u)    /* DAC12 load select 1: latched with DAT */
1137
#define DAC12LSEL_2            (2*0x0400u)    /* DAC12 load select 2: latched with pos. Timer_A3.OUT1 */
1138
#define DAC12LSEL_3            (3*0x0400u)    /* DAC12 load select 3: latched with pos. Timer_B7.OUT1 */
1139
 
1140
#define DAC12SREF_0            (0*0x2000u)    /* DAC12 reference 0: Vref+ */
1141
#define DAC12SREF_1            (1*0x2000u)    /* DAC12 reference 1: Vref+ */
1142
#define DAC12SREF_2            (2*0x2000u)    /* DAC12 reference 2: Veref+ */
1143
#define DAC12SREF_3            (3*0x2000u)    /* DAC12 reference 3: Veref+ */
1144
 
1145
SFR_16BIT(DAC12_0DAT);                        /* DAC12_0 Data */
1146
SFR_16BIT(DAC12_1DAT);                        /* DAC12_1 Data */
1147
/************************************************************
1148
* DMA
1149
************************************************************/
1150
#define __MSP430_HAS_DMA_1__                  /* Definition to show that Module is available */
1151
 
1152
SFR_16BIT(DMACTL0);                           /* DMA Module Control 0 */
1153
#define DMA0TSEL0              (0x0001)       /* DMA channel 0 transfer select bit 0 */
1154
#define DMA0TSEL1              (0x0002)       /* DMA channel 0 transfer select bit 1 */
1155
#define DMA0TSEL2              (0x0004)       /* DMA channel 0 transfer select bit 2 */
1156
#define DMA0TSEL3              (0x0008)       /* DMA channel 0 transfer select bit 3 */
1157
 
1158
#define DMA0TSEL_0             (0*0x0001u)    /* DMA channel 0 transfer select 0:  DMA_REQ (sw)*/
1159
#define DMA0TSEL_1             (1*0x0001u)    /* DMA channel 0 transfer select 1:  Timer_A (TACCR2.IFG) */
1160
#define DMA0TSEL_2             (2*0x0001u)    /* DMA channel 0 transfer select 2:  Timer_B (TBCCR2.IFG) */
1161
#define DMA0TSEL_3             (3*0x0001u)    /* DMA channel 0 transfer select 3:  UART0/I2C receive */
1162
#define DMA0TSEL_4             (4*0x0001u)    /* DMA channel 0 transfer select 4:  UART0/I2C transmit */
1163
#define DMA0TSEL_5             (5*0x0001u)    /* DMA channel 0 transfer select 5:  DAC12_0CTL.DAC12IFG */
1164
#define DMA0TSEL_6             (6*0x0001u)    /* DMA channel 0 transfer select 6:  ADC12 (ADC12IFG) */
1165
#define DMA0TSEL_7             (7*0x0001u)    /* DMA channel 0 transfer select 7:  Timer_A (TACCR0.IFG) */
1166
#define DMA0TSEL_8             (8*0x0001u)    /* DMA channel 0 transfer select 8:  Timer_B (TBCCR0.IFG) */
1167
#define DMA0TSEL_9             (9*0x0001u)    /* DMA channel 0 transfer select 9:  UART1 receive */
1168
#define DMA0TSEL_10            (10*0x0001u)   /* DMA channel 0 transfer select 10: UART1 transmit */
1169
#define DMA0TSEL_11            (11*0x0001u)   /* DMA channel 0 transfer select 11: Multiplier ready */
1170
#define DMA0TSEL_14            (14*0x0001u)   /* DMA channel 0 transfer select 14: previous DMA channel DMA2IFG */
1171
#define DMA0TSEL_15            (15*0x0001u)   /* DMA channel 0 transfer select 15: ext. Trigger (DMAE0) */
1172
 
1173
SFR_16BIT(DMACTL1);                           /* DMA Module Control 1 */
1174
#define ENNMI                  (0x0001)       /* Enable NMI interruption of DMA */
1175
#define ROUNDROBIN             (0x0002)       /* Round-Robin DMA channel priorities */
1176
#define DMAONFETCH             (0x0004)       /* DMA transfer on instruction fetch */
1177
 
1178
SFR_16BIT(DMA0CTL);                           /* DMA Channel 0 Control */
1179
 
1180
#define DMAREQ                 (0x0001)       /* Initiate DMA transfer with DMATSEL */
1181
#define DMAABORT               (0x0002)       /* DMA transfer aborted by NMI */
1182
#define DMAIE                  (0x0004)       /* DMA interrupt enable */
1183
#define DMAIFG                 (0x0008)       /* DMA interrupt flag */
1184
#define DMAEN                  (0x0010)       /* DMA enable */
1185
#define DMALEVEL               (0x0020)       /* DMA level sensitive trigger select */
1186
#define DMASRCBYTE             (0x0040)       /* DMA source byte */
1187
#define DMADSTBYTE             (0x0080)       /* DMA destination byte */
1188
#define DMASRCINCR0            (0x0100)       /* DMA source increment bit 0 */
1189
#define DMASRCINCR1            (0x0200)       /* DMA source increment bit 1 */
1190
#define DMADSTINCR0            (0x0400)       /* DMA destination increment bit 0 */
1191
#define DMADSTINCR1            (0x0800)       /* DMA destination increment bit 1 */
1192
#define DMADT0                 (0x1000)       /* DMA transfer mode bit 0 */
1193
#define DMADT1                 (0x2000)       /* DMA transfer mode bit 1 */
1194
#define DMADT2                 (0x4000)       /* DMA transfer mode bit 2 */
1195
 
1196
#define DMASWDW                (0*0x0040u)    /* DMA transfer: source word to destination word */
1197
#define DMASBDW                (1*0x0040u)    /* DMA transfer: source byte to destination word */
1198
#define DMASWDB                (2*0x0040u)    /* DMA transfer: source word to destination byte */
1199
#define DMASBDB                (3*0x0040u)    /* DMA transfer: source byte to destination byte */
1200
 
1201
#define DMASRCINCR_0           (0*0x0100u)    /* DMA source increment 0: source address unchanged */
1202
#define DMASRCINCR_1           (1*0x0100u)    /* DMA source increment 1: source address unchanged */
1203
#define DMASRCINCR_2           (2*0x0100u)    /* DMA source increment 2: source address decremented */
1204
#define DMASRCINCR_3           (3*0x0100u)    /* DMA source increment 3: source address incremented */
1205
 
1206
#define DMADSTINCR_0           (0*0x0400u)    /* DMA destination increment 0: destination address unchanged */
1207
#define DMADSTINCR_1           (1*0x0400u)    /* DMA destination increment 1: destination address unchanged */
1208
#define DMADSTINCR_2           (2*0x0400u)    /* DMA destination increment 2: destination address decremented */
1209
#define DMADSTINCR_3           (3*0x0400u)    /* DMA destination increment 3: destination address incremented */
1210
 
1211
#define DMADT_0                (0*0x1000u)    /* DMA transfer mode 0: single */
1212
#define DMADT_1                (1*0x1000u)    /* DMA transfer mode 1: block */
1213
#define DMADT_2                (2*0x1000u)    /* DMA transfer mode 2: interleaved */
1214
#define DMADT_3                (3*0x1000u)    /* DMA transfer mode 3: interleaved */
1215
#define DMADT_4                (4*0x1000u)    /* DMA transfer mode 4: single, repeat */
1216
#define DMADT_5                (5*0x1000u)    /* DMA transfer mode 5: block, repeat */
1217
#define DMADT_6                (6*0x1000u)    /* DMA transfer mode 6: interleaved, repeat */
1218
#define DMADT_7                (7*0x1000u)    /* DMA transfer mode 7: interleaved, repeat */
1219
 
1220
SFR_16BIT(DMA0SA);                            /* DMA Channel 0 Source Address */
1221
SFR_16BIT(DMA0DA);                            /* DMA Channel 0 Destination Address */
1222
SFR_16BIT(DMA0SZ);                            /* DMA Channel 0 Transfer Size */
1223
 
1224
/************************************************************
1225
* Interrupt Vectors (offset from 0xFFE0)
1226
************************************************************/
1227
 
1228
#define VECTOR_NAME(name)       name##_ptr
1229
#define EMIT_PRAGMA(x)          _Pragma(#x)
1230
#define CREATE_VECTOR(name)     void (* const VECTOR_NAME(name))(void) = &name
1231
#define PLACE_VECTOR(vector,section) EMIT_PRAGMA(DATA_SECTION(vector,section))
1232
#define ISR_VECTOR(func,offset) CREATE_VECTOR(func); \
1233
                                PLACE_VECTOR(VECTOR_NAME(func), offset)
1234
 
1235
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
1236
#define BASICTIMER_VECTOR       ".int00"                    /* 0xFFE0 Basic Timer */
1237
#else
1238
#define BASICTIMER_VECTOR       (0 * 1u)                     /* 0xFFE0 Basic Timer */
1239
/*#define BASICTIMER_ISR(func)    ISR_VECTOR(func, ".int00")  */ /* 0xFFE0 Basic Timer */ /* CCE V2 Style */
1240
#endif
1241
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
1242
#define PORT2_VECTOR            ".int01"                    /* 0xFFE2 Port 2 */
1243
#else
1244
#define PORT2_VECTOR            (1 * 1u)                     /* 0xFFE2 Port 2 */
1245
/*#define PORT2_ISR(func)         ISR_VECTOR(func, ".int01")  */ /* 0xFFE2 Port 2 */ /* CCE V2 Style */
1246
#endif
1247
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
1248
#define DAC12_DMA_VECTOR        ".int03"                    /* 0xFFE6 DAC 12 */
1249
#else
1250
#define DAC12_DMA_VECTOR        (3 * 1u)                     /* 0xFFE6 DAC 12 */
1251
/*#define DAC12_DMA_ISR(func)     ISR_VECTOR(func, ".int03")  */ /* 0xFFE6 DAC 12 */ /* CCE V2 Style */
1252
#endif
1253
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
1254
#define PORT1_VECTOR            ".int04"                    /* 0xFFE8 Port 1 */
1255
#else
1256
#define PORT1_VECTOR            (4 * 1u)                     /* 0xFFE8 Port 1 */
1257
/*#define PORT1_ISR(func)         ISR_VECTOR(func, ".int04")  */ /* 0xFFE8 Port 1 */ /* CCE V2 Style */
1258
#endif
1259
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
1260
#define TIMERA1_VECTOR          ".int05"                    /* 0xFFEA Timer A CC1-2, TA */
1261
#else
1262
#define TIMERA1_VECTOR          (5 * 1u)                     /* 0xFFEA Timer A CC1-2, TA */
1263
/*#define TIMERA1_ISR(func)       ISR_VECTOR(func, ".int05")  */ /* 0xFFEA Timer A CC1-2, TA */ /* CCE V2 Style */
1264
#endif
1265
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
1266
#define TIMERA0_VECTOR          ".int06"                    /* 0xFFEC Timer A CC0 */
1267
#else
1268
#define TIMERA0_VECTOR          (6 * 1u)                     /* 0xFFEC Timer A CC0 */
1269
/*#define TIMERA0_ISR(func)       ISR_VECTOR(func, ".int06")  */ /* 0xFFEC Timer A CC0 */ /* CCE V2 Style */
1270
#endif
1271
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
1272
#define ADC12_VECTOR            ".int07"                    /* 0xFFEE ADC */
1273
#else
1274
#define ADC12_VECTOR            (7 * 1u)                     /* 0xFFEE ADC */
1275
/*#define ADC12_ISR(func)         ISR_VECTOR(func, ".int07")  */ /* 0xFFEE ADC */ /* CCE V2 Style */
1276
#endif
1277
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
1278
#define USART0TX_VECTOR         ".int08"                    /* 0xFFF0 USART 0 Transmit */
1279
#else
1280
#define USART0TX_VECTOR         (8 * 1u)                     /* 0xFFF0 USART 0 Transmit */
1281
/*#define USART0TX_ISR(func)      ISR_VECTOR(func, ".int08")  */ /* 0xFFF0 USART 0 Transmit */ /* CCE V2 Style */
1282
#endif
1283
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
1284
#define USART0RX_VECTOR         ".int09"                    /* 0xFFF2 USART 0 Receive */
1285
#else
1286
#define USART0RX_VECTOR         (9 * 1u)                     /* 0xFFF2 USART 0 Receive */
1287
/*#define USART0RX_ISR(func)      ISR_VECTOR(func, ".int09")  */ /* 0xFFF2 USART 0 Receive */ /* CCE V2 Style */
1288
#endif
1289
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
1290
#define WDT_VECTOR              ".int10"                    /* 0xFFF4 Watchdog Timer */
1291
#else
1292
#define WDT_VECTOR              (10 * 1u)                    /* 0xFFF4 Watchdog Timer */
1293
/*#define WDT_ISR(func)           ISR_VECTOR(func, ".int10")  */ /* 0xFFF4 Watchdog Timer */ /* CCE V2 Style */
1294
#endif
1295
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
1296
#define COMPARATORA_VECTOR      ".int11"                    /* 0xFFF6 Comparator A */
1297
#else
1298
#define COMPARATORA_VECTOR      (11 * 1u)                    /* 0xFFF6 Comparator A */
1299
/*#define COMPARATORA_ISR(func)   ISR_VECTOR(func, ".int11")  */ /* 0xFFF6 Comparator A */ /* CCE V2 Style */
1300
#endif
1301
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
1302
#define TIMERB1_VECTOR          ".int12"                    /* 0xFFF8 Timer B CC1-2, TB */
1303
#else
1304
#define TIMERB1_VECTOR          (12 * 1u)                    /* 0xFFF8 Timer B CC1-2, TB */
1305
/*#define TIMERB1_ISR(func)       ISR_VECTOR(func, ".int12")  */ /* 0xFFF8 Timer B CC1-2, TB */ /* CCE V2 Style */
1306
#endif
1307
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
1308
#define TIMERB0_VECTOR          ".int13"                    /* 0xFFFA Timer B CC0 */
1309
#else
1310
#define TIMERB0_VECTOR          (13 * 1u)                    /* 0xFFFA Timer B CC0 */
1311
/*#define TIMERB0_ISR(func)       ISR_VECTOR(func, ".int13")  */ /* 0xFFFA Timer B CC0 */ /* CCE V2 Style */
1312
#endif
1313
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
1314
#define NMI_VECTOR              ".int14"                    /* 0xFFFC Non-maskable */
1315
#else
1316
#define NMI_VECTOR              (14 * 1u)                    /* 0xFFFC Non-maskable */
1317
/*#define NMI_ISR(func)           ISR_VECTOR(func, ".int14")  */ /* 0xFFFC Non-maskable */ /* CCE V2 Style */
1318
#endif
1319
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
1320
#define RESET_VECTOR            ".reset"                    /* 0xFFFE Reset [Highest Priority] */
1321
#else
1322
#define RESET_VECTOR            (15 * 1u)                    /* 0xFFFE Reset [Highest Priority] */
1323
/*#define RESET_ISR(func)         ISR_VECTOR(func, ".int15")  */ /* 0xFFFE Reset [Highest Priority] */ /* CCE V2 Style */
1324
#endif
1325
 
1326
 
1327
/************************************************************
1328
* End of Modules
1329
************************************************************/
1330
 
1331
#ifdef __cplusplus
1332
}
1333
#endif /* extern "C" */
1334
 
1335
#endif /* #ifndef __MSP430F438 */
1336