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
* MSP430x42x devices.
14
*
15
* Texas Instruments, Version 2.5
16
*
17
*
18
* Rev. 2.1,
19
* Rev. 2.11, Added SD16INTDLY_x definitions
20
* Rev. 2.2, Removed unused def of TASSEL2
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 __msp430x42x
28
#define __msp430x42x
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
* BASIC TIMER
217
************************************************************/
218
#define __MSP430_HAS_BT__                     /* Definition to show that Module is available */
219
 
220
SFR_8BIT(BTCTL);                              /* Basic Timer Control */
221
/* The bit names have been prefixed with "BT" */
222
#define BTIP0                  (0x01)
223
#define BTIP1                  (0x02)
224
#define BTIP2                  (0x04)
225
#define BTFRFQ0                (0x08)
226
#define BTFRFQ1                (0x10)
227
#define BTDIV                  (0x20)         /* fCLK2 = ACLK:256 */
228
#define BTHOLD                 (0x40)         /* BT1 is held if this bit is set */
229
#define BTSSEL                 (0x80)         /* fBT = fMCLK (main clock) */
230
 
231
SFR_8BIT(BTCNT1);                             /* Basic Timer Count 1 */
232
SFR_8BIT(BTCNT2);                             /* Basic Timer Count 2 */
233
 
234
/* Frequency of the BTCNT2 coded with Bit 5 and 7 in BTCTL */
235
#define BT_fCLK2_ACLK          (0x00)
236
#define BT_fCLK2_ACLK_DIV256   (BTDIV)
237
#define BT_fCLK2_MCLK          (BTSSEL)
238
 
239
/* Interrupt interval time fINT coded with Bits 0-2 in BTCTL */
240
#define BT_fCLK2_DIV2          (0x00)         /* fINT = fCLK2:2 (default) */
241
#define BT_fCLK2_DIV4          (BTIP0)        /* fINT = fCLK2:4 */
242
#define BT_fCLK2_DIV8          (BTIP1)        /* fINT = fCLK2:8 */
243
#define BT_fCLK2_DIV16         (BTIP1+BTIP0)  /* fINT = fCLK2:16 */
244
#define BT_fCLK2_DIV32         (BTIP2)        /* fINT = fCLK2:32 */
245
#define BT_fCLK2_DIV64         (BTIP2+BTIP0)  /* fINT = fCLK2:64 */
246
#define BT_fCLK2_DIV128        (BTIP2+BTIP1)  /* fINT = fCLK2:128 */
247
#define BT_fCLK2_DIV256     (BTIP2+BTIP1+BTIP0)       /* fINT = fCLK2:256 */
248
/* Frequency of LCD coded with Bits 3-4 */
249
#define BT_fLCD_DIV32          (0x00)         /* fLCD = fACLK:32 (default) */
250
#define BT_fLCD_DIV64          (BTFRFQ0)      /* fLCD = fACLK:64 */
251
#define BT_fLCD_DIV128         (BTFRFQ1)      /* fLCD = fACLK:128 */
252
#define BT_fLCD_DIV256      (BTFRFQ1+BTFRFQ0)         /* fLCD = fACLK:256 */
253
/* LCD frequency values with fBT=fACLK */
254
#define BT_fLCD_1K             (0x00)         /* fACLK:32 (default) */
255
#define BT_fLCD_512            (BTFRFQ0)      /* fACLK:64 */
256
#define BT_fLCD_256            (BTFRFQ1)      /* fACLK:128 */
257
#define BT_fLCD_128         (BTFRFQ1+BTFRFQ0)         /* fACLK:256 */
258
/* LCD frequency values with fBT=fMCLK */
259
#define BT_fLCD_31K            (BTSSEL)       /* fMCLK:32 */
260
#define BT_fLCD_15_5K       (BTSSEL+BTFRFQ0)          /* fMCLK:64 */
261
#define BT_fLCD_7_8K        (BTSSEL+BTFRFQ1+BTFRFQ0)  /* fMCLK:256 */
262
/* with assumed vlues of fACLK=32KHz, fMCLK=1MHz */
263
/* fBT=fACLK is thought for longer interval times */
264
#define BT_ADLY_0_064          (0x00)         /* 0.064ms interval (default) */
265
#define BT_ADLY_0_125          (BTIP0)        /* 0.125ms    " */
266
#define BT_ADLY_0_25           (BTIP1)        /* 0.25ms     " */
267
#define BT_ADLY_0_5            (BTIP1+BTIP0)  /* 0.5ms      " */
268
#define BT_ADLY_1              (BTIP2)        /* 1ms        " */
269
#define BT_ADLY_2              (BTIP2+BTIP0)  /* 2ms        " */
270
#define BT_ADLY_4              (BTIP2+BTIP1)  /* 4ms        " */
271
#define BT_ADLY_8           (BTIP2+BTIP1+BTIP0)       /* 8ms        " */
272
#define BT_ADLY_16             (BTDIV)        /* 16ms       " */
273
#define BT_ADLY_32             (BTDIV+BTIP0)  /* 32ms       " */
274
#define BT_ADLY_64             (BTDIV+BTIP1)  /* 64ms       " */
275
#define BT_ADLY_125         (BTDIV+BTIP1+BTIP0)       /* 125ms      " */
276
#define BT_ADLY_250            (BTDIV+BTIP2)  /* 250ms      " */
277
#define BT_ADLY_500         (BTDIV+BTIP2+BTIP0)       /* 500ms      " */
278
#define BT_ADLY_1000        (BTDIV+BTIP2+BTIP1)       /* 1000ms     " */
279
#define BT_ADLY_2000        (BTDIV+BTIP2+BTIP1+BTIP0) /* 2000ms     " */
280
/* fCLK2=fMCLK (1MHz) is thought for short interval times */
281
/* the timing for short intervals is more precise than ACLK */
282
/* NOTE */
283
/* Be sure that the SCFQCTL-Register is set to 01Fh so that fMCLK=1MHz */
284
/* Too low interval time results in interrupts too frequent for the processor to handle! */
285
#define BT_MDLY_0_002          (BTSSEL)       /* 0.002ms interval       *** interval times */
286
#define BT_MDLY_0_004          (BTSSEL+BTIP0) /* 0.004ms    "           *** too short for */
287
#define BT_MDLY_0_008          (BTSSEL+BTIP1) /* 0.008ms    "           *** interrupt */
288
#define BT_MDLY_0_016       (BTSSEL+BTIP1+BTIP0)      /* 0.016ms    "           *** handling */
289
#define BT_MDLY_0_032          (BTSSEL+BTIP2) /* 0.032ms    " */
290
#define BT_MDLY_0_064       (BTSSEL+BTIP2+BTIP0)      /* 0.064ms    " */
291
#define BT_MDLY_0_125       (BTSSEL+BTIP2+BTIP1)      /* 0.125ms    " */
292
#define BT_MDLY_0_25        (BTSSEL+BTIP2+BTIP1+BTIP0)/* 0.25ms     " */
293
 
