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
* MSP430xG42x0 devices.
8
*
9
* Texas Instruments, Version 1.3
10
*
11
*
12
* Rev. 1.0, Inital Setup
13
* Rev. 1.1, Added some definitons for LCD_A Module
14
* Rev. 1.2, Removed definitions for BTRESET
15
* Rev. 1.3, added definitions for Interrupt Vectors xxIV
16
*
17
********************************************************************/
18
 
19
#ifndef __msp430xG42x0
20
#define __msp430xG42x0
21
 
22
#ifdef __cplusplus
23
extern "C" {
24
#endif
25
 
26
 
27
/*----------------------------------------------------------------------------*/
28
/* PERIPHERAL FILE MAP                                                        */
29
/*----------------------------------------------------------------------------*/
30
 
31
/* External references resolved by a device-specific linker command file */
32
#define SFR_8BIT(address)   extern volatile unsigned char address
33
#define SFR_16BIT(address)  extern volatile unsigned int address
34
 
35
 
36
/************************************************************
37
* STANDARD BITS
38
************************************************************/
39
 
40
#define BIT0                   (0x0001)
41
#define BIT1                   (0x0002)
42
#define BIT2                   (0x0004)
43
#define BIT3                   (0x0008)
44
#define BIT4                   (0x0010)
45
#define BIT5                   (0x0020)
46
#define BIT6                   (0x0040)
47
#define BIT7                   (0x0080)
48
#define BIT8                   (0x0100)
49
#define BIT9                   (0x0200)
50
#define BITA                   (0x0400)
51
#define BITB                   (0x0800)
52
#define BITC                   (0x1000)
53
#define BITD                   (0x2000)
54
#define BITE                   (0x4000)
55
#define BITF                   (0x8000)
56
 
57
/************************************************************
58
* STATUS REGISTER BITS
59
************************************************************/
60
 
61
#define C                      (0x0001)
62
#define Z                      (0x0002)
63
#define N                      (0x0004)
64
#define V                      (0x0100)
65
#define GIE                    (0x0008)
66
#define CPUOFF                 (0x0010)
67
#define OSCOFF                 (0x0020)
68
#define SCG0                   (0x0040)
69
#define SCG1                   (0x0080)
70
 
71
/* Low Power Modes coded with Bits 4-7 in SR */
72
 
73
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
74
#define LPM0                   (CPUOFF)
75
#define LPM1                   (SCG0+CPUOFF)
76
#define LPM2                   (SCG1+CPUOFF)
77
#define LPM3                   (SCG1+SCG0+CPUOFF)
78
#define LPM4                   (SCG1+SCG0+OSCOFF+CPUOFF)
79
/* End #defines for assembler */
80
 
81
#else /* Begin #defines for C */
82
#define LPM0_bits              (CPUOFF)
83
#define LPM1_bits              (SCG0+CPUOFF)
84
#define LPM2_bits              (SCG1+CPUOFF)
85
#define LPM3_bits              (SCG1+SCG0+CPUOFF)
86
#define LPM4_bits              (SCG1+SCG0+OSCOFF+CPUOFF)
87
 
88
#include "in430.h"
89
 
90
#define LPM0         _bis_SR_register(LPM0_bits)         /* Enter Low Power Mode 0 */
91
#define LPM0_EXIT    _bic_SR_register_on_exit(LPM0_bits) /* Exit Low Power Mode 0 */
92
#define LPM1         _bis_SR_register(LPM1_bits)         /* Enter Low Power Mode 1 */
93
#define LPM1_EXIT    _bic_SR_register_on_exit(LPM1_bits) /* Exit Low Power Mode 1 */
94
#define LPM2         _bis_SR_register(LPM2_bits)         /* Enter Low Power Mode 2 */
95
#define LPM2_EXIT    _bic_SR_register_on_exit(LPM2_bits) /* Exit Low Power Mode 2 */
96
#define LPM3         _bis_SR_register(LPM3_bits)         /* Enter Low Power Mode 3 */
97
#define LPM3_EXIT    _bic_SR_register_on_exit(LPM3_bits) /* Exit Low Power Mode 3 */
98
#define LPM4         _bis_SR_register(LPM4_bits)         /* Enter Low Power Mode 4 */
99
#define LPM4_EXIT    _bic_SR_register_on_exit(LPM4_bits) /* Exit Low Power Mode 4 */
100
#endif /* End #defines for C */
101
 
102
/************************************************************
103
* PERIPHERAL FILE MAP
104
************************************************************/
105
 
106
/************************************************************
107
* SPECIAL FUNCTION REGISTER ADDRESSES + CONTROL BITS
108
************************************************************/
109
 
110
SFR_8BIT(IE1);                                /* Interrupt Enable 1 */
111
#define WDTIE                  (0x01)
112
#define OFIE                   (0x02)
113
#define NMIIE                  (0x10)
114
#define ACCVIE                 (0x20)
115
 
116
SFR_8BIT(IFG1);                               /* Interrupt Flag 1 */
117
#define WDTIFG                 (0x01)         /* Watchdog Interrupt Flag */
118
#define OFIFG                  (0x02)         /* Osc. Fault Interrupt Flag */
119
#define PORIFG                 (0x04)         /* Power On Interrupt Flag */
120
#define RSTIFG                 (0x08)         /* Reset Interrupt Flag */
121
#define NMIIFG                 (0x10)         /* NMI Interrupt Flag */
122
 
123
SFR_8BIT(IE2);                                /* Interrupt Enable 2 */
124
#define BTIE                   (0x80)
125
 
126
SFR_8BIT(IFG2);                               /* Interrupt Flag 2 */
127
#define BTIFG                  (0x80)
128
 
129
/************************************************************
130
* WATCHDOG TIMER
131
************************************************************/
132
#define __MSP430_HAS_WDT__                    /* Definition to show that Module is available */
133
 
134
SFR_16BIT(WDTCTL);                            /* Watchdog Timer Control */
135
/* The bit names have been prefixed with "WDT" */
136
#define WDTIS0                 (0x0001)
137
#define WDTIS1                 (0x0002)
138
#define WDTSSEL                (0x0004)
139
#define WDTCNTCL               (0x0008)
140
#define WDTTMSEL               (0x0010)
141
#define WDTNMI                 (0x0020)
142
#define WDTNMIES               (0x0040)
143
#define WDTHOLD                (0x0080)
144
 
145
#define WDTPW                  (0x5A00)
146
 
147
/* WDT-interval times [1ms] coded with Bits 0-2 */
148
/* WDT is clocked by fSMCLK (assumed 1MHz) */
149
#define WDT_MDLY_32         (WDTPW+WDTTMSEL+WDTCNTCL)                         /* 32ms interval (default) */
150
#define WDT_MDLY_8          (WDTPW+WDTTMSEL+WDTCNTCL+WDTIS0)                  /* 8ms     " */
151
#define WDT_MDLY_0_5        (WDTPW+WDTTMSEL+WDTCNTCL+WDTIS1)                  /* 0.5ms   " */
152
#define WDT_MDLY_0_064      (WDTPW+WDTTMSEL+WDTCNTCL+WDTIS1+WDTIS0)           /* 0.064ms " */
153
/* WDT is clocked by fACLK (assumed 32KHz) */
154
#define WDT_ADLY_1000       (WDTPW+WDTTMSEL+WDTCNTCL+WDTSSEL)                 /* 1000ms  " */
155
#define WDT_ADLY_250        (WDTPW+WDTTMSEL+WDTCNTCL+WDTSSEL+WDTIS0)          /* 250ms   " */
156
#define WDT_ADLY_16         (WDTPW+WDTTMSEL+WDTCNTCL+WDTSSEL+WDTIS1)          /* 16ms    " */
157
#define WDT_ADLY_1_9        (WDTPW+WDTTMSEL+WDTCNTCL+WDTSSEL+WDTIS1+WDTIS0)   /* 1.9ms   " */
158
/* Watchdog mode -> reset after expired time */
159
/* WDT is clocked by fSMCLK (assumed 1MHz) */
160
#define WDT_MRST_32         (WDTPW+WDTCNTCL)                                  /* 32ms interval (default) */
161
#define WDT_MRST_8          (WDTPW+WDTCNTCL+WDTIS0)                           /* 8ms     " */
162
#define WDT_MRST_0_5        (WDTPW+WDTCNTCL+WDTIS1)                           /* 0.5ms   " */
163
#define WDT_MRST_0_064      (WDTPW+WDTCNTCL+WDTIS1+WDTIS0)                    /* 0.064ms " */
164
/* WDT is clocked by fACLK (assumed 32KHz) */
165
#define WDT_ARST_1000       (WDTPW+WDTCNTCL+WDTSSEL)                          /* 1000ms  " */
166
#define WDT_ARST_250        (WDTPW+WDTCNTCL+WDTSSEL+WDTIS0)                   /* 250ms   " */
167
#define WDT_ARST_16         (WDTPW+WDTCNTCL+WDTSSEL+WDTIS1)                   /* 16ms    " */
168
#define WDT_ARST_1_9        (WDTPW+WDTCNTCL+WDTSSEL+WDTIS1+WDTIS0)            /* 1.9ms   " */
169
 
170
/* INTERRUPT CONTROL */
171
/* These two bits are defined in the Special Function Registers */
172
/* #define WDTIE               0x01 */
173
/* #define WDTIFG              0x01 */
174
 
175
/************************************************************
176
* DIGITAL I/O Port1/2
177
************************************************************/
178
#define __MSP430_HAS_PORT1__                  /* Definition to show that Module is available */
179
#define __MSP430_HAS_PORT2__                  /* Definition to show that Module is available */
180
 
181
SFR_8BIT(P1IN);                               /* Port 1 Input */
182
SFR_8BIT(P1OUT);                              /* Port 1 Output */
183
SFR_8BIT(P1DIR);                              /* Port 1 Direction */
184
SFR_8BIT(P1IFG);                              /* Port 1 Interrupt Flag */
185
SFR_8BIT(P1IES);                              /* Port 1 Interrupt Edge Select */
186
SFR_8BIT(P1IE);                               /* Port 1 Interrupt Enable */
187
SFR_8BIT(P1SEL);                              /* Port 1 Selection */
188
 
189
SFR_8BIT(P2IN);                               /* Port 2 Input */
190
SFR_8BIT(P2OUT);                              /* Port 2 Output */
191
SFR_8BIT(P2DIR);                              /* Port 2 Direction */
192
SFR_8BIT(P2IFG);                              /* Port 2 Interrupt Flag */
193
SFR_8BIT(P2IES);                              /* Port 2 Interrupt Edge Select */
194
SFR_8BIT(P2IE);                               /* Port 2 Interrupt Enable */
195
SFR_8BIT(P2SEL);                              /* Port 2 Selection */
196
 
197
/************************************************************
198
* DIGITAL I/O Port5/6
199
************************************************************/
200
#define __MSP430_HAS_PORT5__                  /* Definition to show that Module is available */
201
#define __MSP430_HAS_PORT6__                  /* Definition to show that Module is available */
202
 
203
SFR_8BIT(P5IN);                               /* Port 5 Input */
204
SFR_8BIT(P5OUT);                              /* Port 5 Output */
205
SFR_8BIT(P5DIR);                              /* Port 5 Direction */
206
SFR_8BIT(P5SEL);                              /* Port 5 Selection */
207
 
208
SFR_8BIT(P6IN);                               /* Port 6 Input */
209
SFR_8BIT(P6OUT);                              /* Port 6 Output */
210
SFR_8BIT(P6DIR);                              /* Port 6 Direction */
211
SFR_8BIT(P6SEL);                              /* Port 6 Selection */
212
 
213
/************************************************************
214
* BASIC TIMER
215
************************************************************/
216
#define __MSP430_HAS_BT__                     /* Definition to show that Module is available */
217
 
218
SFR_8BIT(BTCTL);                              /* Basic Timer Control */
219
/* The bit names have been prefixed with "BT" */
220
#define BTIP0                  (0x01)
221
#define BTIP1                  (0x02)
222
#define BTIP2                  (0x04)
223
#define BTFRFQ0                (0x08)
224
#define BTFRFQ1                (0x10)
225
#define BTDIV                  (0x20)         /* fCLK2 = ACLK:256 */
226
#define BTHOLD                 (0x40)         /* BT1 is held if this bit is set */
227
#define BTSSEL                 (0x80)         /* fBT = fMCLK (main clock) */
228
 
229
SFR_8BIT(BTCNT1);                             /* Basic Timer Count 1 */
230
SFR_8BIT(BTCNT2);                             /* Basic Timer Count 2 */
231
 
232
/* Frequency of the BTCNT2 coded with Bit 5 and 7 in BTCTL */
233
#define BT_fCLK2_ACLK          (0x00)
234
#define BT_fCLK2_ACLK_DIV256   (BTDIV)
235
#define BT_fCLK2_MCLK          (BTSSEL)
236
 
237
/* Interrupt interval time fINT coded with Bits 0-2 in BTCTL */
238
#define BT_fCLK2_DIV2          (0x00)         /* fINT = fCLK2:2 (default) */
239
#define BT_fCLK2_DIV4          (BTIP0)        /* fINT = fCLK2:4 */
240
#define BT_fCLK2_DIV8          (BTIP1)        /* fINT = fCLK2:8 */
241
#define BT_fCLK2_DIV16         (BTIP1+BTIP0)  /* fINT = fCLK2:16 */
242
#define BT_fCLK2_DIV32         (BTIP2)        /* fINT = fCLK2:32 */
243
#define BT_fCLK2_DIV64         (BTIP2+BTIP0)  /* fINT = fCLK2:64 */
244
#define BT_fCLK2_DIV128        (BTIP2+BTIP1)  /* fINT = fCLK2:128 */
245
#define BT_fCLK2_DIV256     (BTIP2+BTIP1+BTIP0)       /* fINT = fCLK2:256 */
246
/* Frequency of LCD coded with Bits 3-4 */
247
#define BT_fLCD_DIV32          (0x00)         /* fLCD = fACLK:32 (default) */
248
#define BT_fLCD_DIV64          (BTFRFQ0)      /* fLCD = fACLK:64 */
249
#define BT_fLCD_DIV128         (BTFRFQ1)      /* fLCD = fACLK:128 */
250
#define BT_fLCD_DIV256      (BTFRFQ1+BTFRFQ0)         /* fLCD = fACLK:256 */
251
/* LCD frequency values with fBT=fACLK */
252
#define BT_fLCD_1K             (0x00)         /* fACLK:32 (default) */
253
#define BT_fLCD_512            (BTFRFQ0)      /* fACLK:64 */
254
#define BT_fLCD_256            (BTFRFQ1)      /* fACLK:128 */
255
#define BT_fLCD_128         (BTFRFQ1+BTFRFQ0)         /* fACLK:256 */
256
/* LCD frequency values with fBT=fMCLK */
257
#define BT_fLCD_31K            (BTSSEL)       /* fMCLK:32 */
258
#define BT_fLCD_15_5K       (BTSSEL+BTFRFQ0)          /* fMCLK:64 */
259
#define BT_fLCD_7_8K        (BTSSEL+BTFRFQ1+BTFRFQ0)  /* fMCLK:256 */
260
/* with assumed vlues of fACLK=32KHz, fMCLK=1MHz */
261
/* fBT=fACLK is thought for longer interval times */
262
#define BT_ADLY_0_064          (0x00)         /* 0.064ms interval (default) */
263
#define BT_ADLY_0_125          (BTIP0)        /* 0.125ms    " */
264
#define BT_ADLY_0_25           (BTIP1)        /* 0.25ms     " */
265
#define BT_ADLY_0_5            (BTIP1+BTIP0)  /* 0.5ms      " */
266
#define BT_ADLY_1              (BTIP2)        /* 1ms        " */
267
#define BT_ADLY_2              (BTIP2+BTIP0)  /* 2ms        " */
268
#define BT_ADLY_4              (BTIP2+BTIP1)  /* 4ms        " */
269
#define BT_ADLY_8           (BTIP2+BTIP1+BTIP0)       /* 8ms        " */
270
#define BT_ADLY_16             (BTDIV)        /* 16ms       " */
271
#define BT_ADLY_32             (BTDIV+BTIP0)  /* 32ms       " */
272
#define BT_ADLY_64             (BTDIV+BTIP1)  /* 64ms       " */
273
#define BT_ADLY_125         (BTDIV+BTIP1+BTIP0)       /* 125ms      " */
274
#define BT_ADLY_250            (BTDIV+BTIP2)  /* 250ms      " */
275
#define BT_ADLY_500         (BTDIV+BTIP2+BTIP0)       /* 500ms      " */
276
#define BT_ADLY_1000        (BTDIV+BTIP2+BTIP1)       /* 1000ms     " */
277
#define BT_ADLY_2000        (BTDIV+BTIP2+BTIP1+BTIP0) /* 2000ms     " */
278
/* fCLK2=fMCLK (1MHz) is thought for short interval times */
279
/* the timing for short intervals is more precise than ACLK */
280
/* NOTE */
281
/* Be sure that the SCFQCTL-Register is set to 01Fh so that fMCLK=1MHz */
282
/* Too low interval time results in interrupts too frequent for the processor to handle! */
283
#define BT_MDLY_0_002          (BTSSEL)       /* 0.002ms interval       *** interval times */
284
#define BT_MDLY_0_004          (BTSSEL+BTIP0) /* 0.004ms    "           *** too short for */
285
#define BT_MDLY_0_008          (BTSSEL+BTIP1) /* 0.008ms    "           *** interrupt */
286
#define BT_MDLY_0_016       (BTSSEL+BTIP1+BTIP0)      /* 0.016ms    "           *** handling */
287
#define BT_MDLY_0_032          (BTSSEL+BTIP2) /* 0.032ms    " */
288
#define BT_MDLY_0_064       (BTSSEL+BTIP2+BTIP0)      /* 0.064ms    " */
289
#define BT_MDLY_0_125       (BTSSEL+BTIP2+BTIP1)      /* 0.125ms    " */
290
#define BT_MDLY_0_25        (BTSSEL+BTIP2+BTIP1+BTIP0)/* 0.25ms     " */
291
 
292
/* Reset/Hold coded with Bits 6-7 in BT(1)CTL */
293
/* this is for BT */
294
//#define BTRESET_CNT1        (BTRESET)           /* BTCNT1 is reset while BTRESET is set */
295
//#define BTRESET_CNT1_2      (BTRESET+BTDIV)     /* BTCNT1 .AND. BTCNT2 are reset while ~ is set */
296
/* this is for BT1 */
297
#define BTHOLD_CNT1            (BTHOLD)       /* BTCNT1 is held while BTHOLD is set */
298
#define BTHOLD_CNT1_2          (BTHOLD+BTDIV) /* BT1CNT1 .AND. BT1CNT2 are held while ~ is set */
299
 
300
/* INTERRUPT CONTROL BITS */
301
/* #define BTIE                0x80 */
302
/* #define BTIFG               0x80 */
303
 
304
/************************************************************
305
* SYSTEM CLOCK, FLL+ (x41x)
306
************************************************************/
307
#define __MSP430_HAS_FLLPLUS_SMALL__                /* Definition to show that Module is available */
308
 
309
SFR_8BIT(SCFI0);                              /* System Clock Frequency Integrator 0 */
310
#define FN_2                   (0x04)         /* fDCOCLK =   1.4-12MHz*/
311
#define FN_3                   (0x08)         /* fDCOCLK =   2.2-17Mhz*/
312
#define FN_4                   (0x10)         /* fDCOCLK =   3.2-25Mhz*/
313
#define FN_8                   (0x20)         /* fDCOCLK =     5-40Mhz*/
314
#define FLLD0                  (0x40)         /* Loop Divider Bit : 0 */
315
#define FLLD1                  (0x80)         /* Loop Divider Bit : 1 */
316
 
317
#define FLLD_1                 (0x00)         /* Multiply Selected Loop Freq. By 1 */
318
#define FLLD_2                 (0x40)         /* Multiply Selected Loop Freq. By 2 */
319
#define FLLD_4                 (0x80)         /* Multiply Selected Loop Freq. By 4 */
320
#define FLLD_8                 (0xC0)         /* Multiply Selected Loop Freq. By 8 */
321
 
322
SFR_8BIT(SCFI1);                              /* System Clock Frequency Integrator 1 */
323
SFR_8BIT(SCFQCTL);                            /* System Clock Frequency Control */
324
/* System clock frequency values fMCLK coded with Bits 0-6 in SCFQCTL */
325
/* #define SCFQ_32K            0x00                        fMCLK=1*fACLK       only a range from */
326
#define SCFQ_64K               (0x01)         /* fMCLK=2*fACLK          1+1 to 127+1 is possible */
327
#define SCFQ_128K              (0x03)         /* fMCLK=4*fACLK */
328
#define SCFQ_256K              (0x07)         /* fMCLK=8*fACLK */
329
#define SCFQ_512K              (0x0F)         /* fMCLK=16*fACLK */
330
#define SCFQ_1M                (0x1F)         /* fMCLK=32*fACLK */
331
#define SCFQ_2M                (0x3F)         /* fMCLK=64*fACLK */
332
#define SCFQ_4M                (0x7F)         /* fMCLK=128*fACLK */
333
#define SCFQ_M                 (0x80)         /* Modulation Disable */
334
 
335
SFR_8BIT(FLL_CTL0);                           /* FLL+ Control 0 */
336
#define DCOF                   (0x01)         /* DCO Fault Flag */
337
#define LFOF                   (0x02)         /* Low Frequency Oscillator Fault Flag */
338
#define XT1OF                  (0x04)         /* High Frequency Oscillator Fault Flag */
339
#define OSCCAP0                (0x10)         /* XIN/XOUT Cap 0 */
340
#define OSCCAP1                (0x20)         /* XIN/XOUT Cap 1 */
341
#define XTS_FLL                (0x40)         /* 1: Selects high-freq. oscillator */
342
#define DCOPLUS                (0x80)         /* DCO+ Enable */
343
 
344
#define XCAP0PF                (0x00)         /* XIN Cap = XOUT Cap = 0pf */
345
#define XCAP10PF               (0x10)         /* XIN Cap = XOUT Cap = 10pf */
346
#define XCAP14PF               (0x20)         /* XIN Cap = XOUT Cap = 14pf */
347
#define XCAP18PF               (0x30)         /* XIN Cap = XOUT Cap = 18pf */
348
#define OSCCAP_0               (0x00)         /* XIN Cap = XOUT Cap = 0pf */
349
#define OSCCAP_1               (0x10)         /* XIN Cap = XOUT Cap = 10pf */
350
#define OSCCAP_2               (0x20)         /* XIN Cap = XOUT Cap = 14pf */
351
#define OSCCAP_3               (0x30)         /* XIN Cap = XOUT Cap = 18pf */
352
 
353
SFR_8BIT(FLL_CTL1);                           /* FLL+ Control 1 */
354
#define FLL_DIV0               (0x01)         /* FLL+ Divide Px.x/ACLK 0 */
355
#define FLL_DIV1               (0x02)         /* FLL+ Divide Px.x/ACLK 1 */
356
 
357
#define FLL_DIV_1              (0x00)         /* FLL+ Divide Px.x/ACLK By 1 */
358
#define FLL_DIV_2              (0x01)         /* FLL+ Divide Px.x/ACLK By 2 */
359
#define FLL_DIV_4              (0x02)         /* FLL+ Divide Px.x/ACLK By 4 */
360
#define FLL_DIV_8              (0x03)         /* FLL+ Divide Px.x/ACLK By 8 */
361
 
362
/* INTERRUPT CONTROL BITS */
363
/* These two bits are defined in the Special Function Registers */
364
/* #define OFIFG               0x02 */
365
/* #define OFIE                0x02 */
366
 
367
/************************************************************
368
* LCD_A
369
************************************************************/
370
#define __MSP430_HAS_LCD_A__                  /* Definition to show that Module is available */
371
 
372
SFR_8BIT(LCDACTL);                            /* LCD_A Control Register */
373
#define LCDON                  (0x01)
374
#define LCDSON                 (0x04)
375
#define LCDMX0                 (0x08)
376
#define LCDMX1                 (0x10)
377
#define LCDFREQ0               (0x20)
378
#define LCDFREQ1               (0x40)
379
#define LCDFREQ2               (0x80)
380
/* Display modes coded with Bits 2-4 */
381
#define LCDSTATIC              (LCDSON)
382
#define LCD2MUX                (LCDMX0+LCDSON)
383
#define LCD3MUX                (LCDMX1+LCDSON)
384
#define LCD4MUX                (LCDMX1+LCDMX0+LCDSON)
385
/* Frequency select code with Bits 5-7 */
386
#define LCDFREQ_32             (0x00)         /* LCD Freq: ACLK divided by 32 */
387
#define LCDFREQ_64             (0x20)         /* LCD Freq: ACLK divided by 64 */
388
#define LCDFREQ_96             (0x40)         /* LCD Freq: ACLK divided by 96 */
389
#define LCDFREQ_128            (0x60)         /* LCD Freq: ACLK divided by 128 */
390
#define LCDFREQ_192            (0x80)         /* LCD Freq: ACLK divided by 192 */
391
#define LCDFREQ_256            (0xA0)         /* LCD Freq: ACLK divided by 256 */
392
#define LCDFREQ_384            (0xC0)         /* LCD Freq: ACLK divided by 384 */
393
#define LCDFREQ_512            (0xE0)         /* LCD Freq: ACLK divided by 512 */
394
 
395
SFR_8BIT(LCDAPCTL0);                          /* LCD_A Port Control Register 0 */
396
#define LCDS0                  (0x01)         /* LCD Segment  0 to  3 Enable. */
397
#define LCDS4                  (0x02)         /* LCD Segment  4 to  7 Enable. */
398
#define LCDS8                  (0x04)         /* LCD Segment  8 to 11 Enable. */
399
#define LCDS12                 (0x08)         /* LCD Segment 12 to 15 Enable. */
400
#define LCDS16                 (0x10)         /* LCD Segment 16 to 19 Enable. */
401
#define LCDS20                 (0x20)         /* LCD Segment 20 to 23 Enable. */
402
#define LCDS24                 (0x40)         /* LCD Segment 24 to 27 Enable. */
403
#define LCDS28                 (0x80)         /* LCD Segment 28 to 31 Enable. */
404
 
405
SFR_8BIT(LCDAPCTL1);                          /* LCD_A Port Control Register 1 */
406
#define LCDS32                 (0x01)         /* LCD Segment 32 to 35 Enable. */
407
#define LCDS36                 (0x02)         /* LCD Segment 36 to 39 Enable. */
408
 
409
SFR_8BIT(LCDAVCTL0);                          /* LCD_A Voltage Control Register 0 */
410
#define LCD2B                  (0x01)         /* Selects 1/2 bias. */
411
#define VLCDREF0               (0x02)         /* Selects reference voltage for regulated charge pump: 0 */
412
#define VLCDREF1               (0x04)         /* Selects reference voltage for regulated charge pump: 1 */
413
#define LCDCPEN                (0x08)         /* LCD Voltage Charge Pump Enable. */
414
#define VLCDEXT                (0x10)         /* Select external source for VLCD. */
415
#define LCDREXT                (0x20)         /* Selects external connections for LCD mid voltages. */
416
#define LCDR03EXT              (0x40)         /* Selects external connection for lowest LCD voltage. */
417
 
418
/* Reference voltage source select for the regulated charge pump */
419
#define VLCDREF_0              (0<<1)         /* Internal */
420
#define VLCDREF_1              (1<<1)         /* External */
421
#define VLCDREF_2              (2<<1)         /* Reserved */
422
#define VLCDREF_3              (3<<1)         /* Reserved */
423
 
424
SFR_8BIT(LCDAVCTL1);                          /* LCD_A Voltage Control Register 1 */
425
#define VLCD0                  (0x02)         /* VLCD select: 0 */
426
#define VLCD1                  (0x04)         /* VLCD select: 1 */
427
#define VLCD2                  (0x08)         /* VLCD select: 2 */
428
#define VLCD3                  (0x10)         /* VLCD select: 3 */
429
 
430
/* Charge pump voltage selections */
431
#define VLCD_0                 (0<<1)         /* Charge pump disabled */
432
#define VLCD_1                 (1<<1)         /* VLCD = 2.60V */
433
#define VLCD_2                 (2<<1)         /* VLCD = 2.66V */
434
#define VLCD_3                 (3<<1)         /* VLCD = 2.72V */
435
#define VLCD_4                 (4<<1)         /* VLCD = 2.78V */
436
#define VLCD_5                 (5<<1)         /* VLCD = 2.84V */
437
#define VLCD_6                 (6<<1)         /* VLCD = 2.90V */
438
#define VLCD_7                 (7<<1)         /* VLCD = 2.96V */
439
#define VLCD_8                 (8<<1)         /* VLCD = 3.02V */
440
#define VLCD_9                 (9<<1)         /* VLCD = 3.08V */
441
#define VLCD_10                (10<<1)        /* VLCD = 3.14V */
442
#define VLCD_11                (11<<1)        /* VLCD = 3.20V */
443
#define VLCD_12                (12<<1)        /* VLCD = 3.26V */
444
#define VLCD_13                (12<<1)        /* VLCD = 3.32V */
445
#define VLCD_14                (13<<1)        /* VLCD = 3.38V */
446
#define VLCD_15                (15<<1)        /* VLCD = 3.44V */
447
 
448
#define VLCD_DISABLED          (0<<1)         /* Charge pump disabled */
449
#define VLCD_2_60              (1<<1)         /* VLCD = 2.60V */
450
#define VLCD_2_66              (2<<1)         /* VLCD = 2.66V */
451
#define VLCD_2_72              (3<<1)         /* VLCD = 2.72V */
452
#define VLCD_2_78              (4<<1)         /* VLCD = 2.78V */
453
#define VLCD_2_84              (5<<1)         /* VLCD = 2.84V */
454
#define VLCD_2_90              (6<<1)         /* VLCD = 2.90V */
455
#define VLCD_2_96              (7<<1)         /* VLCD = 2.96V */
456
#define VLCD_3_02              (8<<1)         /* VLCD = 3.02V */
457
#define VLCD_3_08              (9<<1)         /* VLCD = 3.08V */
458
#define VLCD_3_14              (10<<1)        /* VLCD = 3.14V */
459
#define VLCD_3_20              (11<<1)        /* VLCD = 3.20V */
460
#define VLCD_3_26              (12<<1)        /* VLCD = 3.26V */
461
#define VLCD_3_32              (12<<1)        /* VLCD = 3.32V */
462
#define VLCD_3_38              (13<<1)        /* VLCD = 3.38V */
463
#define VLCD_3_44              (15<<1)        /* VLCD = 3.44V */
464
 
465
#define LCDMEM_                (0x0091)       /* LCD Memory */
466
#ifdef __ASM_HEADER__
467
#define LCDMEM                 (LCDMEM_)      /* LCD Memory (for assembler) */
468
#else
469
#define LCDMEM                 ((char*)       LCDMEM_) /* LCD Memory (for C) */
470
#endif
471
SFR_8BIT(LCDM1);                              /* LCD Memory 1 */
472
SFR_8BIT(LCDM2);                              /* LCD Memory 2 */
473
SFR_8BIT(LCDM3);                              /* LCD Memory 3 */
474
SFR_8BIT(LCDM4);                              /* LCD Memory 4 */
475
SFR_8BIT(LCDM5);                              /* LCD Memory 5 */
476
SFR_8BIT(LCDM6);                              /* LCD Memory 6 */
477
SFR_8BIT(LCDM7);                              /* LCD Memory 7 */
478
SFR_8BIT(LCDM8);                              /* LCD Memory 8 */
479
SFR_8BIT(LCDM9);                              /* LCD Memory 9 */
480
SFR_8BIT(LCDM10);                             /* LCD Memory 10 */
481
SFR_8BIT(LCDM11);                             /* LCD Memory 11 */
482
SFR_8BIT(LCDM12);                             /* LCD Memory 12 */
483
SFR_8BIT(LCDM13);                             /* LCD Memory 13 */
484
SFR_8BIT(LCDM14);                             /* LCD Memory 14 */
485
SFR_8BIT(LCDM15);                             /* LCD Memory 15 */
486
SFR_8BIT(LCDM16);                             /* LCD Memory 16 */
487
SFR_8BIT(LCDM17);                             /* LCD Memory 17 */
488
SFR_8BIT(LCDM18);                             /* LCD Memory 18 */
489
SFR_8BIT(LCDM19);                             /* LCD Memory 19 */
490
SFR_8BIT(LCDM20);                             /* LCD Memory 20 */
491
 
492
#define LCDMA                  (LCDM10)       /* LCD Memory A */
493
#define LCDMB                  (LCDM11)       /* LCD Memory B */
494
#define LCDMC                  (LCDM12)       /* LCD Memory C */
495
#define LCDMD                  (LCDM13)       /* LCD Memory D */
496
#define LCDME                  (LCDM14)       /* LCD Memory E */
497
#define LCDMF                  (LCDM15)       /* LCD Memory F */
498
 
499
/************************************************************
500
* Timer A3
501
************************************************************/
502
#define __MSP430_HAS_TA3__                    /* Definition to show that Module is available */
503
 
504
SFR_16BIT(TAIV);                              /* Timer A Interrupt Vector Word */
505
SFR_16BIT(TACTL);                             /* Timer A Control */
506
SFR_16BIT(TACCTL0);                           /* Timer A Capture/Compare Control 0 */
507
SFR_16BIT(TACCTL1);                           /* Timer A Capture/Compare Control 1 */
508
SFR_16BIT(TACCTL2);                           /* Timer A Capture/Compare Control 2 */
509
SFR_16BIT(TAR);                               /* Timer A Counter Register */
510
SFR_16BIT(TACCR0);                            /* Timer A Capture/Compare 0 */
511
SFR_16BIT(TACCR1);                            /* Timer A Capture/Compare 1 */
512
SFR_16BIT(TACCR2);                            /* Timer A Capture/Compare 2 */
513
 
514
/* Alternate register names */
515
#define CCTL0                  TACCTL0        /* Timer A Capture/Compare Control 0 */
516
#define CCTL1                  TACCTL1        /* Timer A Capture/Compare Control 1 */
517
#define CCTL2                  TACCTL2        /* Timer A Capture/Compare Control 2 */
518
#define CCR0                   TACCR0         /* Timer A Capture/Compare 0 */
519
#define CCR1                   TACCR1         /* Timer A Capture/Compare 1 */
520
#define CCR2                   TACCR2         /* Timer A Capture/Compare 2 */
521
#define CCTL0_                 TACCTL0_       /* Timer A Capture/Compare Control 0 */
522
#define CCTL1_                 TACCTL1_       /* Timer A Capture/Compare Control 1 */
523
#define CCTL2_                 TACCTL2_       /* Timer A Capture/Compare Control 2 */
524
#define CCR0_                  TACCR0_        /* Timer A Capture/Compare 0 */
525
#define CCR1_                  TACCR1_        /* Timer A Capture/Compare 1 */
526
#define CCR2_                  TACCR2_        /* Timer A Capture/Compare 2 */
527
/* Alternate register names - 5xx style */
528
#define TA0IV                  TAIV           /* Timer A Interrupt Vector Word */
529
#define TA0CTL                 TACTL          /* Timer A Control */
530
#define TA0CCTL0               TACCTL0        /* Timer A Capture/Compare Control 0 */
531
#define TA0CCTL1               TACCTL1        /* Timer A Capture/Compare Control 1 */
532
#define TA0CCTL2               TACCTL2        /* Timer A Capture/Compare Control 2 */
533
#define TA0R                   TAR            /* Timer A Counter Register */
534
#define TA0CCR0                TACCR0         /* Timer A Capture/Compare 0 */
535
#define TA0CCR1                TACCR1         /* Timer A Capture/Compare 1 */
536
#define TA0CCR2                TACCR2         /* Timer A Capture/Compare 2 */
537
#define TA0IV_                 TAIV_          /* Timer A Interrupt Vector Word */
538
#define TA0CTL_                TACTL_         /* Timer A Control */
539
#define TA0CCTL0_              TACCTL0_       /* Timer A Capture/Compare Control 0 */
540
#define TA0CCTL1_              TACCTL1_       /* Timer A Capture/Compare Control 1 */
541
#define TA0CCTL2_              TACCTL2_       /* Timer A Capture/Compare Control 2 */
542
#define TA0R_                  TAR_           /* Timer A Counter Register */
543
#define TA0CCR0_               TACCR0_        /* Timer A Capture/Compare 0 */
544
#define TA0CCR1_               TACCR1_        /* Timer A Capture/Compare 1 */
545
#define TA0CCR2_               TACCR2_        /* Timer A Capture/Compare 2 */
546
 
547
#define TASSEL1                (0x0200)       /* Timer A clock source select 0 */
548
#define TASSEL0                (0x0100)       /* Timer A clock source select 1 */
549
#define ID1                    (0x0080)       /* Timer A clock input divider 1 */
550
#define ID0                    (0x0040)       /* Timer A clock input divider 0 */
551
#define MC1                    (0x0020)       /* Timer A mode control 1 */
552
#define MC0                    (0x0010)       /* Timer A mode control 0 */
553
#define TACLR                  (0x0004)       /* Timer A counter clear */
554
#define TAIE                   (0x0002)       /* Timer A counter interrupt enable */
555
#define TAIFG                  (0x0001)       /* Timer A counter interrupt flag */
556
 
557
#define MC_0                   (0*0x10u)      /* Timer A mode control: 0 - Stop */
558
#define MC_1                   (1*0x10u)      /* Timer A mode control: 1 - Up to CCR0 */
559
#define MC_2                   (2*0x10u)      /* Timer A mode control: 2 - Continous up */
560
#define MC_3                   (3*0x10u)      /* Timer A mode control: 3 - Up/Down */
561
#define ID_0                   (0*0x40u)      /* Timer A input divider: 0 - /1 */
562
#define ID_1                   (1*0x40u)      /* Timer A input divider: 1 - /2 */
563
#define ID_2                   (2*0x40u)      /* Timer A input divider: 2 - /4 */
564
#define ID_3                   (3*0x40u)      /* Timer A input divider: 3 - /8 */
565
#define TASSEL_0               (0*0x100u)     /* Timer A clock source select: 0 - TACLK */
566
#define TASSEL_1               (1*0x100u)     /* Timer A clock source select: 1 - ACLK  */
567
#define TASSEL_2               (2*0x100u)     /* Timer A clock source select: 2 - SMCLK */
568
#define TASSEL_3               (3*0x100u)     /* Timer A clock source select: 3 - INCLK */
569
 
570
#define CM1                    (0x8000)       /* Capture mode 1 */
571
#define CM0                    (0x4000)       /* Capture mode 0 */
572
#define CCIS1                  (0x2000)       /* Capture input select 1 */
573
#define CCIS0                  (0x1000)       /* Capture input select 0 */
574
#define SCS                    (0x0800)       /* Capture sychronize */
575
#define SCCI                   (0x0400)       /* Latched capture signal (read) */
576
#define CAP                    (0x0100)       /* Capture mode: 1 /Compare mode : 0 */
577
#define OUTMOD2                (0x0080)       /* Output mode 2 */
578
#define OUTMOD1                (0x0040)       /* Output mode 1 */
579
#define OUTMOD0                (0x0020)       /* Output mode 0 */
580
#define CCIE                   (0x0010)       /* Capture/compare interrupt enable */
581
#define CCI                    (0x0008)       /* Capture input signal (read) */
582
#define OUT                    (0x0004)       /* PWM Output signal if output mode 0 */
583
#define COV                    (0x0002)       /* Capture/compare overflow flag */
584
#define CCIFG                  (0x0001)       /* Capture/compare interrupt flag */
585
 
586
#define OUTMOD_0               (0*0x20u)      /* PWM output mode: 0 - output only */
587
#define OUTMOD_1               (1*0x20u)      /* PWM output mode: 1 - set */
588
#define OUTMOD_2               (2*0x20u)      /* PWM output mode: 2 - PWM toggle/reset */
589
#define OUTMOD_3               (3*0x20u)      /* PWM output mode: 3 - PWM set/reset */
590
#define OUTMOD_4               (4*0x20u)      /* PWM output mode: 4 - toggle */
591
#define OUTMOD_5               (5*0x20u)      /* PWM output mode: 5 - Reset */
592
#define OUTMOD_6               (6*0x20u)      /* PWM output mode: 6 - PWM toggle/set */
593
#define OUTMOD_7               (7*0x20u)      /* PWM output mode: 7 - PWM reset/set */
594
#define CCIS_0                 (0*0x1000u)    /* Capture input select: 0 - CCIxA */
595
#define CCIS_1                 (1*0x1000u)    /* Capture input select: 1 - CCIxB */
596
#define CCIS_2                 (2*0x1000u)    /* Capture input select: 2 - GND */
597
#define CCIS_3                 (3*0x1000u)    /* Capture input select: 3 - Vcc */
598
#define CM_0                   (0*0x4000u)    /* Capture mode: 0 - disabled */
599
#define CM_1                   (1*0x4000u)    /* Capture mode: 1 - pos. edge */
600
#define CM_2                   (2*0x4000u)    /* Capture mode: 1 - neg. edge */
601
#define CM_3                   (3*0x4000u)    /* Capture mode: 1 - both edges */
602
 
603
/* TA3IV Definitions */
604
#define TAIV_NONE              (0x0000)       /* No Interrupt pending */
605
#define TAIV_TACCR1            (0x0002)       /* TACCR1_CCIFG */
606
#define TAIV_TACCR2            (0x0004)       /* TACCR2_CCIFG */
607
#define TAIV_6                 (0x0006)       /* Reserved */
608
#define TAIV_8                 (0x0008)       /* Reserved */
609
#define TAIV_TAIFG             (0x000A)       /* TAIFG */
610
 
611
/*************************************************************
612
* Flash Memory
613
*************************************************************/
614
#define __MSP430_HAS_FLASH__                  /* Definition to show that Module is available */
615
 
616
SFR_16BIT(FCTL1);                             /* FLASH Control 1 */
617
SFR_16BIT(FCTL2);                             /* FLASH Control 2 */
618
SFR_16BIT(FCTL3);                             /* FLASH Control 3 */
619
 
620
#define FRKEY                  (0x9600)       /* Flash key returned by read */
621
#define FWKEY                  (0xA500)       /* Flash key for write */
622
#define FXKEY                  (0x3300)       /* for use with XOR instruction */
623
 
624
#define ERASE                  (0x0002)       /* Enable bit for Flash segment erase */
625
#define MERAS                  (0x0004)       /* Enable bit for Flash mass erase */
626
#define WRT                    (0x0040)       /* Enable bit for Flash write */
627
#define BLKWRT                 (0x0080)       /* Enable bit for Flash segment write */
628
#define SEGWRT                 (0x0080)       /* old definition */ /* Enable bit for Flash segment write */
629
 
630
#define FN0                    (0x0001)       /* Divide Flash clock by 1 to 64 using FN0 to FN5 according to: */
631
#define FN1                    (0x0002)       /*  32*FN5 + 16*FN4 + 8*FN3 + 4*FN2 + 2*FN1 + FN0 + 1 */
632
#ifndef FN2
633
#define FN2                    (0x0004)
634
#endif
635
#ifndef FN3
636
#define FN3                    (0x0008)
637
#endif
638
#ifndef FN4
639
#define FN4                    (0x0010)
640
#endif
641
#define FN5                    (0x0020)
642
#define FSSEL0                 (0x0040)       /* Flash clock select 0 */        /* to distinguish from USART SSELx */
643
#define FSSEL1                 (0x0080)       /* Flash clock select 1 */
644
 
645
#define FSSEL_0                (0x0000)       /* Flash clock select: 0 - ACLK */
646
#define FSSEL_1                (0x0040)       /* Flash clock select: 1 - MCLK */
647
#define FSSEL_2                (0x0080)       /* Flash clock select: 2 - SMCLK */
648
#define FSSEL_3                (0x00C0)       /* Flash clock select: 3 - SMCLK */
649
 
650
#define BUSY                   (0x0001)       /* Flash busy: 1 */
651
#define KEYV                   (0x0002)       /* Flash Key violation flag */
652
#define ACCVIFG                (0x0004)       /* Flash Access violation flag */
653
#define WAIT                   (0x0008)       /* Wait flag for segment write */
654
#define LOCK                   (0x0010)       /* Lock bit: 1 - Flash is locked (read only) */
655
#define EMEX                   (0x0020)       /* Flash Emergency Exit */
656
 
657
/************************************************************
658
* SD16_A1 - Sigma Delta 16 Bit
659
************************************************************/
660
#define __MSP430_HAS_SD16_A1__                /* Definition to show that Module is available */
661
 
662
SFR_8BIT(SD16INCTL0);                         /* SD16 Input Control Register Channel 0 */
663
SFR_8BIT(SD16AE);                             /* SD16 Analog Input Enable Register */
664
SFR_8BIT(SD16CONF0);                          /* SD16 Internal Configuration Register 0 */
665
SFR_8BIT(SD16CONF1);                          /* SD16 Internal Configuration Register 1 */
666
                                      /* Please use only the recommended settings */
667
 
668
SFR_16BIT(SD16CTL);                           /* Sigma Delta ADC 16 Control Register */
669
SFR_16BIT(SD16CCTL0);                         /* SD16 Channel 0 Control Register */
670
SFR_16BIT(SD16IV);                            /* SD16 Interrupt Vector Register */
671
SFR_16BIT(SD16MEM0);                          /* SD16 Channel 0 Conversion Memory */
672
 
673
/* SD16AE */
674
#define SD16AE0                (0x0001)       /* SD16 External Input Enable 0 */
675
#define SD16AE1                (0x0002)       /* SD16 External Input Enable 1 */
676
#define SD16AE2                (0x0004)       /* SD16 External Input Enable 2 */
677
#define SD16AE3                (0x0008)       /* SD16 External Input Enable 3 */
678
#define SD16AE4                (0x0010)       /* SD16 External Input Enable 4 */
679
#define SD16AE5                (0x0020)       /* SD16 External Input Enable 5 */
680
#define SD16AE6                (0x0040)       /* SD16 External Input Enable 6 */
681
#define SD16AE7                (0x0080)       /* SD16 External Input Enable 7 */
682
 
683
/* SD16INCTLx */
684
#define SD16INCH0              (0x0001)       /* SD16 Input Channel select 0 */
685
#define SD16INCH1              (0x0002)       /* SD16 Input Channel select 1 */
686
#define SD16INCH2              (0x0004)       /* SD16 Input Channel select 2 */
687
#define SD16GAIN0              (0x0008)       /* SD16 Input Pre-Amplifier Gain Select 0 */
688
#define SD16GAIN1              (0x0010)       /* SD16 Input Pre-Amplifier Gain Select 1 */
689
#define SD16GAIN2              (0x0020)       /* SD16 Input Pre-Amplifier Gain Select 2 */
690
#define SD16INTDLY0            (0x0040)       /* SD16 Interrupt Delay after 1.Conversion 0 */
691
#define SD16INTDLY1            (0x0080)       /* SD16 Interrupt Delay after 1.Conversion 1 */
692
 
693
#define SD16GAIN_1             (0x0000)       /* SD16 Input Pre-Amplifier Gain Select *1  */
694
#define SD16GAIN_2             (0x0008)       /* SD16 Input Pre-Amplifier Gain Select *2  */
695
#define SD16GAIN_4             (0x0010)       /* SD16 Input Pre-Amplifier Gain Select *4  */
696
#define SD16GAIN_8             (0x0018)       /* SD16 Input Pre-Amplifier Gain Select *8  */
697
#define SD16GAIN_16            (0x0020)       /* SD16 Input Pre-Amplifier Gain Select *16 */
698
#define SD16GAIN_32            (0x0028)       /* SD16 Input Pre-Amplifier Gain Select *32 */
699
 
700
#define SD16INCH_0             (0x0000)       /* SD16 Input Channel select A0 */
701
#define SD16INCH_1             (0x0001)       /* SD16 Input Channel select A1 */
702
#define SD16INCH_2             (0x0002)       /* SD16 Input Channel select A2 */
703
#define SD16INCH_3             (0x0003)       /* SD16 Input Channel select A3 */
704
#define SD16INCH_4             (0x0004)       /* SD16 Input Channel select A4 */
705
#define SD16INCH_5             (0x0005)       /* SD16 Input Channel select Vcc divider */
706
#define SD16INCH_6             (0x0006)       /* SD16 Input Channel select Temp */
707
#define SD16INCH_7             (0x0007)       /* SD16 Input Channel select Offset */
708
 
709
#define SD16INTDLY_0           (0x0000)       /* SD16 Interrupt Delay: Int. after 4.Conversion  */
710
#define SD16INTDLY_1           (0x0040)       /* SD16 Interrupt Delay: Int. after 3.Conversion  */
711
#define SD16INTDLY_2           (0x0080)       /* SD16 Interrupt Delay: Int. after 2.Conversion  */
712
#define SD16INTDLY_3           (0x00C0)       /* SD16 Interrupt Delay: Int. after 1.Conversion  */
713
 
714
/* SD16CTL */
715
#define SD16OVIE               (0x0002)       /* SD16 Overflow Interupt Enable */
716
#define SD16REFON              (0x0004)       /* SD16 Switch internal Reference on */
717
#define SD16VMIDON             (0x0008)       /* SD16 Switch Vmid Buffer on */
718
#define SD16SSEL0              (0x0010)       /* SD16 Clock Source Select 0 */
719
#define SD16SSEL1              (0x0020)       /* SD16 Clock Source Select 1 */
720
#define SD16DIV0               (0x0040)       /* SD16 Clock Divider Select 0 */
721
#define SD16DIV1               (0x0080)       /* SD16 Clock Divider Select 1 */
722
#define SD16LP                 (0x0100)       /* SD16 Low Power Mode Enable */
723
#define SD16XDIV0              (0x0200)       /* SD16 2.Clock Divider Select 0 */
724
#define SD16XDIV1              (0x0400)       /* SD16 2.Clock Divider Select 1 */
725
//#define SD16XDIV2           (0x0800)  /* SD16 2.Clock Divider Select 2 */
726
 
727
#define SD16DIV_0              (0x0000)       /* SD16 Clock Divider Select /1 */
728
#define SD16DIV_1              (SD16DIV0)     /* SD16 Clock Divider Select /2 */
729
#define SD16DIV_2              (SD16DIV1)     /* SD16 Clock Divider Select /4 */
730
#define SD16DIV_3           (SD16DIV0+SD16DIV1)    /* SD16 Clock Divider Select /8 */
731
 
732
#define SD16XDIV_0             (0x0000)       /* SD16 2.Clock Divider Select /1 */
733
#define SD16XDIV_1             (SD16XDIV0)    /* SD16 2.Clock Divider Select /3 */
734
#define SD16XDIV_2             (SD16XDIV1)    /* SD16 2.Clock Divider Select /16 */
735
#define SD16XDIV_3          (SD16XDIV0+SD16XDIV1)  /* SD16 2.Clock Divider Select /48 */
736
 
737
#define SD16SSEL_0             (0x0000)       /* SD16 Clock Source Select MCLK  */
738
#define SD16SSEL_1             (SD16SSEL0)    /* SD16 Clock Source Select SMCLK */
739
#define SD16SSEL_2             (SD16SSEL1)    /* SD16 Clock Source Select ACLK  */
740
#define SD16SSEL_3          (SD16SSEL0+SD16SSEL1)  /* SD16 Clock Source Select TACLK */
741
 
742
/* SD16CCTLx */
743
//#define RESERVED            (0x0001)  /* RESERVED */
744
#define SD16SC                 (0x0002)       /* SD16 Start Conversion */
745
#define SD16IFG                (0x0004)       /* SD16 Channel x Interrupt Flag */
746
#define SD16IE                 (0x0008)       /* SD16 Channel x Interrupt Enable */
747
#define SD16DF                 (0x0010)       /* SD16 Channel x Data Format: 0:Unipolar/1:Bipolar */
748
#define SD16OVIFG              (0x0020)       /* SD16 Channel x Overflow Interrupt Flag */
749
#define SD16LSBACC             (0x0040)       /* SD16 Channel x Access LSB of ADC */
750
#define SD16LSBTOG             (0x0080)       /* SD16 Channel x Toggle LSB Output of ADC */
751
#define SD16OSR0               (0x0100)       /* SD16 Channel x OverSampling Ratio 0 */
752
#define SD16OSR1               (0x0200)       /* SD16 Channel x OverSampling Ratio 1 */
753
#define SD16SNGL               (0x0400)       /* SD16 Channel x Single Conversion On/Off */
754
#define SD16XOSR               (0x0800)       /* SD16 Channel x Extended OverSampling Ratio */
755
#define SD16UNI                (0x1000)       /* SD16 Channel x Bipolar(0) / Unipolar(1) Mode */
756
#define SD16BUF0               (0x2000)       /* SD16 Channel x High Impedance Input Buffer Select: 0 */
757
#define SD16BUF1               (0x4000)       /* SD16 Channel x High Impedance Input Buffer Select: 1 */
758
#define SD16BUFG               (0x8000)       /* SD16 Channel x Buffer Gain 0:Gain=1 / 1:Gain=2 */
759
 
760
#define SD16OSR_1024        (SD16OSR0+SD16XOSR)     /* SD16 Channel x OverSampling Ratio 1024 */
761
#define SD16OSR_512            (SD16XOSR)     /* SD16 Channel x OverSampling Ratio 512 */
762
#define SD16OSR_256            (0x0000)       /* SD16 Channel x OverSampling Ratio 256 */
763
#define SD16OSR_128            (SD16OSR0)     /* SD16 Channel x OverSampling Ratio 128 */
764
#define SD16OSR_64             (SD16OSR1)     /* SD16 Channel x OverSampling Ratio  64 */
765
#define SD16OSR_32          (SD16OSR0+SD16OSR1)     /* SD16 Channel x OverSampling Ratio  32 */
766
 
767
#define SD16BUF_0              (0x0000)       /* SD16 High Imp. Input Buffer: Disabled */
768
#define SD16BUF_1              (SD16BUF0)     /* SD16 High Imp. Input Buffer: Slow */
769
#define SD16BUF_2              (SD16BUF1)     /* SD16 High Imp. Input Buffer: Meduim */
770
#define SD16BUF_3           (SD16BUF0+SD16BUF1)     /* SD16 High Imp. Input Buffer: Fast */
771
 
772
/* SD16IV Definitions */
773
#define SD16IV_NONE            (0x0000)       /* No Interrupt pending */
774
#define SD16IV_SD16OVIFG       (0x0002)       /* SD16OVIFG */
775
#define SD16IV_SD16MEM0        (0x0004)       /* SD16MEM0 SD16IFG */
776
 
777
/************************************************************
778
* DAC12
779
************************************************************/
780
#define __MSP430_HAS_DAC12_1__                /* Definition to show that Module is available */
781
 
782
SFR_16BIT(DAC12_0CTL);                        /* DAC12_0 Control */
783
 
784
#define DAC12GRP               (0x0001)       /* DAC12 group (not used) */
785
#define DAC12ENC               (0x0002)       /* DAC12 enable conversion */
786
#define DAC12IFG               (0x0004)       /* DAC12 interrupt flag */
787
#define DAC12IE                (0x0008)       /* DAC12 interrupt enable */
788
#define DAC12DF                (0x0010)       /* DAC12 data format */
789
#define DAC12AMP0              (0x0020)       /* DAC12 amplifier bit 0 */
790
#define DAC12AMP1              (0x0040)       /* DAC12 amplifier bit 1 */
791
#define DAC12AMP2              (0x0080)       /* DAC12 amplifier bit 2 */
792
#define DAC12IR                (0x0100)       /* DAC12 input reference and output range */
793
#define DAC12CALON             (0x0200)       /* DAC12 calibration */
794
#define DAC12LSEL0             (0x0400)       /* DAC12 load select bit 0 */
795
#define DAC12LSEL1             (0x0800)       /* DAC12 load select bit 1 */
796
#define DAC12RES               (0x1000)       /* DAC12 resolution */
797
#define DAC12SREF0             (0x2000)       /* DAC12 reference bit 0 */
798
#define DAC12SREF1             (0x4000)       /* DAC12 reference bit 1 */
799
#define DAC12OPS               (0x8000)       /* DAC12 Operation Amp. */
800
 
801
#define DAC12AMP_0             (0*0x0020u)    /* DAC12 amplifier 0: off,    3-state */
802
#define DAC12AMP_1             (1*0x0020u)    /* DAC12 amplifier 1: off,    off */
803
#define DAC12AMP_2             (2*0x0020u)    /* DAC12 amplifier 2: low,    low */
804
#define DAC12AMP_3             (3*0x0020u)    /* DAC12 amplifier 3: low,    medium */
805
#define DAC12AMP_4             (4*0x0020u)    /* DAC12 amplifier 4: low,    high */
806
#define DAC12AMP_5             (5*0x0020u)    /* DAC12 amplifier 5: medium, medium */
807
#define DAC12AMP_6             (6*0x0020u)    /* DAC12 amplifier 6: medium, high */
808
#define DAC12AMP_7             (7*0x0020u)    /* DAC12 amplifier 7: high,   high */
809
 
810
#define DAC12LSEL_0            (0*0x0400u)    /* DAC12 load select 0: direct */
811
#define DAC12LSEL_1            (1*0x0400u)    /* DAC12 load select 1: latched with DAT */
812
#define DAC12LSEL_2            (2*0x0400u)    /* DAC12 load select 2: latched with pos. Timer_A3.OUT1 */
813
#define DAC12LSEL_3            (3*0x0400u)    /* DAC12 load select 3: latched with pos. Timer_B7.OUT1 */
814
 
815
#define DAC12SREF_0            (0*0x2000u)    /* DAC12 reference 0: Vref+ */
816
#define DAC12SREF_1            (1*0x2000u)    /* DAC12 reference 1: Vref+ */
817
#define DAC12SREF_2            (2*0x2000u)    /* DAC12 reference 2: Veref+ */
818
#define DAC12SREF_3            (3*0x2000u)    /* DAC12 reference 3: Veref+ */
819
 
820
SFR_16BIT(DAC12_0DAT);                        /* DAC12_0 Data */
821
/************************************************************
822
* Operational Amplifier
823
************************************************************/
824
#define __MSP430_HAS_OA_2__                   /* Definition to show that Module is available */
825
 
826
SFR_8BIT(OA0CTL0);                            /* OA0 Control register 0 */
827
SFR_8BIT(OA0CTL1);                            /* OA0 Control register 1 */
828
SFR_8BIT(OA1CTL0);                            /* OA1 Control register 0 */
829
SFR_8BIT(OA1CTL1);                            /* OA1 Control register 1 */
830
SFR_8BIT(SWCTL);                              /* OA  Analog Switches Control Register */
831
 
832
#define OAPM0                  (0x04)         /* OAx Power mode select 0 */
833
#define OAPM1                  (0x08)         /* OAx Power mode select 1 */
834
#define OAP0                   (0x10)         /* OAx Non-inverting input select 0 */
835
#define OAP1                   (0x20)         /* OAx Non-inverting input select 1 */
836
#define OAN0                   (0x40)         /* OAx Inverting input select 0 */
837
#define OAN1                   (0x80)         /* OAx Inverting input select 1 */
838
 
839
#define OAPM_0                 (0x00)         /* OAx Power mode select: off */
840
#define OAPM_1                 (0x04)         /* OAx Power mode select: slow */
841
#define OAPM_2                 (0x08)         /* OAx Power mode select: meduim */
842
#define OAPM_3                 (0x0C)         /* OAx Power mode select: fast */
843
#define OAP_0                  (0x00)         /* OAx Non-inverting input select 00 */
844
#define OAP_1                  (0x10)         /* OAx Non-inverting input select 01 */
845
#define OAP_2                  (0x20)         /* OAx Non-inverting input select 10 */
846
#define OAP_3                  (0x30)         /* OAx Non-inverting input select 11 */
847
#define OAN_0                  (0x00)         /* OAx Inverting input select 00 */
848
#define OAN_1                  (0x40)         /* OAx Inverting input select 01 */
849
#define OAN_2                  (0x80)         /* OAx Inverting input select 10 */
850
#define OAN_3                  (0xC0)         /* OAx Inverting input select 11 */
851
 
852
#define OACAL                  (0x02)         /* OAx Offset Calibration */
853
#define OAFC0                  (0x04)         /* OAx Function control 0 */
854
#define OAFC1                  (0x08)         /* OAx Function control 1 */
855
#define OAFC2                  (0x10)         /* OAx Function control 2 */
856
 
857
#define OAFC_0                 (0x00)         /* OAx Function: Gen. Purpose */
858
#define OAFC_1                 (0x04)         /* OAx Function: Unity gain buffer */
859
#define OAFC_2                 (0x08)         /* OAx Function: Reserved */
860
#define OAFC_3                 (0x0C)         /* OAx Function: Reserved */
861
#define OAFC_4                 (0x10)         /* OAx Function: Reserved */
862
#define OAFC_5                 (0x14)         /* OAx Function: Reserved */
863
#define OAFC_6                 (0x18)         /* OAx Function: Inverting PGA */
864
#define OAFC_7                 (0x1C)         /* OAx Function: Reserved */
865
 
866
#define SWCTL0                 (0x01)         /* OA  Analog Switch Control 0 */
867
#define SWCTL1                 (0x02)         /* OA  Analog Switch Control 1 */
868
#define SWCTL2                 (0x04)         /* OA  Analog Switch Control 2 */
869
#define SWCTL3                 (0x08)         /* OA  Analog Switch Control 3 */
870
#define SWCTL4                 (0x10)         /* OA  Analog Switch Control 4 */
871
#define SWCTL5                 (0x20)         /* OA  Analog Switch Control 5 */
872
#define SWCTL6                 (0x40)         /* OA  Analog Switch Control 6 */
873
#define SWCTL7                 (0x80)         /* OA  Analog Switch Control 7 */
874
 
875
/************************************************************
876
* Interrupt Vectors (offset from 0xFFE0)
877
************************************************************/
878
 
879
#define VECTOR_NAME(name)       name##_ptr
880
#define EMIT_PRAGMA(x)          _Pragma(#x)
881
#define CREATE_VECTOR(name)     void (* const VECTOR_NAME(name))(void) = &name
882
#define PLACE_VECTOR(vector,section) EMIT_PRAGMA(DATA_SECTION(vector,section))
883
#define ISR_VECTOR(func,offset) CREATE_VECTOR(func); \
884
                                PLACE_VECTOR(VECTOR_NAME(func), offset)
885
 
886
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
887
#define BASICTIMER_VECTOR       ".int00"                    /* 0xFFE0 Basic Timer */
888
#else
889
#define BASICTIMER_VECTOR       (0 * 1u)                     /* 0xFFE0 Basic Timer */
890
/*#define BASICTIMER_ISR(func)    ISR_VECTOR(func, ".int00")  */ /* 0xFFE0 Basic Timer */ /* CCE V2 Style */
891
#endif
892
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
893
#define PORT2_VECTOR            ".int01"                    /* 0xFFE2 Port 2 */
894
#else
895
#define PORT2_VECTOR            (1 * 1u)                     /* 0xFFE2 Port 2 */
896
/*#define PORT2_ISR(func)         ISR_VECTOR(func, ".int01")  */ /* 0xFFE2 Port 2 */ /* CCE V2 Style */
897
#endif
898
 
899
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
900
#define DAC12_VECTOR            ".int03"                    /* 0xFFE6 DAC 12 */
901
#else
902
#define DAC12_VECTOR            (3 * 1u)                     /* 0xFFE6 DAC 12 */
903
/*#define DAC12_ISR(func)         ISR_VECTOR(func, ".int03")  */ /* 0xFFE6 DAC 12 */ /* CCE V2 Style */
904
#endif
905
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
906
#define PORT1_VECTOR            ".int04"                    /* 0xFFE8 Port 1 */
907
#else
908
#define PORT1_VECTOR            (4 * 1u)                     /* 0xFFE8 Port 1 */
909
/*#define PORT1_ISR(func)         ISR_VECTOR(func, ".int04")  */ /* 0xFFE8 Port 1 */ /* CCE V2 Style */
910
#endif
911
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
912
#define TIMERA1_VECTOR          ".int05"                    /* 0xFFEA Timer A CC1-2, TA */
913
#else
914
#define TIMERA1_VECTOR          (5 * 1u)                     /* 0xFFEA Timer A CC1-2, TA */
915
/*#define TIMERA1_ISR(func)       ISR_VECTOR(func, ".int05")  */ /* 0xFFEA Timer A CC1-2, TA */ /* CCE V2 Style */
916
#endif
917
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
918
#define TIMERA0_VECTOR          ".int06"                    /* 0xFFEC Timer A CC0 */
919
#else
920
#define TIMERA0_VECTOR          (6 * 1u)                     /* 0xFFEC Timer A CC0 */
921
/*#define TIMERA0_ISR(func)       ISR_VECTOR(func, ".int06")  */ /* 0xFFEC Timer A CC0 */ /* CCE V2 Style */
922
#endif
923
 
924
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
925
#define WDT_VECTOR              ".int10"                    /* 0xFFF4 Watchdog Timer */
926
#else
927
#define WDT_VECTOR              (10 * 1u)                    /* 0xFFF4 Watchdog Timer */
928
/*#define WDT_ISR(func)           ISR_VECTOR(func, ".int10")  */ /* 0xFFF4 Watchdog Timer */ /* CCE V2 Style */
929
#endif
930
 
931
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
932
#define SD16_VECTOR             ".int12"                    /* 0xFFF8 Sigma Delta ADC */
933
#else
934
#define SD16_VECTOR             (12 * 1u)                    /* 0xFFF8 Sigma Delta ADC */
935
/*#define SD16_ISR(func)          ISR_VECTOR(func, ".int12")  */ /* 0xFFF8 Sigma Delta ADC */ /* CCE V2 Style */
936
#endif
937
 
938
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
939
#define NMI_VECTOR              ".int14"                    /* 0xFFFC Non-maskable */
940
#else
941
#define NMI_VECTOR              (14 * 1u)                    /* 0xFFFC Non-maskable */
942
/*#define NMI_ISR(func)           ISR_VECTOR(func, ".int14")  */ /* 0xFFFC Non-maskable */ /* CCE V2 Style */
943
#endif
944
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
945
#define RESET_VECTOR            ".reset"                    /* 0xFFFE Reset [Highest Priority] */
946
#else
947
#define RESET_VECTOR            (15 * 1u)                    /* 0xFFFE Reset [Highest Priority] */
948
/*#define RESET_ISR(func)         ISR_VECTOR(func, ".int15")  */ /* 0xFFFE Reset [Highest Priority] */ /* CCE V2 Style */
949
#endif
950
 
951
/************************************************************
952
* End of Modules
953
************************************************************/
954
 
955
#ifdef __cplusplus
956
}
957
#endif /* extern "C" */
958
 
959
#endif /* #ifndef __msp430xG42x0 */
960