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
* MSP430x43x1 devices.
14
*
15
* Texas Instruments, Version 1.1
16
*
17
* Rev. 1.0, Initial Version
18
* Rev. 1.1, added definitions for Interrupt Vectors xxIV
19
*
20
********************************************************************/
21
 
22
#ifndef __msp430x43x1
23
#define __msp430x43x1
24
 
25
#ifdef __cplusplus
26
extern "C" {
27
#endif
28
 
29
 
30
/*----------------------------------------------------------------------------*/
31
/* PERIPHERAL FILE MAP                                                        */
32
/*----------------------------------------------------------------------------*/
33
 
34
/* External references resolved by a device-specific linker command file */
35
#define SFR_8BIT(address)   extern volatile unsigned char address
36
#define SFR_16BIT(address)  extern volatile unsigned int address
37
 
38
 
39
/************************************************************
40
* STANDARD BITS
41
************************************************************/
42
 
43
#define BIT0                   (0x0001)
44
#define BIT1                   (0x0002)
45
#define BIT2                   (0x0004)
46
#define BIT3                   (0x0008)
47
#define BIT4                   (0x0010)
48
#define BIT5                   (0x0020)
49
#define BIT6                   (0x0040)
50
#define BIT7                   (0x0080)
51
#define BIT8                   (0x0100)
52
#define BIT9                   (0x0200)
53
#define BITA                   (0x0400)
54
#define BITB                   (0x0800)
55
#define BITC                   (0x1000)
56
#define BITD                   (0x2000)
57
#define BITE                   (0x4000)
58
#define BITF                   (0x8000)
59
 
60
/************************************************************
61
* STATUS REGISTER BITS
62
************************************************************/
63
 
64
#define C                      (0x0001)
65
#define Z                      (0x0002)
66
#define N                      (0x0004)
67
#define V                      (0x0100)
68
#define GIE                    (0x0008)
69
#define CPUOFF                 (0x0010)
70
#define OSCOFF                 (0x0020)
71
#define SCG0                   (0x0040)
72
#define SCG1                   (0x0080)
73
 
74
/* Low Power Modes coded with Bits 4-7 in SR */
75
 
76
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
77
#define LPM0                   (CPUOFF)
78
#define LPM1                   (SCG0+CPUOFF)
79
#define LPM2                   (SCG1+CPUOFF)
80
#define LPM3                   (SCG1+SCG0+CPUOFF)
81
#define LPM4                   (SCG1+SCG0+OSCOFF+CPUOFF)
82
/* End #defines for assembler */
83
 
84
#else /* Begin #defines for C */
85
#define LPM0_bits              (CPUOFF)
86
#define LPM1_bits              (SCG0+CPUOFF)
87
#define LPM2_bits              (SCG1+CPUOFF)
88
#define LPM3_bits              (SCG1+SCG0+CPUOFF)
89
#define LPM4_bits              (SCG1+SCG0+OSCOFF+CPUOFF)
90
 
91
#include "in430.h"
92
 
93
#define LPM0         _bis_SR_register(LPM0_bits)         /* Enter Low Power Mode 0 */
94
#define LPM0_EXIT    _bic_SR_register_on_exit(LPM0_bits) /* Exit Low Power Mode 0 */
95
#define LPM1         _bis_SR_register(LPM1_bits)         /* Enter Low Power Mode 1 */
96
#define LPM1_EXIT    _bic_SR_register_on_exit(LPM1_bits) /* Exit Low Power Mode 1 */
97
#define LPM2         _bis_SR_register(LPM2_bits)         /* Enter Low Power Mode 2 */
98
#define LPM2_EXIT    _bic_SR_register_on_exit(LPM2_bits) /* Exit Low Power Mode 2 */
99
#define LPM3         _bis_SR_register(LPM3_bits)         /* Enter Low Power Mode 3 */
100
#define LPM3_EXIT    _bic_SR_register_on_exit(LPM3_bits) /* Exit Low Power Mode 3 */
101
#define LPM4         _bis_SR_register(LPM4_bits)         /* Enter Low Power Mode 4 */
102
#define LPM4_EXIT    _bic_SR_register_on_exit(LPM4_bits) /* Exit Low Power Mode 4 */
103
#endif /* End #defines for C */
104
 
105
/************************************************************
106
* PERIPHERAL FILE MAP
107
************************************************************/
108
 
109
/************************************************************
110
* SPECIAL FUNCTION REGISTER ADDRESSES + CONTROL BITS
111
************************************************************/
112
 
113
SFR_8BIT(IE1);                                /* Interrupt Enable 1 */
114
#define U0IE                   IE1            /* UART0 Interrupt Enable Register */
115
#define WDTIE                  (0x01)
116
#define OFIE                   (0x02)
117
#define NMIIE                  (0x10)
118
#define ACCVIE                 (0x20)
119
#define URXIE0                 (0x40)
120
#define UTXIE0                 (0x80)
121
 
122
SFR_8BIT(IFG1);                               /* Interrupt Flag 1 */
123
#define U0IFG                  IFG1           /* UART0 Interrupt Flag Register */
124
#define WDTIFG                 (0x01)
125
#define OFIFG                  (0x02)
126
#define NMIIFG                 (0x10)
127
#define URXIFG0                (0x40)
128
#define UTXIFG0                (0x80)
129
 
130
SFR_8BIT(ME1);                                /* Module Enable 1 */
131
#define U0ME                   ME1            /* UART0 Module Enable Register */
132
#define URXE0                  (0x40)
133
#define UTXE0                  (0x80)
134
#define USPIE0                 (0x40)
135
 
136
SFR_8BIT(IE2);                                /* Interrupt Enable 2 */
137
#define BTIE                   (0x80)
138
 
139
SFR_8BIT(IFG2);                               /* Interrupt Flag 2 */
140
#define BTIFG                  (0x80)
141
 
142
/************************************************************
143
* BASIC TIMER
144
************************************************************/
145
#define __MSP430_HAS_BT__                     /* Definition to show that Module is available */
146
 
147
SFR_8BIT(BTCTL);                              /* Basic Timer Control */
148
/* The bit names have been prefixed with "BT" */
149
#define BTIP0                  (0x01)
150
#define BTIP1                  (0x02)
151
#define BTIP2                  (0x04)
152
#define BTFRFQ0                (0x08)
153
#define BTFRFQ1                (0x10)
154
#define BTDIV                  (0x20)         /* fCLK2 = ACLK:256 */
155
#define BTHOLD                 (0x40)         /* BT1 is held if this bit is set */
156
#define BTSSEL                 (0x80)         /* fBT = fMCLK (main clock) */
157
 
158
SFR_8BIT(BTCNT1);                             /* Basic Timer Count 1 */
159
SFR_8BIT(BTCNT2);                             /* Basic Timer Count 2 */
160
 
161
/* Frequency of the BTCNT2 coded with Bit 5 and 7 in BTCTL */
162
#define BT_fCLK2_ACLK          (0x00)
163
#define BT_fCLK2_ACLK_DIV256   (BTDIV)
164
#define BT_fCLK2_MCLK          (BTSSEL)
165
 
166
/* Interrupt interval time fINT coded with Bits 0-2 in BTCTL */
167
#define BT_fCLK2_DIV2          (0x00)         /* fINT = fCLK2:2 (default) */
168
#define BT_fCLK2_DIV4          (BTIP0)        /* fINT = fCLK2:4 */
169
#define BT_fCLK2_DIV8          (BTIP1)        /* fINT = fCLK2:8 */
170
#define BT_fCLK2_DIV16         (BTIP1+BTIP0)  /* fINT = fCLK2:16 */
171
#define BT_fCLK2_DIV32         (BTIP2)        /* fINT = fCLK2:32 */
172
#define BT_fCLK2_DIV64         (BTIP2+BTIP0)  /* fINT = fCLK2:64 */
173
#define BT_fCLK2_DIV128        (BTIP2+BTIP1)  /* fINT = fCLK2:128 */
174
#define BT_fCLK2_DIV256     (BTIP2+BTIP1+BTIP0)       /* fINT = fCLK2:256 */
175
/* Frequency of LCD coded with Bits 3-4 */
176
#define BT_fLCD_DIV32          (0x00)         /* fLCD = fACLK:32 (default) */
177
#define BT_fLCD_DIV64          (BTFRFQ0)      /* fLCD = fACLK:64 */
178
#define BT_fLCD_DIV128         (BTFRFQ1)      /* fLCD = fACLK:128 */
179
#define BT_fLCD_DIV256      (BTFRFQ1+BTFRFQ0)         /* fLCD = fACLK:256 */
180
/* LCD frequency values with fBT=fACLK */
181
#define BT_fLCD_1K             (0x00)         /* fACLK:32 (default) */
182
#define BT_fLCD_512            (BTFRFQ0)      /* fACLK:64 */
183
#define BT_fLCD_256            (BTFRFQ1)      /* fACLK:128 */
184
#define BT_fLCD_128         (BTFRFQ1+BTFRFQ0)         /* fACLK:256 */
185
/* LCD frequency values with fBT=fMCLK */
186
#define BT_fLCD_31K            (BTSSEL)       /* fMCLK:32 */
187
#define BT_fLCD_15_5K       (BTSSEL+BTFRFQ0)          /* fMCLK:64 */
188
#define BT_fLCD_7_8K        (BTSSEL+BTFRFQ1+BTFRFQ0)  /* fMCLK:256 */
189
/* with assumed vlues of fACLK=32KHz, fMCLK=1MHz */
190
/* fBT=fACLK is thought for longer interval times */
191
#define BT_ADLY_0_064          (0x00)         /* 0.064ms interval (default) */
192
#define BT_ADLY_0_125          (BTIP0)        /* 0.125ms    " */
193
#define BT_ADLY_0_25           (BTIP1)        /* 0.25ms     " */
194
#define BT_ADLY_0_5            (BTIP1+BTIP0)  /* 0.5ms      " */
195
#define BT_ADLY_1              (BTIP2)        /* 1ms        " */
196
#define BT_ADLY_2              (BTIP2+BTIP0)  /* 2ms        " */
197
#define BT_ADLY_4              (BTIP2+BTIP1)  /* 4ms        " */
198
#define BT_ADLY_8           (BTIP2+BTIP1+BTIP0)       /* 8ms        " */
199
#define BT_ADLY_16             (BTDIV)        /* 16ms       " */
200
#define BT_ADLY_32             (BTDIV+BTIP0)  /* 32ms       " */
201
#define BT_ADLY_64             (BTDIV+BTIP1)  /* 64ms       " */
202
#define BT_ADLY_125         (BTDIV+BTIP1+BTIP0)       /* 125ms      " */
203
#define BT_ADLY_250            (BTDIV+BTIP2)  /* 250ms      " */
204
#define BT_ADLY_500         (BTDIV+BTIP2+BTIP0)       /* 500ms      " */
205
#define BT_ADLY_1000        (BTDIV+BTIP2+BTIP1)       /* 1000ms     " */
206
#define BT_ADLY_2000        (BTDIV+BTIP2+BTIP1+BTIP0) /* 2000ms     " */
207
/* fCLK2=fMCLK (1MHz) is thought for short interval times */
208
/* the timing for short intervals is more precise than ACLK */
209
/* NOTE */
210
/* Be sure that the SCFQCTL-Register is set to 01Fh so that fMCLK=1MHz */
211
/* Too low interval time results in interrupts too frequent for the processor to handle! */
212
#define BT_MDLY_0_002          (BTSSEL)       /* 0.002ms interval       *** interval times */
213
#define BT_MDLY_0_004          (BTSSEL+BTIP0) /* 0.004ms    "           *** too short for */
214
#define BT_MDLY_0_008          (BTSSEL+BTIP1) /* 0.008ms    "           *** interrupt */
215
#define BT_MDLY_0_016       (BTSSEL+BTIP1+BTIP0)      /* 0.016ms    "           *** handling */
216
#define BT_MDLY_0_032          (BTSSEL+BTIP2) /* 0.032ms    " */
217
#define BT_MDLY_0_064       (BTSSEL+BTIP2+BTIP0)      /* 0.064ms    " */
218
#define BT_MDLY_0_125       (BTSSEL+BTIP2+BTIP1)      /* 0.125ms    " */
219
#define BT_MDLY_0_25        (BTSSEL+BTIP2+BTIP1+BTIP0)/* 0.25ms     " */
220
 
221
/* Reset/Hold coded with Bits 6-7 in BT(1)CTL */
222
/* this is for BT */
223
//#define BTRESET_CNT1        (BTRESET)           /* BTCNT1 is reset while BTRESET is set */
224
//#define BTRESET_CNT1_2      (BTRESET+BTDIV)     /* BTCNT1 .AND. BTCNT2 are reset while ~ is set */
225
/* this is for BT1 */
226
#define BTHOLD_CNT1            (BTHOLD)       /* BTCNT1 is held while BTHOLD is set */
227
#define BTHOLD_CNT1_2          (BTHOLD+BTDIV) /* BT1CNT1 .AND. BT1CNT2 are held while ~ is set */
228
 
229
/* INTERRUPT CONTROL BITS */
230
/* #define BTIE                0x80 */
231
/* #define BTIFG               0x80 */
232
 
233
/************************************************************
234
* Comparator A
235
************************************************************/
236
#define __MSP430_HAS_COMPA__                  /* Definition to show that Module is available */
237
 
238
SFR_8BIT(CACTL1);                             /* Comparator A Control 1 */
239
SFR_8BIT(CACTL2);                             /* Comparator A Control 2 */
240
SFR_8BIT(CAPD);                               /* Comparator A Port Disable */
241
 
242
#define CAIFG                  (0x01)         /* Comp. A Interrupt Flag */
243
#define CAIE                   (0x02)         /* Comp. A Interrupt Enable */
244
#define CAIES                  (0x04)         /* Comp. A Int. Edge Select: 0:rising / 1:falling */
245
#define CAON                   (0x08)         /* Comp. A enable */
246
#define CAREF0                 (0x10)         /* Comp. A Internal Reference Select 0 */
247
#define CAREF1                 (0x20)         /* Comp. A Internal Reference Select 1 */
248
#define CARSEL                 (0x40)         /* Comp. A Internal Reference Enable */
249
#define CAEX                   (0x80)         /* Comp. A Exchange Inputs */
250
 
251
#define CAREF_0                (0x00)         /* Comp. A Int. Ref. Select 0 : Off */
252
#define CAREF_1                (0x10)         /* Comp. A Int. Ref. Select 1 : 0.25*Vcc */
253
#define CAREF_2                (0x20)         /* Comp. A Int. Ref. Select 2 : 0.5*Vcc */
254
#define CAREF_3                (0x30)         /* Comp. A Int. Ref. Select 3 : Vt*/
255
 
256
#define CAOUT                  (0x01)         /* Comp. A Output */
257
#define CAF                    (0x02)         /* Comp. A Enable Output Filter */
258
#define P2CA0                  (0x04)         /* Comp. A Connect External Signal to CA0 : 1 */
259
#define P2CA1                  (0x08)         /* Comp. A Connect External Signal to CA1 : 1 */
260
#define CACTL24                (0x10)
261
#define CACTL25                (0x20)
262
#define CACTL26                (0x40)
263
#define CACTL27                (0x80)
264
 
265
#define CAPD0                  (0x01)         /* Comp. A Disable Input Buffer of Port Register .0 */
266
#define CAPD1                  (0x02)         /* Comp. A Disable Input Buffer of Port Register .1 */
267
#define CAPD2                  (0x04)         /* Comp. A Disable Input Buffer of Port Register .2 */
268
#define CAPD3                  (0x08)         /* Comp. A Disable Input Buffer of Port Register .3 */
269
#define CAPD4                  (0x10)         /* Comp. A Disable Input Buffer of Port Register .4 */
270
#define CAPD5                  (0x20)         /* Comp. A Disable Input Buffer of Port Register .5 */
271
#define CAPD6                  (0x40)         /* Comp. A Disable Input Buffer of Port Register .6 */
272
#define CAPD7                  (0x80)         /* Comp. A Disable Input Buffer of Port Register .7 */
273
 
274
/*************************************************************
275
* Flash Memory
276
*************************************************************/
277
#define __MSP430_HAS_FLASH__                  /* Definition to show that Module is available */
278
 
279
SFR_16BIT(FCTL1);                             /* FLASH Control 1 */
280
SFR_16BIT(FCTL2);                             /* FLASH Control 2 */
281
SFR_16BIT(FCTL3);                             /* FLASH Control 3 */
282
 
283
#define FRKEY                  (0x9600)       /* Flash key returned by read */
284
#define FWKEY                  (0xA500)       /* Flash key for write */
285
#define FXKEY                  (0x3300)       /* for use with XOR instruction */
286
 
287
#define ERASE                  (0x0002)       /* Enable bit for Flash segment erase */
288
#define MERAS                  (0x0004)       /* Enable bit for Flash mass erase */
289
#define WRT                    (0x0040)       /* Enable bit for Flash write */
290
#define BLKWRT                 (0x0080)       /* Enable bit for Flash segment write */
291
#define SEGWRT                 (0x0080)       /* old definition */ /* Enable bit for Flash segment write */
292
 
293
#define FN0                    (0x0001)       /* Divide Flash clock by 1 to 64 using FN0 to FN5 according to: */
294
#define FN1                    (0x0002)       /*  32*FN5 + 16*FN4 + 8*FN3 + 4*FN2 + 2*FN1 + FN0 + 1 */
295
#ifndef FN2
296
#define FN2                    (0x0004)
297
#endif
298
#ifndef FN3
299
#define FN3                    (0x0008)
300
#endif
301
#ifndef FN4
302
#define FN4                    (0x0010)
303
#endif
304
#define FN5                    (0x0020)
305
#define FSSEL0                 (0x0040)       /* Flash clock select 0 */        /* to distinguish from USART SSELx */
306
#define FSSEL1                 (0x0080)       /* Flash clock select 1 */
307
 
308
#define FSSEL_0                (0x0000)       /* Flash clock select: 0 - ACLK */
309
#define FSSEL_1                (0x0040)       /* Flash clock select: 1 - MCLK */
310
#define FSSEL_2                (0x0080)       /* Flash clock select: 2 - SMCLK */
311
#define FSSEL_3                (0x00C0)       /* Flash clock select: 3 - SMCLK */
312
 
313
#define BUSY                   (0x0001)       /* Flash busy: 1 */
314
#define KEYV                   (0x0002)       /* Flash Key violation flag */
315
#define ACCVIFG                (0x0004)       /* Flash Access violation flag */
316
#define WAIT                   (0x0008)       /* Wait flag for segment write */
317
#define LOCK                   (0x0010)       /* Lock bit: 1 - Flash is locked (read only) */
318
#define EMEX                   (0x0020)       /* Flash Emergency Exit */
319
 
320
/************************************************************
321
* SYSTEM CLOCK, FLL+
322
************************************************************/
323
#define __MSP430_HAS_FLLPLUS__                /* Definition to show that Module is available */
324
 
325
SFR_8BIT(SCFI0);                              /* System Clock Frequency Integrator 0 */
326
#define FN_2                   (0x04)         /* fDCOCLK =   1.4-12MHz*/
327
#define FN_3                   (0x08)         /* fDCOCLK =   2.2-17Mhz*/
328
#define FN_4                   (0x10)         /* fDCOCLK =   3.2-25Mhz*/
329
#define FN_8                   (0x20)         /* fDCOCLK =     5-40Mhz*/
330
#define FLLD0                  (0x40)         /* Loop Divider Bit : 0 */
331
#define FLLD1                  (0x80)         /* Loop Divider Bit : 1 */
332
 
333
#define FLLD_1                 (0x00)         /* Multiply Selected Loop Freq. By 1 */
334
#define FLLD_2                 (0x40)         /* Multiply Selected Loop Freq. By 2 */
335
#define FLLD_4                 (0x80)         /* Multiply Selected Loop Freq. By 4 */
336
#define FLLD_8                 (0xC0)         /* Multiply Selected Loop Freq. By 8 */
337
 
338
SFR_8BIT(SCFI1);                              /* System Clock Frequency Integrator 1 */
339
SFR_8BIT(SCFQCTL);                            /* System Clock Frequency Control */
340
/* System clock frequency values fMCLK coded with Bits 0-6 in SCFQCTL */
341
/* #define SCFQ_32K            0x00                        fMCLK=1*fACLK       only a range from */
342
#define SCFQ_64K               (0x01)         /* fMCLK=2*fACLK          1+1 to 127+1 is possible */
343
#define SCFQ_128K              (0x03)         /* fMCLK=4*fACLK */
344
#define SCFQ_256K              (0x07)         /* fMCLK=8*fACLK */
345
#define SCFQ_512K              (0x0F)         /* fMCLK=16*fACLK */
346
#define SCFQ_1M                (0x1F)         /* fMCLK=32*fACLK */
347
#define SCFQ_2M                (0x3F)         /* fMCLK=64*fACLK */
348
#define SCFQ_4M                (0x7F)         /* fMCLK=128*fACLK */
349
#define SCFQ_M                 (0x80)         /* Modulation Disable */
350
 
351
SFR_8BIT(FLL_CTL0);                           /* FLL+ Control 0 */
352
#define DCOF                   (0x01)         /* DCO Fault Flag */
353
#define LFOF                   (0x02)         /* Low Frequency Oscillator Fault Flag */
354
#define XT1OF                  (0x04)         /* High Frequency Oscillator 1 Fault Flag */
355
#define XT2OF                  (0x08)         /* High Frequency Oscillator 2 Fault Flag */
356
#define OSCCAP0                (0x10)         /* XIN/XOUT Cap 0 */
357
#define OSCCAP1                (0x20)         /* XIN/XOUT Cap 1 */
358
#define XTS_FLL                (0x40)         /* 1: Selects high-freq. oscillator */
359
#define DCOPLUS                (0x80)         /* DCO+ Enable */
360
 
361
#define XCAP0PF                (0x00)         /* XIN Cap = XOUT Cap = 0pf */
362
#define XCAP10PF               (0x10)         /* XIN Cap = XOUT Cap = 10pf */
363
#define XCAP14PF               (0x20)         /* XIN Cap = XOUT Cap = 14pf */
364
#define XCAP18PF               (0x30)         /* XIN Cap = XOUT Cap = 18pf */
365
#define OSCCAP_0               (0x00)         /* XIN Cap = XOUT Cap = 0pf */
366
#define OSCCAP_1               (0x10)         /* XIN Cap = XOUT Cap = 10pf */
367
#define OSCCAP_2               (0x20)         /* XIN Cap = XOUT Cap = 14pf */
368
#define OSCCAP_3               (0x30)         /* XIN Cap = XOUT Cap = 18pf */
369
 
370
SFR_8BIT(FLL_CTL1);                           /* FLL+ Control 1 */
371
#define FLL_DIV0               (0x01)         /* FLL+ Divide Px.x/ACLK 0 */
372
#define FLL_DIV1               (0x02)         /* FLL+ Divide Px.x/ACLK 1 */
373
#define SELS                   (0x04)         /* Peripheral Module Clock Source (0: DCO, 1: XT2) */
374
#define SELM0                  (0x08)         /* MCLK Source Select 0 */
375
#define SELM1                  (0x10)         /* MCLK Source Select 1 */
376
#define XT2OFF                 (0x20)         /* High Frequency Oscillator 2 (XT2) disable */
377
#define SMCLKOFF               (0x40)         /* Peripheral Module Clock (SMCLK) disable */
378
 
379
#define FLL_DIV_1              (0x00)         /* FLL+ Divide Px.x/ACLK By 1 */
380
#define FLL_DIV_2              (0x01)         /* FLL+ Divide Px.x/ACLK By 2 */
381
#define FLL_DIV_4              (0x02)         /* FLL+ Divide Px.x/ACLK By 4 */
382
#define FLL_DIV_8              (0x03)         /* FLL+ Divide Px.x/ACLK By 8 */
383
 
384
#define SELM_DCO               (0x00)         /* Select DCO for CPU MCLK */
385
#define SELM_XT2               (0x10)         /* Select XT2 for CPU MCLK */
386
#define SELM_A                 (0x18)         /* Select A (from LFXT1) for CPU MCLK */
387
 
388
/* INTERRUPT CONTROL BITS */
389
/* These two bits are defined in the Special Function Registers */
390
/* #define OFIFG               0x02 */
391
/* #define OFIE                0x02 */
392
 
393
/************************************************************
394
* LCD
395
************************************************************/
396
#define __MSP430_HAS_LCD4__                   /* Definition to show that Module is available */
397
 
398
SFR_8BIT(LCDCTL);                             /* LCD Control */
399
/* the names of the mode bits are different from the spec */
400
#define LCDON                  (0x01)
401
//#define LCDLOWR             (0x02)
402
#define LCDSON                 (0x04)
403
#define LCDMX0                 (0x08)
404
#define LCDMX1                 (0x10)
405
#define LCDP0                  (0x20)
406
#define LCDP1                  (0x40)
407
#define LCDP2                  (0x80)
408
/* Display modes coded with Bits 2-4 */
409
#define LCDSTATIC              (LCDSON)
410
#define LCD2MUX                (LCDMX0+LCDSON)
411
#define LCD3MUX                (LCDMX1+LCDSON)
412
#define LCD4MUX                (LCDMX1+LCDMX0+LCDSON)
413
/* Group select code with Bits 5-7                     Seg.lines   Dig.output */
414
#define LCDSG0                 (0x00)         /* ---------   Port Only (default) */
415
#define LCDSG0_1               (LCDP0)        /* S0  - S15   see Datasheet */
416
#define LCDSG0_2               (LCDP1)        /* S0  - S19   see Datasheet */
417
#define LCDSG0_3               (LCDP1+LCDP0)  /* S0  - S23   see Datasheet */
418
#define LCDSG0_4               (LCDP2)        /* S0  - S27   see Datasheet */
419
#define LCDSG0_5               (LCDP2+LCDP0)  /* S0  - S31   see Datasheet */
420
#define LCDSG0_6               (LCDP2+LCDP1)  /* S0  - S35   see Datasheet */
421
#define LCDSG0_7            (LCDP2+LCDP1+LCDP0)       /* S0  - S39   see Datasheet */
422
/* NOTE: YOU CAN ONLY USE THE 'S' OR 'G' DECLARATIONS FOR A COMMAND */
423
/* MOV  #LCDSG0_3+LCDOG2_7,&LCDCTL ACTUALY MEANS MOV  #LCDP1,&LCDCTL! */
424
#define LCDOG1_7               (0x00)         /* ---------   Port Only (default) */
425
#define LCDOG2_7               (LCDP0)        /* S0  - S15   see Datasheet */
426
#define LCDOG3_7               (LCDP1)        /* S0  - S19   see Datasheet */
427
#define LCDOG4_7               (LCDP1+LCDP0)  /* S0  - S23   see Datasheet */
428
#define LCDOG5_7               (LCDP2)        /* S0  - S27   see Datasheet */
429
#define LCDOG6_7               (LCDP2+LCDP0)  /* S0  - S31   see Datasheet */
430
#define LCDOG7                 (LCDP2+LCDP1)  /* S0  - S35   see Datasheet */
431
#define LCDOGOFF            (LCDP2+LCDP1+LCDP0)       /* S0  - S39   see Datasheet */
432
 
433
#define LCDMEM_                (0x0091)       /* LCD Memory */
434
#ifdef __ASM_HEADER__
435
#define LCDMEM                 (LCDMEM_)      /* LCD Memory (for assembler) */
436
#else
437
#define LCDMEM                 ((char*)       LCDMEM_) /* LCD Memory (for C) */
438
#endif
439
SFR_8BIT(LCDM1);                              /* LCD Memory 1 */
440
SFR_8BIT(LCDM2);                              /* LCD Memory 2 */
441
SFR_8BIT(LCDM3);                              /* LCD Memory 3 */
442
SFR_8BIT(LCDM4);                              /* LCD Memory 4 */
443
SFR_8BIT(LCDM5);                              /* LCD Memory 5 */
444
SFR_8BIT(LCDM6);                              /* LCD Memory 6 */
445
SFR_8BIT(LCDM7);                              /* LCD Memory 7 */
446
SFR_8BIT(LCDM8);                              /* LCD Memory 8 */
447
SFR_8BIT(LCDM9);                              /* LCD Memory 9 */
448
SFR_8BIT(LCDM10);                             /* LCD Memory 10 */
449
SFR_8BIT(LCDM11);                             /* LCD Memory 11 */
450
SFR_8BIT(LCDM12);                             /* LCD Memory 12 */
451
SFR_8BIT(LCDM13);                             /* LCD Memory 13 */
452
SFR_8BIT(LCDM14);                             /* LCD Memory 14 */
453
SFR_8BIT(LCDM15);                             /* LCD Memory 15 */
454
SFR_8BIT(LCDM16);                             /* LCD Memory 16 */
455
SFR_8BIT(LCDM17);                             /* LCD Memory 17 */
456
SFR_8BIT(LCDM18);                             /* LCD Memory 18 */
457
SFR_8BIT(LCDM19);                             /* LCD Memory 19 */
458
SFR_8BIT(LCDM20);                             /* LCD Memory 20 */
459
 
460
#define LCDMA                  (LCDM10)       /* LCD Memory A */
461
#define LCDMB                  (LCDM11)       /* LCD Memory B */
462
#define LCDMC                  (LCDM12)       /* LCD Memory C */
463
#define LCDMD                  (LCDM13)       /* LCD Memory D */
464
#define LCDME                  (LCDM14)       /* LCD Memory E */
465
#define LCDMF                  (LCDM15)       /* LCD Memory F */
466
 
467
/************************************************************
468
* DIGITAL I/O Port1/2
469
************************************************************/
470
#define __MSP430_HAS_PORT1__                  /* Definition to show that Module is available */
471
#define __MSP430_HAS_PORT2__                  /* Definition to show that Module is available */
472
 
473
SFR_8BIT(P1IN);                               /* Port 1 Input */
474
SFR_8BIT(P1OUT);                              /* Port 1 Output */
475
SFR_8BIT(P1DIR);                              /* Port 1 Direction */
476
SFR_8BIT(P1IFG);                              /* Port 1 Interrupt Flag */
477
SFR_8BIT(P1IES);                              /* Port 1 Interrupt Edge Select */
478
SFR_8BIT(P1IE);                               /* Port 1 Interrupt Enable */
479
SFR_8BIT(P1SEL);                              /* Port 1 Selection */
480
 
481
SFR_8BIT(P2IN);                               /* Port 2 Input */
482
SFR_8BIT(P2OUT);                              /* Port 2 Output */
483
SFR_8BIT(P2DIR);                              /* Port 2 Direction */
484
SFR_8BIT(P2IFG);                              /* Port 2 Interrupt Flag */
485
SFR_8BIT(P2IES);                              /* Port 2 Interrupt Edge Select */
486
SFR_8BIT(P2IE);                               /* Port 2 Interrupt Enable */
487
SFR_8BIT(P2SEL);                              /* Port 2 Selection */
488
 
489
/************************************************************
490
* DIGITAL I/O Port3/4
491
************************************************************/
492
#define __MSP430_HAS_PORT3__                  /* Definition to show that Module is available */
493
#define __MSP430_HAS_PORT4__                  /* Definition to show that Module is available */
494
 
495
SFR_8BIT(P3IN);                               /* Port 3 Input */
496
SFR_8BIT(P3OUT);                              /* Port 3 Output */
497
SFR_8BIT(P3DIR);                              /* Port 3 Direction */
498
SFR_8BIT(P3SEL);                              /* Port 3 Selection */
499
 
500
SFR_8BIT(P4IN);                               /* Port 4 Input */
501
SFR_8BIT(P4OUT);                              /* Port 4 Output */
502
SFR_8BIT(P4DIR);                              /* Port 4 Direction */
503
SFR_8BIT(P4SEL);                              /* Port 4 Selection */
504
 
505
/************************************************************
506
* DIGITAL I/O Port5/6
507
************************************************************/
508
#define __MSP430_HAS_PORT5__                  /* Definition to show that Module is available */
509
#define __MSP430_HAS_PORT6__                  /* Definition to show that Module is available */
510
 
511
SFR_8BIT(P5IN);                               /* Port 5 Input */
512
SFR_8BIT(P5OUT);                              /* Port 5 Output */
513
SFR_8BIT(P5DIR);                              /* Port 5 Direction */
514
SFR_8BIT(P5SEL);                              /* Port 5 Selection */
515
 
516
SFR_8BIT(P6IN);                               /* Port 6 Input */
517
SFR_8BIT(P6OUT);                              /* Port 6 Output */
518
SFR_8BIT(P6DIR);                              /* Port 6 Direction */
519
SFR_8BIT(P6SEL);                              /* Port 6 Selection */
520
 
521
/************************************************************
522
* Brown-Out, Supply Voltage Supervision (SVS)
523
************************************************************/
524
#define __MSP430_HAS_SVS__                    /* Definition to show that Module is available */
525
 
526
SFR_8BIT(SVSCTL);                             /* SVS Control */
527
#define SVSFG                  (0x01)         /* SVS Flag */
528
#define SVSOP                  (0x02)         /* SVS output (read only) */
529
#define SVSON                  (0x04)         /* Switches the SVS on/off */
530
#define PORON                  (0x08)         /* Enable POR Generation if Low Voltage */
531
#define VLD0                   (0x10)
532
#define VLD1                   (0x20)
533
#define VLD2                   (0x40)
534
#define VLD3                   (0x80)
535
 
536
#define VLDON                  (0x10)
537
#define VLDOFF                 (0x00)
538
#define VLD_1_8V               (0x10)
539
 
540
/************************************************************
541
* Timer A3
542
************************************************************/
543
#define __MSP430_HAS_TA3__                    /* Definition to show that Module is available */
544
 
545
SFR_16BIT(TAIV);                              /* Timer A Interrupt Vector Word */
546
SFR_16BIT(TACTL);                             /* Timer A Control */
547
SFR_16BIT(TACCTL0);                           /* Timer A Capture/Compare Control 0 */
548
SFR_16BIT(TACCTL1);                           /* Timer A Capture/Compare Control 1 */
549
SFR_16BIT(TACCTL2);                           /* Timer A Capture/Compare Control 2 */
550
SFR_16BIT(TAR);                               /* Timer A Counter Register */
551
SFR_16BIT(TACCR0);                            /* Timer A Capture/Compare 0 */
552
SFR_16BIT(TACCR1);                            /* Timer A Capture/Compare 1 */
553
SFR_16BIT(TACCR2);                            /* Timer A Capture/Compare 2 */
554
 
555
/* Alternate register names */
556
#define CCTL0                  TACCTL0        /* Timer A Capture/Compare Control 0 */
557
#define CCTL1                  TACCTL1        /* Timer A Capture/Compare Control 1 */
558
#define CCTL2                  TACCTL2        /* Timer A Capture/Compare Control 2 */
559
#define CCR0                   TACCR0         /* Timer A Capture/Compare 0 */
560
#define CCR1                   TACCR1         /* Timer A Capture/Compare 1 */
561
#define CCR2                   TACCR2         /* Timer A Capture/Compare 2 */
562
#define CCTL0_                 TACCTL0_       /* Timer A Capture/Compare Control 0 */
563
#define CCTL1_                 TACCTL1_       /* Timer A Capture/Compare Control 1 */
564
#define CCTL2_                 TACCTL2_       /* Timer A Capture/Compare Control 2 */
565
#define CCR0_                  TACCR0_        /* Timer A Capture/Compare 0 */
566
#define CCR1_                  TACCR1_        /* Timer A Capture/Compare 1 */
567
#define CCR2_                  TACCR2_        /* Timer A Capture/Compare 2 */
568
/* Alternate register names - 5xx style */
569
#define TA0IV                  TAIV           /* Timer A Interrupt Vector Word */
570
#define TA0CTL                 TACTL          /* Timer A Control */
571
#define TA0CCTL0               TACCTL0        /* Timer A Capture/Compare Control 0 */
572
#define TA0CCTL1               TACCTL1        /* Timer A Capture/Compare Control 1 */
573
#define TA0CCTL2               TACCTL2        /* Timer A Capture/Compare Control 2 */
574
#define TA0R                   TAR            /* Timer A Counter Register */
575
#define TA0CCR0                TACCR0         /* Timer A Capture/Compare 0 */
576
#define TA0CCR1                TACCR1         /* Timer A Capture/Compare 1 */
577
#define TA0CCR2                TACCR2         /* Timer A Capture/Compare 2 */
578
#define TA0IV_                 TAIV_          /* Timer A Interrupt Vector Word */
579
#define TA0CTL_                TACTL_         /* Timer A Control */
580
#define TA0CCTL0_              TACCTL0_       /* Timer A Capture/Compare Control 0 */
581
#define TA0CCTL1_              TACCTL1_       /* Timer A Capture/Compare Control 1 */
582
#define TA0CCTL2_              TACCTL2_       /* Timer A Capture/Compare Control 2 */
583
#define TA0R_                  TAR_           /* Timer A Counter Register */
584
#define TA0CCR0_               TACCR0_        /* Timer A Capture/Compare 0 */
585
#define TA0CCR1_               TACCR1_        /* Timer A Capture/Compare 1 */
586
#define TA0CCR2_               TACCR2_        /* Timer A Capture/Compare 2 */
587
 
588
#define TASSEL1                (0x0200)       /* Timer A clock source select 0 */
589
#define TASSEL0                (0x0100)       /* Timer A clock source select 1 */
590
#define ID1                    (0x0080)       /* Timer A clock input divider 1 */
591
#define ID0                    (0x0040)       /* Timer A clock input divider 0 */
592
#define MC1                    (0x0020)       /* Timer A mode control 1 */
593
#define MC0                    (0x0010)       /* Timer A mode control 0 */
594
#define TACLR                  (0x0004)       /* Timer A counter clear */
595
#define TAIE                   (0x0002)       /* Timer A counter interrupt enable */
596
#define TAIFG                  (0x0001)       /* Timer A counter interrupt flag */
597
 
598
#define MC_0                   (0*0x10u)      /* Timer A mode control: 0 - Stop */
599
#define MC_1                   (1*0x10u)      /* Timer A mode control: 1 - Up to CCR0 */
600
#define MC_2                   (2*0x10u)      /* Timer A mode control: 2 - Continous up */
601
#define MC_3                   (3*0x10u)      /* Timer A mode control: 3 - Up/Down */
602
#define ID_0                   (0*0x40u)      /* Timer A input divider: 0 - /1 */
603
#define ID_1                   (1*0x40u)      /* Timer A input divider: 1 - /2 */
604
#define ID_2                   (2*0x40u)      /* Timer A input divider: 2 - /4 */
605
#define ID_3                   (3*0x40u)      /* Timer A input divider: 3 - /8 */
606
#define TASSEL_0               (0*0x100u)     /* Timer A clock source select: 0 - TACLK */
607
#define TASSEL_1               (1*0x100u)     /* Timer A clock source select: 1 - ACLK  */
608
#define TASSEL_2               (2*0x100u)     /* Timer A clock source select: 2 - SMCLK */
609
#define TASSEL_3               (3*0x100u)     /* Timer A clock source select: 3 - INCLK */
610
 
611
#define CM1                    (0x8000)       /* Capture mode 1 */
612
#define CM0                    (0x4000)       /* Capture mode 0 */
613
#define CCIS1                  (0x2000)       /* Capture input select 1 */
614
#define CCIS0                  (0x1000)       /* Capture input select 0 */
615
#define SCS                    (0x0800)       /* Capture sychronize */
616
#define SCCI                   (0x0400)       /* Latched capture signal (read) */
617
#define CAP                    (0x0100)       /* Capture mode: 1 /Compare mode : 0 */
618
#define OUTMOD2                (0x0080)       /* Output mode 2 */
619
#define OUTMOD1                (0x0040)       /* Output mode 1 */
620
#define OUTMOD0                (0x0020)       /* Output mode 0 */
621
#define CCIE                   (0x0010)       /* Capture/compare interrupt enable */
622
#define CCI                    (0x0008)       /* Capture input signal (read) */
623
#define OUT                    (0x0004)       /* PWM Output signal if output mode 0 */
624
#define COV                    (0x0002)       /* Capture/compare overflow flag */
625
#define CCIFG                  (0x0001)       /* Capture/compare interrupt flag */
626
 
627
#define OUTMOD_0               (0*0x20u)      /* PWM output mode: 0 - output only */
628
#define OUTMOD_1               (1*0x20u)      /* PWM output mode: 1 - set */
629
#define OUTMOD_2               (2*0x20u)      /* PWM output mode: 2 - PWM toggle/reset */
630
#define OUTMOD_3               (3*0x20u)      /* PWM output mode: 3 - PWM set/reset */
631
#define OUTMOD_4               (4*0x20u)      /* PWM output mode: 4 - toggle */
632
#define OUTMOD_5               (5*0x20u)      /* PWM output mode: 5 - Reset */
633
#define OUTMOD_6               (6*0x20u)      /* PWM output mode: 6 - PWM toggle/set */
634
#define OUTMOD_7               (7*0x20u)      /* PWM output mode: 7 - PWM reset/set */
635
#define CCIS_0                 (0*0x1000u)    /* Capture input select: 0 - CCIxA */
636
#define CCIS_1                 (1*0x1000u)    /* Capture input select: 1 - CCIxB */
637
#define CCIS_2                 (2*0x1000u)    /* Capture input select: 2 - GND */
638
#define CCIS_3                 (3*0x1000u)    /* Capture input select: 3 - Vcc */
639
#define CM_0                   (0*0x4000u)    /* Capture mode: 0 - disabled */
640
#define CM_1                   (1*0x4000u)    /* Capture mode: 1 - pos. edge */
641
#define CM_2                   (2*0x4000u)    /* Capture mode: 1 - neg. edge */
642
#define CM_3                   (3*0x4000u)    /* Capture mode: 1 - both edges */
643
 
644
/* TA3IV Definitions */
645
#define TAIV_NONE              (0x0000)       /* No Interrupt pending */
646
#define TAIV_TACCR1            (0x0002)       /* TACCR1_CCIFG */
647
#define TAIV_TACCR2            (0x0004)       /* TACCR2_CCIFG */
648
#define TAIV_6                 (0x0006)       /* Reserved */
649
#define TAIV_8                 (0x0008)       /* Reserved */
650
#define TAIV_TAIFG             (0x000A)       /* TAIFG */
651
 
652
/************************************************************
653
* Timer B3
654
************************************************************/
655
#define __MSP430_HAS_TB3__                    /* Definition to show that Module is available */
656
 
657
SFR_16BIT(TBIV);                              /* Timer B Interrupt Vector Word */
658
SFR_16BIT(TBCTL);                             /* Timer B Control */
659
SFR_16BIT(TBCCTL0);                           /* Timer B Capture/Compare Control 0 */
660
SFR_16BIT(TBCCTL1);                           /* Timer B Capture/Compare Control 1 */
661
SFR_16BIT(TBCCTL2);                           /* Timer B Capture/Compare Control 2 */
662
SFR_16BIT(TBR);                               /* Timer B Counter Register */
663
SFR_16BIT(TBCCR0);                            /* Timer B Capture/Compare 0 */
664
SFR_16BIT(TBCCR1);                            /* Timer B Capture/Compare 1 */
665
SFR_16BIT(TBCCR2);                            /* Timer B Capture/Compare 2 */
666
 
667
/* Alternate register names - 5xx style */
668
#define TB0IV                  TBIV           /* Timer B Interrupt Vector Word */
669
#define TB0CTL                 TBCTL          /* Timer B Control */
670
#define TB0CCTL0               TBCCTL0        /* Timer B Capture/Compare Control 0 */
671
#define TB0CCTL1               TBCCTL1        /* Timer B Capture/Compare Control 1 */
672
#define TB0CCTL2               TBCCTL2        /* Timer B Capture/Compare Control 2 */
673
#define TB0R                   TBR            /* Timer B Counter Register */
674
#define TB0CCR0                TBCCR0         /* Timer B Capture/Compare 0 */
675
#define TB0CCR1                TBCCR1         /* Timer B Capture/Compare 1 */
676
#define TB0CCR2                TBCCR2         /* Timer B Capture/Compare 2 */
677
#define TB0IV_                 TBIV_          /* Timer B Interrupt Vector Word */
678
#define TB0CTL_                TBCTL_         /* Timer B Control */
679
#define TB0CCTL0_              TBCCTL0_       /* Timer B Capture/Compare Control 0 */
680
#define TB0CCTL1_              TBCCTL1_       /* Timer B Capture/Compare Control 1 */
681
#define TB0CCTL2_              TBCCTL2_       /* Timer B Capture/Compare Control 2 */
682
#define TB0R_                  TBR_           /* Timer B Counter Register */
683
#define TB0CCR0_               TBCCR0_        /* Timer B Capture/Compare 0 */
684
#define TB0CCR1_               TBCCR1_        /* Timer B Capture/Compare 1 */
685
#define TB0CCR2_               TBCCR2_        /* Timer B Capture/Compare 2 */
686
 
687
#define TBCLGRP1               (0x4000)       /* Timer B Compare latch load group 1 */
688
#define TBCLGRP0               (0x2000)       /* Timer B Compare latch load group 0 */
689
#define CNTL1                  (0x1000)       /* Counter lenght 1 */
690
#define CNTL0                  (0x0800)       /* Counter lenght 0 */
691
#define TBSSEL1                (0x0200)       /* Clock source 1 */
692
#define TBSSEL0                (0x0100)       /* Clock source 0 */
693
#define TBCLR                  (0x0004)       /* Timer B counter clear */
694
#define TBIE                   (0x0002)       /* Timer B interrupt enable */
695
#define TBIFG                  (0x0001)       /* Timer B interrupt flag */
696
 
697
#define SHR1                   (0x4000)       /* Timer B Compare latch load group 1 */
698
#define SHR0                   (0x2000)       /* Timer B Compare latch load group 0 */
699
 
700
#define TBSSEL_0               (0*0x0100u)    /* Clock Source: TBCLK */
701
#define TBSSEL_1               (1*0x0100u)    /* Clock Source: ACLK  */
702
#define TBSSEL_2               (2*0x0100u)    /* Clock Source: SMCLK */
703
#define TBSSEL_3               (3*0x0100u)    /* Clock Source: INCLK */
704
#define CNTL_0                 (0*0x0800u)    /* Counter lenght: 16 bit */
705
#define CNTL_1                 (1*0x0800u)    /* Counter lenght: 12 bit */
706
#define CNTL_2                 (2*0x0800u)    /* Counter lenght: 10 bit */
707
#define CNTL_3                 (3*0x0800u)    /* Counter lenght:  8 bit */
708
#define SHR_0                  (0*0x2000u)    /* Timer B Group: 0 - individually */
709
#define SHR_1                  (1*0x2000u)    /* Timer B Group: 1 - 3 groups (1-2, 3-4, 5-6) */
710
#define SHR_2                  (2*0x2000u)    /* Timer B Group: 2 - 2 groups (1-3, 4-6)*/
711
#define SHR_3                  (3*0x2000u)    /* Timer B Group: 3 - 1 group (all) */
712
#define TBCLGRP_0              (0*0x2000u)    /* Timer B Group: 0 - individually */
713
#define TBCLGRP_1              (1*0x2000u)    /* Timer B Group: 1 - 3 groups (1-2, 3-4, 5-6) */
714
#define TBCLGRP_2              (2*0x2000u)    /* Timer B Group: 2 - 2 groups (1-3, 4-6)*/
715
#define TBCLGRP_3              (3*0x2000u)    /* Timer B Group: 3 - 1 group (all) */
716
 
717
/* Additional Timer B Control Register bits are defined in Timer A */
718
 
719
#define CLLD1                  (0x0400)       /* Compare latch load source 1 */
720
#define CLLD0                  (0x0200)       /* Compare latch load source 0 */
721
 
722
#define SLSHR1                 (0x0400)       /* Compare latch load source 1 */
723
#define SLSHR0                 (0x0200)       /* Compare latch load source 0 */
724
 
725
#define SLSHR_0                (0*0x0200u)    /* Compare latch load sourec : 0 - immediate */
726
#define SLSHR_1                (1*0x0200u)    /* Compare latch load sourec : 1 - TBR counts to 0 */
727
#define SLSHR_2                (2*0x0200u)    /* Compare latch load sourec : 2 - up/down */
728
#define SLSHR_3                (3*0x0200u)    /* Compare latch load sourec : 3 - TBR counts to TBCTL0 */
729
 
730
#define CLLD_0                 (0*0x0200u)    /* Compare latch load sourec : 0 - immediate */
731
#define CLLD_1                 (1*0x0200u)    /* Compare latch load sourec : 1 - TBR counts to 0 */
732
#define CLLD_2                 (2*0x0200u)    /* Compare latch load sourec : 2 - up/down */
733
#define CLLD_3                 (3*0x0200u)    /* Compare latch load sourec : 3 - TBR counts to TBCTL0 */
734
 
735
/* TB3IV Definitions */
736
#define TBIV_NONE              (0x0000)       /* No Interrupt pending */
737
#define TBIV_TBCCR1            (0x0002)       /* TBCCR1_CCIFG */
738
#define TBIV_TBCCR2            (0x0004)       /* TBCCR2_CCIFG */
739
#define TBIV_3                 (0x0006)       /* Reserved */
740
#define TBIV_4                 (0x0008)       /* Reserved */
741
#define TBIV_5                 (0x000A)       /* Reserved */
742
#define TBIV_6                 (0x000C)       /* Reserved */
743
#define TBIV_TBIFG             (0x000E)       /* TBIFG */
744
 
745
/************************************************************
746
* USART
747
************************************************************/
748
 
749
/* UxCTL */
750
#define PENA                   (0x80)         /* Parity enable */
751
#define PEV                    (0x40)         /* Parity 0:odd / 1:even */
752
#define SPB                    (0x20)         /* Stop Bits 0:one / 1: two */
753
#define CHAR                   (0x10)         /* Data 0:7-bits / 1:8-bits */
754
#define LISTEN                 (0x08)         /* Listen mode */
755
#define SYNC                   (0x04)         /* UART / SPI mode */
756
#define MM                     (0x02)         /* Master Mode off/on */
757
#define SWRST                  (0x01)         /* USART Software Reset */
758
 
759
/* UxTCTL */
760
#define CKPH                   (0x80)         /* SPI: Clock Phase */
761
#define CKPL                   (0x40)         /* Clock Polarity */
762
#define SSEL1                  (0x20)         /* Clock Source Select 1 */
763
#define SSEL0                  (0x10)         /* Clock Source Select 0 */
764
#define URXSE                  (0x08)         /* Receive Start edge select */
765
#define TXWAKE                 (0x04)         /* TX Wake up mode */
766
#define STC                    (0x02)         /* SPI: STC enable 0:on / 1:off */
767
#define TXEPT                  (0x01)         /* TX Buffer empty */
768
 
769
/* UxRCTL */
770
#define FE                     (0x80)         /* Frame Error */
771
#define PE                     (0x40)         /* Parity Error */
772
#define OE                     (0x20)         /* Overrun Error */
773
#define BRK                    (0x10)         /* Break detected */
774
#define URXEIE                 (0x08)         /* RX Error interrupt enable */
775
#define URXWIE                 (0x04)         /* RX Wake up interrupt enable */
776
#define RXWAKE                 (0x02)         /* RX Wake up detect */
777
#define RXERR                  (0x01)         /* RX Error Error */
778
 
779
/************************************************************
780
* USART 0
781
************************************************************/
782
#define __MSP430_HAS_UART0__                  /* Definition to show that Module is available */
783
 
784
SFR_8BIT(U0CTL);                              /* USART 0 Control */
785
SFR_8BIT(U0TCTL);                             /* USART 0 Transmit Control */
786
SFR_8BIT(U0RCTL);                             /* USART 0 Receive Control */
787
SFR_8BIT(U0MCTL);                             /* USART 0 Modulation Control */
788
SFR_8BIT(U0BR0);                              /* USART 0 Baud Rate 0 */
789
SFR_8BIT(U0BR1);                              /* USART 0 Baud Rate 1 */
790
SFR_8BIT(U0RXBUF);                            /* USART 0 Receive Buffer */
791
SFR_8BIT(U0TXBUF);                            /* USART 0 Transmit Buffer */
792
 
793
/* Alternate register names */
794
 
795
#define UCTL0                  U0CTL          /* USART 0 Control */
796
#define UTCTL0                 U0TCTL         /* USART 0 Transmit Control */
797
#define URCTL0                 U0RCTL         /* USART 0 Receive Control */
798
#define UMCTL0                 U0MCTL         /* USART 0 Modulation Control */
799
#define UBR00                  U0BR0          /* USART 0 Baud Rate 0 */
800
#define UBR10                  U0BR1          /* USART 0 Baud Rate 1 */
801
#define RXBUF0                 U0RXBUF        /* USART 0 Receive Buffer */
802
#define TXBUF0                 U0TXBUF        /* USART 0 Transmit Buffer */
803
#define UCTL0_                 U0CTL_         /* USART 0 Control */
804
#define UTCTL0_                U0TCTL_        /* USART 0 Transmit Control */
805
#define URCTL0_                U0RCTL_        /* USART 0 Receive Control */
806
#define UMCTL0_                U0MCTL_        /* USART 0 Modulation Control */
807
#define UBR00_                 U0BR0_         /* USART 0 Baud Rate 0 */
808
#define UBR10_                 U0BR1_         /* USART 0 Baud Rate 1 */
809
#define RXBUF0_                U0RXBUF_       /* USART 0 Receive Buffer */
810
#define TXBUF0_                U0TXBUF_       /* USART 0 Transmit Buffer */
811
#define UCTL_0                 U0CTL          /* USART 0 Control */
812
#define UTCTL_0                U0TCTL         /* USART 0 Transmit Control */
813
#define URCTL_0                U0RCTL         /* USART 0 Receive Control */
814
#define UMCTL_0                U0MCTL         /* USART 0 Modulation Control */
815
#define UBR0_0                 U0BR0          /* USART 0 Baud Rate 0 */
816
#define UBR1_0                 U0BR1          /* USART 0 Baud Rate 1 */
817
#define RXBUF_0                U0RXBUF        /* USART 0 Receive Buffer */
818
#define TXBUF_0                U0TXBUF        /* USART 0 Transmit Buffer */
819
#define UCTL_0_                U0CTL_         /* USART 0 Control */
820
#define UTCTL_0_               U0TCTL_        /* USART 0 Transmit Control */
821
#define URCTL_0_               U0RCTL_        /* USART 0 Receive Control */
822
#define UMCTL_0_               U0MCTL_        /* USART 0 Modulation Control */
823
#define UBR0_0_                U0BR0_         /* USART 0 Baud Rate 0 */
824
#define UBR1_0_                U0BR1_         /* USART 0 Baud Rate 1 */
825
#define RXBUF_0_               U0RXBUF_       /* USART 0 Receive Buffer */
826
#define TXBUF_0_               U0TXBUF_       /* USART 0 Transmit Buffer */
827
 
828
/************************************************************
829
* WATCHDOG TIMER
830
************************************************************/
831
#define __MSP430_HAS_WDT__                    /* Definition to show that Module is available */
832
 
833
SFR_16BIT(WDTCTL);                            /* Watchdog Timer Control */
834
/* The bit names have been prefixed with "WDT" */
835
#define WDTIS0                 (0x0001)
836
#define WDTIS1                 (0x0002)
837
#define WDTSSEL                (0x0004)
838
#define WDTCNTCL               (0x0008)
839
#define WDTTMSEL               (0x0010)
840
#define WDTNMI                 (0x0020)
841
#define WDTNMIES               (0x0040)
842
#define WDTHOLD                (0x0080)
843
 
844
#define WDTPW                  (0x5A00)
845
 
846
/* WDT-interval times [1ms] coded with Bits 0-2 */
847
/* WDT is clocked by fSMCLK (assumed 1MHz) */
848
#define WDT_MDLY_32         (WDTPW+WDTTMSEL+WDTCNTCL)                         /* 32ms interval (default) */
849
#define WDT_MDLY_8          (WDTPW+WDTTMSEL+WDTCNTCL+WDTIS0)                  /* 8ms     " */
850
#define WDT_MDLY_0_5        (WDTPW+WDTTMSEL+WDTCNTCL+WDTIS1)                  /* 0.5ms   " */
851
#define WDT_MDLY_0_064      (WDTPW+WDTTMSEL+WDTCNTCL+WDTIS1+WDTIS0)           /* 0.064ms " */
852
/* WDT is clocked by fACLK (assumed 32KHz) */
853
#define WDT_ADLY_1000       (WDTPW+WDTTMSEL+WDTCNTCL+WDTSSEL)                 /* 1000ms  " */
854
#define WDT_ADLY_250        (WDTPW+WDTTMSEL+WDTCNTCL+WDTSSEL+WDTIS0)          /* 250ms   " */
855
#define WDT_ADLY_16         (WDTPW+WDTTMSEL+WDTCNTCL+WDTSSEL+WDTIS1)          /* 16ms    " */
856
#define WDT_ADLY_1_9        (WDTPW+WDTTMSEL+WDTCNTCL+WDTSSEL+WDTIS1+WDTIS0)   /* 1.9ms   " */
857
/* Watchdog mode -> reset after expired time */
858
/* WDT is clocked by fSMCLK (assumed 1MHz) */
859
#define WDT_MRST_32         (WDTPW+WDTCNTCL)                                  /* 32ms interval (default) */
860
#define WDT_MRST_8          (WDTPW+WDTCNTCL+WDTIS0)                           /* 8ms     " */
861
#define WDT_MRST_0_5        (WDTPW+WDTCNTCL+WDTIS1)                           /* 0.5ms   " */
862
#define WDT_MRST_0_064      (WDTPW+WDTCNTCL+WDTIS1+WDTIS0)                    /* 0.064ms " */
863
/* WDT is clocked by fACLK (assumed 32KHz) */
864
#define WDT_ARST_1000       (WDTPW+WDTCNTCL+WDTSSEL)                          /* 1000ms  " */
865
#define WDT_ARST_250        (WDTPW+WDTCNTCL+WDTSSEL+WDTIS0)                   /* 250ms   " */
866
#define WDT_ARST_16         (WDTPW+WDTCNTCL+WDTSSEL+WDTIS1)                   /* 16ms    " */
867
#define WDT_ARST_1_9        (WDTPW+WDTCNTCL+WDTSSEL+WDTIS1+WDTIS0)            /* 1.9ms   " */
868
 
869
/* INTERRUPT CONTROL */
870
/* These two bits are defined in the Special Function Registers */
871
/* #define WDTIE               0x01 */
872
/* #define WDTIFG              0x01 */
873
 
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
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
899
#define PORT1_VECTOR            ".int04"                    /* 0xFFE8 Port 1 */
900
#else
901
#define PORT1_VECTOR            (4 * 1u)                     /* 0xFFE8 Port 1 */
902
/*#define PORT1_ISR(func)         ISR_VECTOR(func, ".int04")  */ /* 0xFFE8 Port 1 */ /* CCE V2 Style */
903
#endif
904
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
905
#define TIMERA1_VECTOR          ".int05"                    /* 0xFFEA Timer A CC1-2, TA */
906
#else
907
#define TIMERA1_VECTOR          (5 * 1u)                     /* 0xFFEA Timer A CC1-2, TA */
908
/*#define TIMERA1_ISR(func)       ISR_VECTOR(func, ".int05")  */ /* 0xFFEA Timer A CC1-2, TA */ /* CCE V2 Style */
909
#endif
910
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
911
#define TIMERA0_VECTOR          ".int06"                    /* 0xFFEC Timer A CC0 */
912
#else
913
#define TIMERA0_VECTOR          (6 * 1u)                     /* 0xFFEC Timer A CC0 */
914
/*#define TIMERA0_ISR(func)       ISR_VECTOR(func, ".int06")  */ /* 0xFFEC Timer A CC0 */ /* CCE V2 Style */
915
#endif
916
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
917
#define USART0TX_VECTOR         ".int08"                    /* 0xFFF0 USART 0 Transmit */
918
#else
919
#define USART0TX_VECTOR         (8 * 1u)                     /* 0xFFF0 USART 0 Transmit */
920
/*#define USART0TX_ISR(func)      ISR_VECTOR(func, ".int08")  */ /* 0xFFF0 USART 0 Transmit */ /* CCE V2 Style */
921
#endif
922
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
923
#define USART0RX_VECTOR         ".int09"                    /* 0xFFF2 USART 0 Receive */
924
#else
925
#define USART0RX_VECTOR         (9 * 1u)                     /* 0xFFF2 USART 0 Receive */
926
/*#define USART0RX_ISR(func)      ISR_VECTOR(func, ".int09")  */ /* 0xFFF2 USART 0 Receive */ /* CCE V2 Style */
927
#endif
928
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
929
#define WDT_VECTOR              ".int10"                    /* 0xFFF4 Watchdog Timer */
930
#else
931
#define WDT_VECTOR              (10 * 1u)                    /* 0xFFF4 Watchdog Timer */
932
/*#define WDT_ISR(func)           ISR_VECTOR(func, ".int10")  */ /* 0xFFF4 Watchdog Timer */ /* CCE V2 Style */
933
#endif
934
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
935
#define COMPARATORA_VECTOR      ".int11"                    /* 0xFFF6 Comparator A */
936
#else
937
#define COMPARATORA_VECTOR      (11 * 1u)                    /* 0xFFF6 Comparator A */
938
/*#define COMPARATORA_ISR(func)   ISR_VECTOR(func, ".int11")  */ /* 0xFFF6 Comparator A */ /* CCE V2 Style */
939
#endif
940
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
941
#define TIMERB1_VECTOR          ".int12"                    /* 0xFFF8 Timer B CC1-2, TB */
942
#else
943
#define TIMERB1_VECTOR          (12 * 1u)                    /* 0xFFF8 Timer B CC1-2, TB */
944
/*#define TIMERB1_ISR(func)       ISR_VECTOR(func, ".int12")  */ /* 0xFFF8 Timer B CC1-2, TB */ /* CCE V2 Style */
945
#endif
946
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
947
#define TIMERB0_VECTOR          ".int13"                    /* 0xFFFA Timer B CC0 */
948
#else
949
#define TIMERB0_VECTOR          (13 * 1u)                    /* 0xFFFA Timer B CC0 */
950
/*#define TIMERB0_ISR(func)       ISR_VECTOR(func, ".int13")  */ /* 0xFFFA Timer B CC0 */ /* CCE V2 Style */
951
#endif
952
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
953
#define NMI_VECTOR              ".int14"                    /* 0xFFFC Non-maskable */
954
#else
955
#define NMI_VECTOR              (14 * 1u)                    /* 0xFFFC Non-maskable */
956
/*#define NMI_ISR(func)           ISR_VECTOR(func, ".int14")  */ /* 0xFFFC Non-maskable */ /* CCE V2 Style */
957
#endif
958
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
959
#define RESET_VECTOR            ".reset"                    /* 0xFFFE Reset [Highest Priority] */
960
#else
961
#define RESET_VECTOR            (15 * 1u)                    /* 0xFFFE Reset [Highest Priority] */
962
/*#define RESET_ISR(func)         ISR_VECTOR(func, ".int15")  */ /* 0xFFFE Reset [Highest Priority] */ /* CCE V2 Style */
963
#endif
964
 
965
 
966
/************************************************************
967
* End of Modules
968
************************************************************/
969
 
970
#ifdef __cplusplus
971
}
972
#endif /* extern "C" */
973
 
974
#endif /* #ifndef __msp430x43x1 */
975