294
/* Reset/Hold coded with Bits 6-7 in BT(1)CTL */
295
/* this is for BT */
296
//#define BTRESET_CNT1        (BTRESET)           /* BTCNT1 is reset while BTRESET is set */
297
//#define BTRESET_CNT1_2      (BTRESET+BTDIV)     /* BTCNT1 .AND. BTCNT2 are reset while ~ is set */
298
/* this is for BT1 */
299
#define BTHOLD_CNT1            (BTHOLD)       /* BTCNT1 is held while BTHOLD is set */
300
#define BTHOLD_CNT1_2          (BTHOLD+BTDIV) /* BT1CNT1 .AND. BT1CNT2 are held while ~ is set */
301
 
302
/* INTERRUPT CONTROL BITS */
303
/* #define BTIE                0x80 */
304
/* #define BTIFG               0x80 */
305
 
306
/************************************************************
307
* SYSTEM CLOCK, FLL+ (x41x)
308
************************************************************/
309
#define __MSP430_HAS_FLLPLUS_SMALL__                /* Definition to show that Module is available */
310
 
311
SFR_8BIT(SCFI0);                              /* System Clock Frequency Integrator 0 */
312
#define FN_2                   (0x04)         /* fDCOCLK =   1.4-12MHz*/
313
#define FN_3                   (0x08)         /* fDCOCLK =   2.2-17Mhz*/
314
#define FN_4                   (0x10)         /* fDCOCLK =   3.2-25Mhz*/
315
#define FN_8                   (0x20)         /* fDCOCLK =     5-40Mhz*/
316
#define FLLD0                  (0x40)         /* Loop Divider Bit : 0 */
317
#define FLLD1                  (0x80)         /* Loop Divider Bit : 1 */
318
 
319
#define FLLD_1                 (0x00)         /* Multiply Selected Loop Freq. By 1 */
320
#define FLLD_2                 (0x40)         /* Multiply Selected Loop Freq. By 2 */
321
#define FLLD_4                 (0x80)         /* Multiply Selected Loop Freq. By 4 */
322
#define FLLD_8                 (0xC0)         /* Multiply Selected Loop Freq. By 8 */
323
 
324
SFR_8BIT(SCFI1);                              /* System Clock Frequency Integrator 1 */
325
SFR_8BIT(SCFQCTL);                            /* System Clock Frequency Control */
326
/* System clock frequency values fMCLK coded with Bits 0-6 in SCFQCTL */
327
/* #define SCFQ_32K            0x00                        fMCLK=1*fACLK       only a range from */
328
#define SCFQ_64K               (0x01)         /* fMCLK=2*fACLK          1+1 to 127+1 is possible */
329
#define SCFQ_128K              (0x03)         /* fMCLK=4*fACLK */
330
#define SCFQ_256K              (0x07)         /* fMCLK=8*fACLK */
331
#define SCFQ_512K              (0x0F)         /* fMCLK=16*fACLK */
332
#define SCFQ_1M                (0x1F)         /* fMCLK=32*fACLK */
333
#define SCFQ_2M                (0x3F)         /* fMCLK=64*fACLK */
334
#define SCFQ_4M                (0x7F)         /* fMCLK=128*fACLK */
335
#define SCFQ_M                 (0x80)         /* Modulation Disable */
336
 
337
SFR_8BIT(FLL_CTL0);                           /* FLL+ Control 0 */
338
#define DCOF                   (0x01)         /* DCO Fault Flag */
339
#define LFOF                   (0x02)         /* Low Frequency Oscillator Fault Flag */
340
#define XT1OF                  (0x04)         /* High Frequency Oscillator Fault Flag */
341
#define OSCCAP0                (0x10)         /* XIN/XOUT Cap 0 */
342
#define OSCCAP1                (0x20)         /* XIN/XOUT Cap 1 */
343
#define XTS_FLL                (0x40)         /* 1: Selects high-freq. oscillator */
344
#define DCOPLUS                (0x80)         /* DCO+ Enable */
345
 
346
#define XCAP0PF                (0x00)         /* XIN Cap = XOUT Cap = 0pf */
347
#define XCAP10PF               (0x10)         /* XIN Cap = XOUT Cap = 10pf */
348
#define XCAP14PF               (0x20)         /* XIN Cap = XOUT Cap = 14pf */
349
#define XCAP18PF               (0x30)         /* XIN Cap = XOUT Cap = 18pf */
350
#define OSCCAP_0               (0x00)         /* XIN Cap = XOUT Cap = 0pf */
351
#define OSCCAP_1               (0x10)         /* XIN Cap = XOUT Cap = 10pf */
352
#define OSCCAP_2               (0x20)         /* XIN Cap = XOUT Cap = 14pf */
353
#define OSCCAP_3               (0x30)         /* XIN Cap = XOUT Cap = 18pf */
354
 
355
SFR_8BIT(FLL_CTL1);                           /* FLL+ Control 1 */
356
#define FLL_DIV0               (0x01)         /* FLL+ Divide Px.x/ACLK 0 */
357
#define FLL_DIV1               (0x02)         /* FLL+ Divide Px.x/ACLK 1 */
358
 
359
#define FLL_DIV_1              (0x00)         /* FLL+ Divide Px.x/ACLK By 1 */
360
#define FLL_DIV_2              (0x01)         /* FLL+ Divide Px.x/ACLK By 2 */
361
#define FLL_DIV_4              (0x02)         /* FLL+ Divide Px.x/ACLK By 4 */
362
#define FLL_DIV_8              (0x03)         /* FLL+ Divide Px.x/ACLK By 8 */
363
 
364
/* INTERRUPT CONTROL BITS */
365
/* These two bits are defined in the Special Function Registers */
366
/* #define OFIFG               0x02 */
367
/* #define OFIE                0x02 */
368
 
369
/************************************************************
370
* Brown-Out, Supply Voltage Supervision (SVS)
371
************************************************************/
372
#define __MSP430_HAS_SVS__                    /* Definition to show that Module is available */
373
 
