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