374
SFR_8BIT(SVSCTL);                             /* SVS Control */
375
#define SVSFG                  (0x01)         /* SVS Flag */
376
#define SVSOP                  (0x02)         /* SVS output (read only) */
377
#define SVSON                  (0x04)         /* Switches the SVS on/off */
378
#define PORON                  (0x08)         /* Enable POR Generation if Low Voltage */
379
#define VLD0                   (0x10)
380
#define VLD1                   (0x20)
381
#define VLD2                   (0x40)
382
#define VLD3                   (0x80)
383
 
384
#define VLDON                  (0x10)
385
#define VLDOFF                 (0x00)
386
#define VLD_1_8V               (0x10)
387
 
388
/************************************************************
389
* LCD
390
************************************************************/
391
#define __MSP430_HAS_LCD4__                   /* Definition to show that Module is available */
392
 
393
SFR_8BIT(LCDCTL);                             /* LCD Control */
394
/* the names of the mode bits are different from the spec */
395
#define LCDON                  (0x01)
396
//#define LCDLOWR             (0x02)
397
#define LCDSON                 (0x04)
398
#define LCDMX0                 (0x08)
399
#define LCDMX1                 (0x10)
400
#define LCDP0                  (0x20)
401
#define LCDP1                  (0x40)
402
#define LCDP2                  (0x80)
403
/* Display modes coded with Bits 2-4 */
404
#define LCDSTATIC              (LCDSON)
405
#define LCD2MUX                (LCDMX0+LCDSON)
406
#define LCD3MUX                (LCDMX1+LCDSON)
407
#define LCD4MUX                (LCDMX1+LCDMX0+LCDSON)
408
/* Group select code with Bits 5-7                     Seg.lines   Dig.output */
409
#define LCDSG0                 (0x00)         /* ---------   Port Only (default) */
410
#define LCDSG0_1               (LCDP0)        /* S0  - S15   see Datasheet */
411
#define LCDSG0_2               (LCDP1)        /* S0  - S19   see Datasheet */
412
#define LCDSG0_3               (LCDP1+LCDP0)  /* S0  - S23   see Datasheet */
413
#define LCDSG0_4               (LCDP2)        /* S0  - S27   see Datasheet */
414
#define LCDSG0_5               (LCDP2+LCDP0)  /* S0  - S31   see Datasheet */
415
#define LCDSG0_6               (LCDP2+LCDP1)  /* S0  - S35   see Datasheet */
416
#define LCDSG0_7            (LCDP2+LCDP1+LCDP0)       /* S0  - S39   see Datasheet */
417
/* NOTE: YOU CAN ONLY USE THE 'S' OR 'G' DECLARATIONS FOR A COMMAND */
418
/* MOV  #LCDSG0_3+LCDOG2_7,&LCDCTL ACTUALY MEANS MOV  #LCDP1,&LCDCTL! */
419
#define LCDOG1_7               (0x00)         /* ---------   Port Only (default) */
420
#define LCDOG2_7               (LCDP0)        /* S0  - S15   see Datasheet */
421
#define LCDOG3_7               (LCDP1)        /* S0  - S19   see Datasheet */
422
#define LCDOG4_7               (LCDP1+LCDP0)  /* S0  - S23   see Datasheet */
423
#define LCDOG5_7               (LCDP2)        /* S0  - S27   see Datasheet */
424
#define LCDOG6_7               (LCDP2+LCDP0)  /* S0  - S31   see Datasheet */
425
#define LCDOG7                 (LCDP2+LCDP1)  /* S0  - S35   see Datasheet */
426
#define LCDOGOFF            (LCDP2+LCDP1+LCDP0)       /* S0  - S39   see Datasheet */
427
 
428
#define LCDMEM_                (0x0091)       /* LCD Memory */
429
#ifdef __ASM_HEADER__
430
#define LCDMEM                 (LCDMEM_)      /* LCD Memory (for assembler) */
431
#else
432
#define LCDMEM                 ((char*)       LCDMEM_) /* LCD Memory (for C) */
433
#endif
434
SFR_8BIT(LCDM1);                              /* LCD Memory 1 */
435
SFR_8BIT(LCDM2);                              /* LCD Memory 2 */
436
SFR_8BIT(LCDM3);                              /* LCD Memory 3 */
437
SFR_8BIT(LCDM4);                              /* LCD Memory 4 */
438
SFR_8BIT(LCDM5);                              /* LCD Memory 5 */
439
SFR_8BIT(LCDM6);                              /* LCD Memory 6 */
440
SFR_8BIT(LCDM7);                              /* LCD Memory 7 */
441
SFR_8BIT(LCDM8);                              /* LCD Memory 8 */
442
SFR_8BIT(LCDM9);                              /* LCD Memory 9 */
443
SFR_8BIT(LCDM10);                             /* LCD Memory 10 */
444
SFR_8BIT(LCDM11);                             /* LCD Memory 11 */
445
SFR_8BIT(LCDM12);                             /* LCD Memory 12 */
446
SFR_8BIT(LCDM13);                             /* LCD Memory 13 */
447
SFR_8BIT(LCDM14);                             /* LCD Memory 14 */
448
SFR_8BIT(LCDM15);                             /* LCD Memory 15 */
449
SFR_8BIT(LCDM16);                             /* LCD Memory 16 */
450
SFR_8BIT(LCDM17);                             /* LCD Memory 17 */
451
SFR_8BIT(LCDM18);                             /* LCD Memory 18 */
452
SFR_8BIT(LCDM19);                             /* LCD Memory 19 */
453
SFR_8BIT(LCDM20);                             /* LCD Memory 20 */
454
 
455
#define LCDMA                  (LCDM10)       /* LCD Memory A */
456
#define LCDMB                  (LCDM11)       /* LCD Memory B */
457
#define LCDMC                  (LCDM12)       /* LCD Memory C */
458
#define LCDMD                  (LCDM13)       /* LCD Memory D */
459
#define LCDME                  (LCDM14)       /* LCD Memory E */
460
#define LCDMF                  (LCDM15)       /* LCD Memory F */
461
 
462
/************************************************************
463
* USART
464
************************************************************/
465
 
466
/* UxCTL */
467
#define PENA                   (0x80)         /* Parity enable */
468
#define PEV                    (0x40)         /* Parity 0:odd / 1:even */
469
#define SPB                    (0x20)         /* Stop Bits 0:one / 1: two */
470
#define CHAR                   (0x10)         /* Data 0:7-bits / 1:8-bits */
471
#define LISTEN                 (0x08)         /* Listen mode */
472
#define SYNC                   (0x04)         /* UART / SPI mode */
473
#define MM                     (0x02)         /* Master Mode off/on */
474
#define SWRST                  (0x01)         /* USART Software Reset */
475
 
476
/* UxTCTL */
477
#define CKPH                   (0x80)         /* SPI: Clock Phase */
478
#define CKPL                   (0x40)         /* Clock Polarity */
479
#define SSEL1                  (0x20)         /* Clock Source Select 1 */
480
#define SSEL0                  (0x10)         /* Clock Source Select 0 */
481
#define URXSE                  (0x08)         /* Receive Start edge select */
482
#define TXWAKE                 (0x04)         /* TX Wake up mode */
483
#define STC                    (0x02)         /* SPI: STC enable 0:on / 1:off */
484
#define TXEPT                  (0x01)         /* TX Buffer empty */
485
 
486
/* UxRCTL */
487
#define FE                     (0x80)         /* Frame Error */
488
#define PE                     (0x40)         /* Parity Error */
489
#define OE                     (0x20)         /* Overrun Error */
490
#define BRK                    (0x10)         /* Break detected */
491
#define URXEIE                 (0x08)         /* RX Error interrupt enable */
492
#define URXWIE                 (0x04)         /* RX Wake up interrupt enable */
493
#define RXWAKE                 (0x02)         /* RX Wake up detect */
494
#define RXERR                  (0x01)         /* RX Error Error */
495
 
496
/************************************************************
497
* USART 0
498
************************************************************/
499
#define __MSP430_HAS_UART0__                  /* Definition to show that Module is available */
500
 
501
SFR_8BIT(U0CTL);                              /* USART 0 Control */
502
SFR_8BIT(U0TCTL);                             /* USART 0 Transmit Control */
503
SFR_8BIT(U0RCTL);                             /* USART 0 Receive Control */
504
SFR_8BIT(U0MCTL);                             /* USART 0 Modulation Control */
505
SFR_8BIT(U0BR0);                              /* USART 0 Baud Rate 0 */
506
SFR_8BIT(U0BR1);                              /* USART 0 Baud Rate 1 */
507
SFR_8BIT(U0RXBUF);                            /* USART 0 Receive Buffer */
508
SFR_8BIT(U0TXBUF);                            /* USART 0 Transmit Buffer */
509
 
510
/* Alternate register names */
511
 
512
#define UCTL0                  U0CTL          /* USART 0 Control */
513
#define UTCTL0                 U0TCTL         /* USART 0 Transmit Control */
514
#define URCTL0                 U0RCTL         /* USART 0 Receive Control */
515
#define UMCTL0                 U0MCTL         /* USART 0 Modulation Control */
516
#define UBR00                  U0BR0          /* USART 0 Baud Rate 0 */
517
#define UBR10                  U0BR1          /* USART 0 Baud Rate 1 */
518
#define RXBUF0                 U0RXBUF        /* USART 0 Receive Buffer */
519
#define TXBUF0                 U0TXBUF        /* USART 0 Transmit Buffer */
520
#define UCTL0_                 U0CTL_         /* USART 0 Control */
521
#define UTCTL0_                U0TCTL_        /* USART 0 Transmit Control */
522
#define URCTL0_                U0RCTL_        /* USART 0 Receive Control */
523
#define UMCTL0_                U0MCTL_        /* USART 0 Modulation Control */
524
#define UBR00_                 U0BR0_         /* USART 0 Baud Rate 0 */
525
#define UBR10_                 U0BR1_         /* USART 0 Baud Rate 1 */
526
#define RXBUF0_                U0RXBUF_       /* USART 0 Receive Buffer */
527
#define TXBUF0_                U0TXBUF_       /* USART 0 Transmit Buffer */
528
#define UCTL_0                 U0CTL          /* USART 0 Control */
529
#define UTCTL_0                U0TCTL         /* USART 0 Transmit Control */
530
#define URCTL_0                U0RCTL         /* USART 0 Receive Control */
531
#define UMCTL_0                U0MCTL         /* USART 0 Modulation Control */
532
#define UBR0_0                 U0BR0          /* USART 0 Baud Rate 0 */
533
#define UBR1_0                 U0BR1          /* USART 0 Baud Rate 1 */
534
#define RXBUF_0                U0RXBUF        /* USART 0 Receive Buffer */
535
#define TXBUF_0                U0TXBUF        /* USART 0 Transmit Buffer */
536
#define UCTL_0_                U0CTL_         /* USART 0 Control */
537
#define UTCTL_0_               U0TCTL_        /* USART 0 Transmit Control */
538
#define URCTL_0_               U0RCTL_        /* USART 0 Receive Control */
539
#define UMCTL_0_               U0MCTL_        /* USART 0 Modulation Control */
540
#define UBR0_0_                U0BR0_         /* USART 0 Baud Rate 0 */
541
#define UBR1_0_                U0BR1_         /* USART 0 Baud Rate 1 */
542
#define RXBUF_0_               U0RXBUF_       /* USART 0 Receive Buffer */
543
#define TXBUF_0_               U0TXBUF_       /* USART 0 Transmit Buffer */
544
 
545
/************************************************************
546
* Timer A3
547
************************************************************/
548
#define __MSP430_HAS_TA3__                    /* Definition to show that Module is available */
549
 
550
SFR_16BIT(TAIV);                              /* Timer A Interrupt Vector Word */
551
SFR_16BIT(TACTL);                             /* Timer A Control */
552
SFR_16BIT(TACCTL0);                           /* Timer A Capture/Compare Control 0 */
553
SFR_16BIT(TACCTL1);                           /* Timer A Capture/Compare Control 1 */
554
SFR_16BIT(TACCTL2);                           /* Timer A Capture/Compare Control 2 */
555
SFR_16BIT(TAR);                               /* Timer A Counter Register */
556
SFR_16BIT(TACCR0);                            /* Timer A Capture/Compare 0 */
557
SFR_16BIT(TACCR1);                            /* Timer A Capture/Compare 1 */
558
SFR_16BIT(TACCR2);                            /* Timer A Capture/Compare 2 */
559
 
560
/* Alternate register names */
561
#define CCTL0                  TACCTL0        /* Timer A Capture/Compare Control 0 */
562
#define CCTL1                  TACCTL1        /* Timer A Capture/Compare Control 1 */
563
#define CCTL2                  TACCTL2        /* Timer A Capture/Compare Control 2 */
564
#define CCR0                   TACCR0         /* Timer A Capture/Compare 0 */
565
#define CCR1                   TACCR1         /* Timer A Capture/Compare 1 */
566
#define CCR2                   TACCR2         /* Timer A Capture/Compare 2 */
567
#define CCTL0_                 TACCTL0_       /* Timer A Capture/Compare Control 0 */
568
#define CCTL1_                 TACCTL1_       /* Timer A Capture/Compare Control 1 */
569
#define CCTL2_                 TACCTL2_       /* Timer A Capture/Compare Control 2 */
570
#define CCR0_                  TACCR0_        /* Timer A Capture/Compare 0 */
571
#define CCR1_                  TACCR1_        /* Timer A Capture/Compare 1 */
572
#define CCR2_                  TACCR2_        /* Timer A Capture/Compare 2 */
573
/* Alternate register names - 5xx style */
574
#define TA0IV                  TAIV           /* Timer A Interrupt Vector Word */
575
#define TA0CTL                 TACTL          /* Timer A Control */
576
#define TA0CCTL0               TACCTL0        /* Timer A Capture/Compare Control 0 */
577
#define TA0CCTL1               TACCTL1        /* Timer A Capture/Compare Control 1 */
578
#define TA0CCTL2               TACCTL2        /* Timer A Capture/Compare Control 2 */
579
#define TA0R                   TAR            /* Timer A Counter Register */
580
#define TA0CCR0                TACCR0         /* Timer A Capture/Compare 0 */
581
#define TA0CCR1                TACCR1         /* Timer A Capture/Compare 1 */
582
#define TA0CCR2                TACCR2         /* Timer A Capture/Compare 2 */
583
#define TA0IV_                 TAIV_          /* Timer A Interrupt Vector Word */
584
#define TA0CTL_                TACTL_         /* Timer A Control */
585
#define TA0CCTL0_              TACCTL0_       /* Timer A Capture/Compare Control 0 */
586
#define TA0CCTL1_              TACCTL1_       /* Timer A Capture/Compare Control 1 */
587
#define TA0CCTL2_              TACCTL2_       /* Timer A Capture/Compare Control 2 */
588
#define TA0R_                  TAR_           /* Timer A Counter Register */
589
#define TA0CCR0_               TACCR0_        /* Timer A Capture/Compare 0 */
590
#define TA0CCR1_               TACCR1_        /* Timer A Capture/Compare 1 */
591
#define TA0CCR2_               TACCR2_        /* Timer A Capture/Compare 2 */
592
 
593
#define TASSEL1                (0x0200)       /* Timer A clock source select 0 */
594
#define TASSEL0                (0x0100)       /* Timer A clock source select 1 */
595
#define ID1                    (0x0080)       /* Timer A clock input divider 1 */
596
#define ID0                    (0x0040)       /* Timer A clock input divider 0 */
597
#define MC1                    (0x0020)       /* Timer A mode control 1 */
598
#define MC0                    (0x0010)       /* Timer A mode control 0 */
599
#define TACLR                  (0x0004)       /* Timer A counter clear */
600
#define TAIE                   (0x0002)       /* Timer A counter interrupt enable */
601
#define TAIFG                  (0x0001)       /* Timer A counter interrupt flag */
602
 
603
#define MC_0                   (0*0x10u)      /* Timer A mode control: 0 - Stop */
604
#define MC_1                   (1*0x10u)      /* Timer A mode control: 1 - Up to CCR0 */
605
#define MC_2                   (2*0x10u)      /* Timer A mode control: 2 - Continous up */
606
#define MC_3                   (3*0x10u)      /* Timer A mode control: 3 - Up/Down */
607
#define ID_0                   (0*0x40u)      /* Timer A input divider: 0 - /1 */
608
#define ID_1                   (1*0x40u)      /* Timer A input divider: 1 - /2 */
609
#define ID_2                   (2*0x40u)      /* Timer A input divider: 2 - /4 */
610
#define ID_3                   (3*0x40u)      /* Timer A input divider: 3 - /8 */
611
#define TASSEL_0               (0*0x100u)     /* Timer A clock source select: 0 - TACLK */
612
#define TASSEL_1               (1*0x100u)     /* Timer A clock source select: 1 - ACLK  */
613
#define TASSEL_2               (2*0x100u)     /* Timer A clock source select: 2 - SMCLK */
614
#define TASSEL_3               (3*0x100u)     /* Timer A clock source select: 3 - INCLK */
615
 
616
#define CM1                    (0x8000)       /* Capture mode 1 */
617
#define CM0                    (0x4000)       /* Capture mode 0 */
618
#define CCIS1                  (0x2000)       /* Capture input select 1 */
619
#define CCIS0                  (0x1000)       /* Capture input select 0 */
620
#define SCS                    (0x0800)       /* Capture sychronize */
621
#define SCCI                   (0x0400)       /* Latched capture signal (read) */
622
#define CAP                    (0x0100)       /* Capture mode: 1 /Compare mode : 0 */
623
#define OUTMOD2                (0x0080)       /* Output mode 2 */
624
#define OUTMOD1                (0x0040)       /* Output mode 1 */
625
#define OUTMOD0                (0x0020)       /* Output mode 0 */
626
#define CCIE                   (0x0010)       /* Capture/compare interrupt enable */
627
#define CCI                    (0x0008)       /* Capture input signal (read) */
628
#define OUT                    (0x0004)       /* PWM Output signal if output mode 0 */
629
#define COV                    (0x0002)       /* Capture/compare overflow flag */
630
#define CCIFG                  (0x0001)       /* Capture/compare interrupt flag */
631
 
632
#define OUTMOD_0               (0*0x20u)      /* PWM output mode: 0 - output only */
633
#define OUTMOD_1               (1*0x20u)      /* PWM output mode: 1 - set */
634
#define OUTMOD_2               (2*0x20u)      /* PWM output mode: 2 - PWM toggle/reset */
635
#define OUTMOD_3               (3*0x20u)      /* PWM output mode: 3 - PWM set/reset */
636
#define OUTMOD_4               (4*0x20u)      /* PWM output mode: 4 - toggle */
637
#define OUTMOD_5               (5*0x20u)      /* PWM output mode: 5 - Reset */
638
#define OUTMOD_6               (6*0x20u)      /* PWM output mode: 6 - PWM toggle/set */
639
#define OUTMOD_7               (7*0x20u)      /* PWM output mode: 7 - PWM reset/set */
640
#define CCIS_0                 (0*0x1000u)    /* Capture input select: 0 - CCIxA */
641
#define CCIS_1                 (1*0x1000u)    /* Capture input select: 1 - CCIxB */
642
#define CCIS_2                 (2*0x1000u)    /* Capture input select: 2 - GND */
643
#define CCIS_3                 (3*0x1000u)    /* Capture input select: 3 - Vcc */
644
#define CM_0                   (0*0x4000u)    /* Capture mode: 0 - disabled */
645
#define CM_1                   (1*0x4000u)    /* Capture mode: 1 - pos. edge */
646
#define CM_2                   (2*0x4000u)    /* Capture mode: 1 - neg. edge */
647
#define CM_3                   (3*0x4000u)    /* Capture mode: 1 - both edges */
648
 
649
/* TA3IV Definitions */
650
#define TAIV_NONE              (0x0000)       /* No Interrupt pending */
651
#define TAIV_TACCR1            (0x0002)       /* TACCR1_CCIFG */
652
#define TAIV_TACCR2            (0x0004)       /* TACCR2_CCIFG */
653
#define TAIV_6                 (0x0006)       /* Reserved */
654
#define TAIV_8                 (0x0008)       /* Reserved */
655
#define TAIV_TAIFG             (0x000A)       /* TAIFG */
656
 
657
/*************************************************************
658
* Flash Memory
659
*************************************************************/
660
#define __MSP430_HAS_FLASH__                  /* Definition to show that Module is available */
661
 
662
SFR_16BIT(FCTL1);                             /* FLASH Control 1 */
663
SFR_16BIT(FCTL2);                             /* FLASH Control 2 */
664
SFR_16BIT(FCTL3);                             /* FLASH Control 3 */
665
 
666
#define FRKEY                  (0x9600)       /* Flash key returned by read */
667
#define FWKEY                  (0xA500)       /* Flash key for write */
668
#define FXKEY                  (0x3300)       /* for use with XOR instruction */
669
 
670
#define ERASE                  (0x0002)       /* Enable bit for Flash segment erase */
671
#define MERAS                  (0x0004)       /* Enable bit for Flash mass erase */
672
#define WRT                    (0x0040)       /* Enable bit for Flash write */
673
#define BLKWRT                 (0x0080)       /* Enable bit for Flash segment write */
674
#define SEGWRT                 (0x0080)       /* old definition */ /* Enable bit for Flash segment write */
675
 
676
#define FN0                    (0x0001)       /* Divide Flash clock by 1 to 64 using FN0 to FN5 according to: */
677
#define FN1                    (0x0002)       /*  32*FN5 + 16*FN4 + 8*FN3 + 4*FN2 + 2*FN1 + FN0 + 1 */
678
#ifndef FN2
679
#define FN2                    (0x0004)
680
#endif
681
#ifndef FN3
682
#define FN3                    (0x0008)
683
#endif
684
#ifndef FN4
685
#define FN4                    (0x0010)
686
#endif
687
#define FN5                    (0x0020)
688
#define FSSEL0                 (0x0040)       /* Flash clock select 0 */        /* to distinguish from USART SSELx */
689
#define FSSEL1                 (0x0080)       /* Flash clock select 1 */
690
 
691
#define FSSEL_0                (0x0000)       /* Flash clock select: 0 - ACLK */
692
#define FSSEL_1                (0x0040)       /* Flash clock select: 1 - MCLK */
693
#define FSSEL_2                (0x0080)       /* Flash clock select: 2 - SMCLK */
694
#define FSSEL_3                (0x00C0)       /* Flash clock select: 3 - SMCLK */
695
 
696
#define BUSY                   (0x0001)       /* Flash busy: 1 */
697
#define KEYV                   (0x0002)       /* Flash Key violation flag */
698
#define ACCVIFG                (0x0004)       /* Flash Access violation flag */
699
#define WAIT                   (0x0008)       /* Wait flag for segment write */
700
#define LOCK                   (0x0010)       /* Lock bit: 1 - Flash is locked (read only) */
701
#define EMEX                   (0x0020)       /* Flash Emergency Exit */
702
 
703
/************************************************************
704
* HARDWARE MULTIPLIER
705
************************************************************/
706
#define __MSP430_HAS_MPY__                    /* Definition to show that Module is available */
707
 
708
SFR_16BIT(MPY);                               /* Multiply Unsigned/Operand 1 */
709
SFR_16BIT(MPYS);                              /* Multiply Signed/Operand 1 */
710
SFR_16BIT(MAC);                               /* Multiply Unsigned and Accumulate/Operand 1 */
711
SFR_16BIT(MACS);                              /* Multiply Signed and Accumulate/Operand 1 */
712
SFR_16BIT(OP2);                               /* Operand 2 */
713
SFR_16BIT(RESLO);                             /* Result Low Word */
714
SFR_16BIT(RESHI);                             /* Result High Word */
715
SFR_16BIT(SUMEXT);                            /* Sum Extend */
716
 
717
/************************************************************
718
* SD16 - Sigma Delta 16 Bit
719
************************************************************/
720
#define __MSP430_HAS_SD16_3__                 /* Definition to show that Module is available */
721
 
722
SFR_8BIT(SD16INCTL0);                         /* SD16 Input Control Register Channel 0 */
723
SFR_8BIT(SD16INCTL1);                         /* SD16 Input Control Register Channel 1 */
724
SFR_8BIT(SD16INCTL2);                         /* SD16 Input Control Register Channel 2 */
725
SFR_8BIT(SD16PRE0);                           /* SD16 Preload Register Channel 0 */
726
SFR_8BIT(SD16PRE1);                           /* SD16 Preload Register Channel 1 */
727
SFR_8BIT(SD16PRE2);                           /* SD16 Preload Register Channel 2 */
728
SFR_8BIT(SD16CONF0);                          /* SD16 Internal Configuration Register 0 */
729
SFR_8BIT(SD16CONF1);                          /* SD16 Internal Configuration Register 1 */
730
                                      /* Please use only the recommended settings */
731
 
732
SFR_16BIT(SD16CTL);                           /* Sigma Delta ADC 16 Control Register */
733
SFR_16BIT(SD16CCTL0);                         /* SD16 Channel 0 Control Register */
734
SFR_16BIT(SD16CCTL1);                         /* SD16 Channel 1 Control Register */
735
SFR_16BIT(SD16CCTL2);                         /* SD16 Channel 2 Control Register */
736
SFR_16BIT(SD16IV);                            /* SD16 Interrupt Vector Register */
737
SFR_16BIT(SD16MEM0);                          /* SD16 Channel 0 Conversion Memory */
738
SFR_16BIT(SD16MEM1);                          /* SD16 Channel 1 Conversion Memory */
739
SFR_16BIT(SD16MEM2);                          /* SD16 Channel 2 Conversion Memory */
740
 
741
/* SD16INCTLx - AFEINCTLx */
742
#define SD16INCH0              (0x0001)       /* SD16 Input Channel select 0 */
743
#define SD16INCH1              (0x0002)       /* SD16 Input Channel select 1 */
744
#define SD16INCH2              (0x0004)       /* SD16 Input Channel select 2 */
745
#define SD16GAIN0              (0x0008)       /* SD16 Input Pre-Amplifier Gain Select 0 */
746
#define SD16GAIN1              (0x0010)       /* SD16 Input Pre-Amplifier Gain Select 1 */
747
#define SD16GAIN2              (0x0020)       /* SD16 Input Pre-Amplifier Gain Select 2 */
748
#define SD16INTDLY0            (0x0040)       /* SD16 Interrupt Delay after 1.Conversion 0 */
749
#define SD16INTDLY1            (0x0080)       /* SD16 Interrupt Delay after 1.Conversion 1 */
750
 
751
#define SD16GAIN_1             (0x0000)       /* SD16 Input Pre-Amplifier Gain Select *1  */
752
#define SD16GAIN_2             (0x0008)       /* SD16 Input Pre-Amplifier Gain Select *2  */
753
#define SD16GAIN_4             (0x0010)       /* SD16 Input Pre-Amplifier Gain Select *4  */
754
#define SD16GAIN_8             (0x0018)       /* SD16 Input Pre-Amplifier Gain Select *8  */
755
#define SD16GAIN_16            (0x0020)       /* SD16 Input Pre-Amplifier Gain Select *16 */
756
#define SD16GAIN_32            (0x0028)       /* SD16 Input Pre-Amplifier Gain Select *32 */
757
 
758
#define SD16INCH_0             (0x0000)       /* SD16 Input Channel select input */
759
#define SD16INCH_1             (0x0001)       /* SD16 Input Channel select input */
760
#define SD16INCH_2             (0x0002)       /* SD16 Input Channel select input */
761
#define SD16INCH_3             (0x0003)       /* SD16 Input Channel select input */
762
#define SD16INCH_4             (0x0004)       /* SD16 Input Channel select input */
763
#define SD16INCH_5             (0x0005)       /* SD16 Input Channel select input */
764
#define SD16INCH_6             (0x0006)       /* SD16 Input Channel select Temp */
765
#define SD16INCH_7             (0x0007)       /* SD16 Input Channel select Offset */
766
 
767
#define SD16INTDLY_0           (0x0000)       /* SD16 Interrupt Delay: Int. after 4.Conversion  */
768
#define SD16INTDLY_1           (0x0040)       /* SD16 Interrupt Delay: Int. after 3.Conversion  */
769
#define SD16INTDLY_2           (0x0080)       /* SD16 Interrupt Delay: Int. after 2.Conversion  */
770
#define SD16INTDLY_3           (0x00C0)       /* SD16 Interrupt Delay: Int. after 1.Conversion  */
771
 
772
/* SD16CTL - AFECTL */
773
#define SD16OVIE               (0x0002)       /* SD16 Overflow Interupt Enable */
774
#define SD16REFON              (0x0004)       /* SD16 Switch internal Reference on */
775
#define SD16VMIDON             (0x0008)       /* SD16 Switch Vmid Buffer on */
776
#define SD16SSEL0              (0x0010)       /* SD16 Clock Source Select 0 */
777
#define SD16SSEL1              (0x0020)       /* SD16 Clock Source Select 1 */
778
#define SD16DIV0               (0x0040)       /* SD16 Clock Divider Select 0 */
779
#define SD16DIV1               (0x0080)       /* SD16 Clock Divider Select 1 */
780
#define SD16LP                 (0x0100)       /* SD16 Low Power Mode Enable */
781
 
782
#define SD16DIV_0              (0x0000)       /* SD16 Clock Divider Select /1 */
783
#define SD16DIV_1              (SD16DIV0)     /* SD16 Clock Divider Select /2 */
784
#define SD16DIV_2              (SD16DIV1)     /* SD16 Clock Divider Select /4 */
785
#define SD16DIV_3            (SD16DIV0+SD16DIV1)    /* SD16 Clock Divider Select /8 */
786
 
787
#define SD16SSEL_0             (0x0000)       /* SD16 Clock Source Select MCLK  */
788
#define SD16SSEL_1             (SD16SSEL0)    /* SD16 Clock Source Select SMCLK */
789
#define SD16SSEL_2             (SD16SSEL1)    /* SD16 Clock Source Select ACLK  */
790
#define SD16SSEL_3           (SD16SSEL0+SD16SSEL1)  /* SD16 Clock Source Select TACLK */
791
 
792
/* SD16CCTLx - AFECCTLx */
793
#define SD16GRP                (0x0001)       /* SD16 Grouping of Channels: 0:Off/1:On */
794
#define SD16SC                 (0x0002)       /* SD16 Start Conversion */
795
#define SD16IFG                (0x0004)       /* SD16 Channel x Interrupt Flag */
796
#define SD16IE                 (0x0008)       /* SD16 Channel x Interrupt Enable */
797
#define SD16DF                 (0x0010)       /* SD16 Channel x Data Format: 0:Unipolar/1:Bipolar */
798
#define SD16OVIFG              (0x0020)       /* SD16 Channel x Overflow Interrupt Flag */
799
#define SD16LSBACC             (0x0040)       /* SD16 Channel x Access LSB of ADC */
800
#define SD16LSBTOG             (0x0080)       /* SD16 Channel x Toggle LSB Output of ADC */
801
#define SD16OSR0               (0x0100)       /* SD16 Channel x OverSampling Ratio 0 */
802
#define SD16OSR1               (0x0200)       /* SD16 Channel x OverSampling Ratio 1 */
803
#define SD16SNGL               (0x0400)       /* SD16 Channel x Single Conversion On/Off */
804
 
805
#define SD16OSR_256            (0x0000)       /* SD16 Channel x OverSampling Ratio 256 */
806
#define SD16OSR_128            (0x0100)       /* SD16 Channel x OverSampling Ratio 128 */
807
#define SD16OSR_64             (0x0200)       /* SD16 Channel x OverSampling Ratio  64 */
808
#define SD16OSR_32             (0x0300)       /* SD16 Channel x OverSampling Ratio  32 */
809
 
810
/* SD16IV Definitions */
811
#define SD16IV_NONE            (0x0000)       /* No Interrupt pending */
812
#define SD16IV_SD16OVIFG       (0x0002)       /* SD16OVIFG */
813
#define SD16IV_SD16MEM0        (0x0004)       /* SD16MEM0 SD16IFG */
814
#define SD16IV_SD16MEM1        (0x0006)       /* SD16MEM1 SD16IFG */
815
#define SD16IV_SD16MEM2        (0x0008)       /* SD16MEM2 SD16IFG */
816
 
817
/************************************************************
818
* Interrupt Vectors (offset from 0xFFE0)
819
************************************************************/
820
 
821
#define VECTOR_NAME(name)       name##_ptr
822
#define EMIT_PRAGMA(x)          _Pragma(#x)
823
#define CREATE_VECTOR(name)     void (* const VECTOR_NAME(name))(void) = &name
824
#define PLACE_VECTOR(vector,section) EMIT_PRAGMA(DATA_SECTION(vector,section))
825
#define ISR_VECTOR(func,offset) CREATE_VECTOR(func); \
826
                                PLACE_VECTOR(VECTOR_NAME(func), offset)
827
 
828
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
829
#define BASICTIMER_VECTOR       ".int00"                    /* 0xFFE0 Basic Timer */
830
#else
831
#define BASICTIMER_VECTOR       (0 * 1u)                     /* 0xFFE0 Basic Timer */
832
/*#define BASICTIMER_ISR(func)    ISR_VECTOR(func, ".int00")  */ /* 0xFFE0 Basic Timer */ /* CCE V2 Style */
833
#endif
834
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
835
#define PORT2_VECTOR            ".int01"                    /* 0xFFE2 Port 2 */
836
#else
837
#define PORT2_VECTOR            (1 * 1u)                     /* 0xFFE2 Port 2 */
838
/*#define PORT2_ISR(func)         ISR_VECTOR(func, ".int01")  */ /* 0xFFE2 Port 2 */ /* CCE V2 Style */
839
#endif
840
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
841
#define PORT1_VECTOR            ".int04"                    /* 0xFFE8 Port 1 */
842
#else
843
#define PORT1_VECTOR            (4 * 1u)                     /* 0xFFE8 Port 1 */
844
/*#define PORT1_ISR(func)         ISR_VECTOR(func, ".int04")  */ /* 0xFFE8 Port 1 */ /* CCE V2 Style */
845
#endif
846
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
847
#define TIMERA1_VECTOR          ".int05"                    /* 0xFFEA Timer A CC1-2, TA */
848
#else
849
#define TIMERA1_VECTOR          (5 * 1u)                     /* 0xFFEA Timer A CC1-2, TA */
850
/*#define TIMERA1_ISR(func)       ISR_VECTOR(func, ".int05")  */ /* 0xFFEA Timer A CC1-2, TA */ /* CCE V2 Style */
851
#endif
852
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
853
#define TIMERA0_VECTOR          ".int06"                    /* 0xFFEC Timer A CC0 */
854
#else
855
#define TIMERA0_VECTOR          (6 * 1u)                     /* 0xFFEC Timer A CC0 */
856
/*#define TIMERA0_ISR(func)       ISR_VECTOR(func, ".int06")  */ /* 0xFFEC Timer A CC0 */ /* CCE V2 Style */
857
#endif
858
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
859
#define USART0TX_VECTOR         ".int08"                    /* 0xFFF0 USART 0 Transmit */
860
#else
861
#define USART0TX_VECTOR         (8 * 1u)                     /* 0xFFF0 USART 0 Transmit */
862
/*#define USART0TX_ISR(func)      ISR_VECTOR(func, ".int08")  */ /* 0xFFF0 USART 0 Transmit */ /* CCE V2 Style */
863
#endif
864
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
865
#define USART0RX_VECTOR         ".int09"                    /* 0xFFF2 USART 0 Receive */
866
#else
867
#define USART0RX_VECTOR         (9 * 1u)                     /* 0xFFF2 USART 0 Receive */
868
/*#define USART0RX_ISR(func)      ISR_VECTOR(func, ".int09")  */ /* 0xFFF2 USART 0 Receive */ /* CCE V2 Style */
869
#endif
870
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
871
#define WDT_VECTOR              ".int10"                    /* 0xFFF4 Watchdog Timer */
872
#else
873
#define WDT_VECTOR              (10 * 1u)                    /* 0xFFF4 Watchdog Timer */
874
/*#define WDT_ISR(func)           ISR_VECTOR(func, ".int10")  */ /* 0xFFF4 Watchdog Timer */ /* CCE V2 Style */
875
#endif
876
 
877
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
878
#define SD16_VECTOR             ".int12"                    /* 0xFFF8 Sigma Delta ADC */
879
#else
880
#define SD16_VECTOR             (12 * 1u)                    /* 0xFFF8 Sigma Delta ADC */
881
/*#define SD16_ISR(func)          ISR_VECTOR(func, ".int12")  */ /* 0xFFF8 Sigma Delta ADC */ /* CCE V2 Style */
882
#endif
883
 
884
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
885
#define NMI_VECTOR              ".int14"                    /* 0xFFFC Non-maskable */
886
#else
887
#define NMI_VECTOR              (14 * 1u)                    /* 0xFFFC Non-maskable */
888
/*#define NMI_ISR(func)           ISR_VECTOR(func, ".int14")  */ /* 0xFFFC Non-maskable */ /* CCE V2 Style */
889
#endif
890
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
891
#define RESET_VECTOR            ".reset"                    /* 0xFFFE Reset [Highest Priority] */
892
#else
893
#define RESET_VECTOR            (15 * 1u)                    /* 0xFFFE Reset [Highest Priority] */
894
/*#define RESET_ISR(func)         ISR_VECTOR(func, ".int15")  */ /* 0xFFFE Reset [Highest Priority] */ /* CCE V2 Style */
895
#endif
896
 
897
 
898
/************************************************************
899
* End of Modules
900
************************************************************/
901
 
902
#ifdef __cplusplus
903
}
904
#endif /* extern "C" */
905
 
906
#endif /* #ifndef __msp430x42x */
907