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
* MSP430x41x2 devices.
8
*
9
* Texas Instruments, Version 1.2
10
*
11
* Rev. 1.0, First Release
12
* Rev. 1.1, Fixed typo in ADC10: SREF3 -> SREF2
13
* Rev. 1.2, Corrected OSCCAP settings
14
*
15
********************************************************************/
16
 
17
#ifndef __msp430x41x2
18
#define __msp430x41x2
19
 
20
#ifdef __cplusplus
21
extern "C" {
22
#endif
23
 
24
 
25
/*----------------------------------------------------------------------------*/
26
/* PERIPHERAL FILE MAP                                                        */
27
/*----------------------------------------------------------------------------*/
28
 
29
/* External references resolved by a device-specific linker command file */
30
#define SFR_8BIT(address)   extern volatile unsigned char address
31
#define SFR_16BIT(address)  extern volatile unsigned int address
32
 
33
 
34
/************************************************************
35
* STANDARD BITS
36
************************************************************/
37
 
38
#define BIT0                   (0x0001)
39
#define BIT1                   (0x0002)
40
#define BIT2                   (0x0004)
41
#define BIT3                   (0x0008)
42
#define BIT4                   (0x0010)
43
#define BIT5                   (0x0020)
44
#define BIT6                   (0x0040)
45
#define BIT7                   (0x0080)
46
#define BIT8                   (0x0100)
47
#define BIT9                   (0x0200)
48
#define BITA                   (0x0400)
49
#define BITB                   (0x0800)
50
#define BITC                   (0x1000)
51
#define BITD                   (0x2000)
52
#define BITE                   (0x4000)
53
#define BITF                   (0x8000)
54
 
55
/************************************************************
56
* STATUS REGISTER BITS
57
************************************************************/
58
 
59
#define C                      (0x0001)
60
#define Z                      (0x0002)
61
#define N                      (0x0004)
62
#define V                      (0x0100)
63
#define GIE                    (0x0008)
64
#define CPUOFF                 (0x0010)
65
#define OSCOFF                 (0x0020)
66
#define SCG0                   (0x0040)
67
#define SCG1                   (0x0080)
68
 
69
/* Low Power Modes coded with Bits 4-7 in SR */
70
 
71
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
72
#define LPM0                   (CPUOFF)
73
#define LPM1                   (SCG0+CPUOFF)
74
#define LPM2                   (SCG1+CPUOFF)
75
#define LPM3                   (SCG1+SCG0+CPUOFF)
76
#define LPM4                   (SCG1+SCG0+OSCOFF+CPUOFF)
77
/* End #defines for assembler */
78
 
79
#else /* Begin #defines for C */
80
#define LPM0_bits              (CPUOFF)
81
#define LPM1_bits              (SCG0+CPUOFF)
82
#define LPM2_bits              (SCG1+CPUOFF)
83
#define LPM3_bits              (SCG1+SCG0+CPUOFF)
84
#define LPM4_bits              (SCG1+SCG0+OSCOFF+CPUOFF)
85
 
86
#include "in430.h"
87
 
88
#define LPM0         _bis_SR_register(LPM0_bits)         /* Enter Low Power Mode 0 */
89
#define LPM0_EXIT    _bic_SR_register_on_exit(LPM0_bits) /* Exit Low Power Mode 0 */
90
#define LPM1         _bis_SR_register(LPM1_bits)         /* Enter Low Power Mode 1 */
91
#define LPM1_EXIT    _bic_SR_register_on_exit(LPM1_bits) /* Exit Low Power Mode 1 */
92
#define LPM2         _bis_SR_register(LPM2_bits)         /* Enter Low Power Mode 2 */
93
#define LPM2_EXIT    _bic_SR_register_on_exit(LPM2_bits) /* Exit Low Power Mode 2 */
94
#define LPM3         _bis_SR_register(LPM3_bits)         /* Enter Low Power Mode 3 */
95
#define LPM3_EXIT    _bic_SR_register_on_exit(LPM3_bits) /* Exit Low Power Mode 3 */
96
#define LPM4         _bis_SR_register(LPM4_bits)         /* Enter Low Power Mode 4 */
97
#define LPM4_EXIT    _bic_SR_register_on_exit(LPM4_bits) /* Exit Low Power Mode 4 */
98
#endif /* End #defines for C */
99
 
100
/************************************************************
101
* PERIPHERAL FILE MAP
102
************************************************************/
103
 
104
/************************************************************
105
* SPECIAL FUNCTION REGISTER ADDRESSES + CONTROL BITS
106
************************************************************/
107
 
108
SFR_8BIT(IE1);                                /* Interrupt Enable 1 */
109
#define WDTIE                  (0x01)         /* Watchdog Interrupt Enable */
110
#define OFIE                   (0x02)         /* Osc. Fault  Interrupt Enable */
111
#define NMIIE                  (0x10)         /* NMI Interrupt Enable */
112
#define ACCVIE                 (0x20)         /* Flash Access Violation Interrupt Enable */
113
 
114
SFR_8BIT(IFG1);                               /* Interrupt Flag 1 */
115
#define WDTIFG                 (0x01)         /* Watchdog Interrupt Flag */
116
#define OFIFG                  (0x02)         /* Osc. Fault Interrupt Flag */
117
#define PORIFG                 (0x04)         /* Power On Interrupt Flag */
118
#define RSTIFG                 (0x08)         /* Reset Interrupt Flag */
119
#define NMIIFG                 (0x10)         /* NMI Interrupt Flag */
120
 
121
SFR_8BIT(IE2);                                /* Interrupt Enable 2 */
122
#define UC0IE                  IE2
123
#define UCA0RXIE               (0x01)
124
#define UCA0TXIE               (0x02)
125
#define UCB0RXIE               (0x04)
126
#define UCB0TXIE               (0x08)
127
#define BTIE                   (0x80)
128
 
129
SFR_8BIT(IFG2);                               /* Interrupt Flag 2 */
130
#define UC0IFG                 IFG2
131
#define UCA0RXIFG              (0x01)
132
#define UCA0TXIFG              (0x02)
133
#define UCB0RXIFG              (0x04)
134
#define UCB0TXIFG              (0x08)
135
#define BTIFG                  (0x80)
136
 
137
/************************************************************
138
* ADC10
139
************************************************************/
140
#define __MSP430_HAS_ADC10__                  /* Definition to show that Module is available */
141
 
142
SFR_8BIT(ADC10DTC0);                          /* ADC10 Data Transfer Control 0 */
143
SFR_8BIT(ADC10DTC1);                          /* ADC10 Data Transfer Control 1 */
144
SFR_8BIT(ADC10AE0);                           /* ADC10 Analog Enable 0 */
145
SFR_8BIT(ADC10AE1);                           /* ADC10 Analog Enable 1 */
146
 
147
SFR_16BIT(ADC10CTL0);                         /* ADC10 Control 0 */
148
SFR_16BIT(ADC10CTL1);                         /* ADC10 Control 1 */
149
SFR_16BIT(ADC10MEM);                          /* ADC10 Memory */
150
SFR_16BIT(ADC10SA);                           /* ADC10 Data Transfer Start Address */
151
 
152
/* ADC10CTL0 */
153
#define ADC10SC                (0x001)        /* ADC10 Start Conversion */
154
#define ENC                    (0x002)        /* ADC10 Enable Conversion */
155
#define ADC10IFG               (0x004)        /* ADC10 Interrupt Flag */
156
#define ADC10IE                (0x008)        /* ADC10 Interrupt Enalbe */
157
#define ADC10ON                (0x010)        /* ADC10 On/Enable */
158
#define REFON                  (0x020)        /* ADC10 Reference on */
159
#define REF2_5V                (0x040)        /* ADC10 Ref 0:1.5V / 1:2.5V */
160
#define MSC                    (0x080)        /* ADC10 Multiple SampleConversion */
161
#define REFBURST               (0x100)        /* ADC10 Reference Burst Mode */
162
#define REFOUT                 (0x200)        /* ADC10 Enalbe output of Ref. */
163
#define ADC10SR                (0x400)        /* ADC10 Sampling Rate 0:200ksps / 1:50ksps */
164
#define ADC10SHT0              (0x800)        /* ADC10 Sample Hold Select Bit: 0 */
165
#define ADC10SHT1              (0x1000)       /* ADC10 Sample Hold Select Bit: 1 */
166
#define SREF0                  (0x2000)       /* ADC10 Reference Select Bit: 0 */
167
#define SREF1                  (0x4000)       /* ADC10 Reference Select Bit: 1 */
168
#define SREF2                  (0x8000)       /* ADC10 Reference Select Bit: 2 */
169
#define ADC10SHT_0             (0*0x800u)     /* 4 x ADC10CLKs */
170
#define ADC10SHT_1             (1*0x800u)     /* 8 x ADC10CLKs */
171
#define ADC10SHT_2             (2*0x800u)     /* 16 x ADC10CLKs */
172
#define ADC10SHT_3             (3*0x800u)     /* 64 x ADC10CLKs */
173
 
174
#define SREF_0                 (0*0x2000u)    /* VR+ = AVCC and VR- = AVSS */
175
#define SREF_1                 (1*0x2000u)    /* VR+ = VREF+ and VR- = AVSS */
176
#define SREF_2                 (2*0x2000u)    /* VR+ = VEREF+ and VR- = AVSS */
177
#define SREF_3                 (3*0x2000u)    /* VR+ = VEREF+ and VR- = AVSS */
178
#define SREF_4                 (4*0x2000u)    /* VR+ = AVCC and VR- = VREF-/VEREF- */
179
#define SREF_5                 (5*0x2000u)    /* VR+ = VREF+ and VR- = VREF-/VEREF- */
180
#define SREF_6                 (6*0x2000u)    /* VR+ = VEREF+ and VR- = VREF-/VEREF- */
181
#define SREF_7                 (7*0x2000u)    /* VR+ = VEREF+ and VR- = VREF-/VEREF- */
182
 
183
/* ADC10CTL1 */
184
#define ADC10BUSY              (0x0001)       /* ADC10 BUSY */
185
#define CONSEQ0                (0x0002)       /* ADC10 Conversion Sequence Select 0 */
186
#define CONSEQ1                (0x0004)       /* ADC10 Conversion Sequence Select 1 */
187
#define ADC10SSEL0             (0x0008)       /* ADC10 Clock Source Select Bit: 0 */
188
#define ADC10SSEL1             (0x0010)       /* ADC10 Clock Source Select Bit: 1 */
189
#define ADC10DIV0              (0x0020)       /* ADC10 Clock Divider Select Bit: 0 */
190
#define ADC10DIV1              (0x0040)       /* ADC10 Clock Divider Select Bit: 1 */
191
#define ADC10DIV2              (0x0080)       /* ADC10 Clock Divider Select Bit: 2 */
192
#define ISSH                   (0x0100)       /* ADC10 Invert Sample Hold Signal */
193
#define ADC10DF                (0x0200)       /* ADC10 Data Format 0:binary 1:2's complement */
194
#define SHS0                   (0x0400)       /* ADC10 Sample/Hold Source Bit: 0 */
195
#define SHS1                   (0x0800)       /* ADC10 Sample/Hold Source Bit: 1 */
196
#define INCH0                  (0x1000)       /* ADC10 Input Channel Select Bit: 0 */
197
#define INCH1                  (0x2000)       /* ADC10 Input Channel Select Bit: 1 */
198
#define INCH2                  (0x4000)       /* ADC10 Input Channel Select Bit: 2 */
199
#define INCH3                  (0x8000)       /* ADC10 Input Channel Select Bit: 3 */
200
 
201
#define CONSEQ_0               (0*2u)         /* Single channel single conversion */
202
#define CONSEQ_1               (1*2u)         /* Sequence of channels */
203
#define CONSEQ_2               (2*2u)         /* Repeat single channel */
204
#define CONSEQ_3               (3*2u)         /* Repeat sequence of channels */
205
 
206
#define ADC10SSEL_0            (0*8u)         /* ADC10OSC */
207
#define ADC10SSEL_1            (1*8u)         /* ACLK */
208
#define ADC10SSEL_2            (2*8u)         /* MCLK */
209
#define ADC10SSEL_3            (3*8u)         /* SMCLK */
210
 
211
#define ADC10DIV_0             (0*0x20u)      /* ADC10 Clock Divider Select 0 */
212
#define ADC10DIV_1             (1*0x20u)      /* ADC10 Clock Divider Select 1 */
213
#define ADC10DIV_2             (2*0x20u)      /* ADC10 Clock Divider Select 2 */
214
#define ADC10DIV_3             (3*0x20u)      /* ADC10 Clock Divider Select 3 */
215
#define ADC10DIV_4             (4*0x20u)      /* ADC10 Clock Divider Select 4 */
216
#define ADC10DIV_5             (5*0x20u)      /* ADC10 Clock Divider Select 5 */
217
#define ADC10DIV_6             (6*0x20u)      /* ADC10 Clock Divider Select 6 */
218
#define ADC10DIV_7             (7*0x20u)      /* ADC10 Clock Divider Select 7 */
219
 
220
#define SHS_0                  (0*0x400u)     /* ADC10SC */
221
#define SHS_1                  (1*0x400u)     /* Ext. SC Trigger 1 */
222
#define SHS_2                  (2*0x400u)     /* Ext. SC Trigger 2 */
223
#define SHS_3                  (3*0x400u)     /* Ext. SC Trigger 3 */
224
 
225
#define INCH_0                 (0*0x1000u)    /* Selects Channel 0 */
226
#define INCH_1                 (1*0x1000u)    /* Selects Channel 1 */
227
#define INCH_2                 (2*0x1000u)    /* Selects Channel 2 */
228
#define INCH_3                 (3*0x1000u)    /* Selects Channel 3 */
229
#define INCH_4                 (4*0x1000u)    /* Selects Channel 4 */
230
#define INCH_5                 (5*0x1000u)    /* Selects Channel 5 */
231
#define INCH_6                 (6*0x1000u)    /* Selects Channel 6 */
232
#define INCH_7                 (7*0x1000u)    /* Selects Channel 7 */
233
#define INCH_8                 (8*0x1000u)    /* Selects Channel 8 */
234
#define INCH_9                 (9*0x1000u)    /* Selects Channel 9 */
235
#define INCH_10                (10*0x1000u)   /* Selects Channel 10 */
236
#define INCH_11                (11*0x1000u)   /* Selects Channel 11 */
237
#define INCH_12                (12*0x1000u)   /* Selects Channel 12 */
238
#define INCH_13                (13*0x1000u)   /* Selects Channel 13 */
239
#define INCH_14                (14*0x1000u)   /* Selects Channel 14 */
240
#define INCH_15                (15*0x1000u)   /* Selects Channel 15 */
241
 
242
/* ADC10DTC0 */
243
#define ADC10FETCH             (0x001)        /* This bit should normally be reset */
244
#define ADC10B1                (0x002)        /* ADC10 block one */
245
#define ADC10CT                (0x004)        /* ADC10 continuous transfer */
246
#define ADC10TB                (0x008)        /* ADC10 two-block mode */
247
#define ADC10DISABLE           (0x000)        /* ADC10DTC1 */
248
 
249
/************************************************************
250
* BASIC TIMER with Real Time Clock
251
************************************************************/
252
#define __MSP430_HAS_BT_RTC__                 /* Definition to show that Module is available */
253
 
254
SFR_8BIT(BTCTL);                              /* Basic Timer Control */
255
SFR_8BIT(RTCCTL);                             /* Real Time Clock Control */
256
SFR_8BIT(RTCNT1);                             /* Real Time Counter 1 */
257
SFR_8BIT(RTCNT2);                             /* Real Time Counter 2 */
258
SFR_8BIT(RTCNT3);                             /* Real Time Counter 3 */
259
SFR_8BIT(RTCNT4);                             /* Real Time Counter 4 */
260
SFR_8BIT(BTCNT1);                             /* Basic Timer Count 1 */
261
SFR_8BIT(BTCNT2);                             /* Basic Timer Count 2 */
262
SFR_8BIT(RTCDAY);                             /* Real Time Clock Day */
263
SFR_8BIT(RTCMON);                             /* Real Time Clock Month */
264
SFR_8BIT(RTCYEARL);                           /* Real Time Clock Year (Low Byte) */
265
SFR_8BIT(RTCYEARH);                           /* Real Time Clock Year (High Byte) */
266
#define RTCSEC                 RTCNT1
267
#define RTCMIN                 RTCNT2
268
#define RTCHOUR                RTCNT3
269
#define RTCDOW                 RTCNT4
270
 
271
SFR_16BIT(RTCTL);                             /* Basic/Real Timer Control */
272
SFR_16BIT(RTCTIM0);                           /* Real Time Clock Time 0 */
273
SFR_16BIT(RTCTIM1);                           /* Real Time Clock Time 1 */
274
SFR_16BIT(BTCNT12);                           /* Basic Timer Count 1/2 */
275
SFR_16BIT(RTCDATE);                           /* Real Time Clock Date */
276
SFR_16BIT(RTCYEAR);                           /* Real Time Clock Year */
277
#define RTCNT12                RTCTIM0
278
#define RTCNT34                RTCTIM1
279
 
280
#define BTSSEL                 (0x80)         /* fBT = fMCLK (main clock) */
281
#define BTHOLD                 (0x40)         /* BT1 is held if this bit is set */
282
#define BTDIV                  (0x20)         /* fCLK2 = ACLK:256 */
283
//#define res               (0x10)
284
//#define res               (0x08)
285
#define BTIP2                  (0x04)
286
#define BTIP1                  (0x02)
287
#define BTIP0                  (0x01)
288
 
289
#define RTCBCD                 (0x80)         /* RTC BCD Select */
290
#define RTCHOLD                (0x40)         /* RTC Hold */
291
#define RTCMODE1               (0x20)         /* RTC Mode 1 */
292
#define RTCMODE0               (0x10)         /* RTC Mode 0 */
293
#define RTCTEV1                (0x08)         /* RTC Time Event 1 */
294
#define RTCTEV0                (0x04)         /* RTC Time Event 0 */
295
#define RTCIE                  (0x02)         /* RTC Interrupt Enable */
296
#define RTCFG                  (0x01)         /* RTC Event Flag */
297
 
298
#define RTCTEV_0               (0x00)         /* RTC Time Event: 0 */
299
#define RTCTEV_1               (0x04)         /* RTC Time Event: 1 */
300
#define RTCTEV_2               (0x08)         /* RTC Time Event: 2 */
301
#define RTCTEV_3               (0x0C)         /* RTC Time Event: 3 */
302
#define RTCMODE_0              (0x00)         /* RTC Mode: 0 */
303
#define RTCMODE_1              (0x10)         /* RTC Mode: 1 */
304
#define RTCMODE_2              (0x20)         /* RTC Mode: 2 */
305
#define RTCMODE_3              (0x30)         /* RTC Mode: 3 */
306
 
307
/* Frequency of the BTCNT2 coded with Bit 5 and 7 in BTCTL */
308
#define BT_fCLK2_ACLK          (0x00)
309
#define BT_fCLK2_ACLK_DIV256   (BTDIV)
310
#define BT_fCLK2_MCLK          (BTSSEL)
311
 
312
/* Interrupt interval time fINT coded with Bits 0-2 in BTCTL */
313
#define BT_fCLK2_DIV2          (0x00)         /* fINT = fCLK2:2 (default) */
314
#define BT_fCLK2_DIV4          (BTIP0)        /* fINT = fCLK2:4 */
315
#define BT_fCLK2_DIV8          (BTIP1)        /* fINT = fCLK2:8 */
316
#define BT_fCLK2_DIV16         (BTIP1+BTIP0)  /* fINT = fCLK2:16 */
317
#define BT_fCLK2_DIV32         (BTIP2)        /* fINT = fCLK2:32 */
318
#define BT_fCLK2_DIV64         (BTIP2+BTIP0)  /* fINT = fCLK2:64 */
319
#define BT_fCLK2_DIV128        (BTIP2+BTIP1)  /* fINT = fCLK2:128 */
320
#define BT_fCLK2_DIV256     (BTIP2+BTIP1+BTIP0)       /* fINT = fCLK2:256 */
321
 
322
/* with assumed vlues of fACLK=32KHz, fMCLK=1MHz */
323
/* fBT=fACLK is thought for longer interval times */
324
#define BT_ADLY_0_064          (0x00)         /* 0.064ms interval (default) */
325
#define BT_ADLY_0_125          (BTIP0)        /* 0.125ms    " */
326
#define BT_ADLY_0_25           (BTIP1)        /* 0.25ms     " */
327
#define BT_ADLY_0_5            (BTIP1+BTIP0)  /* 0.5ms      " */
328
#define BT_ADLY_1              (BTIP2)        /* 1ms        " */
329
#define BT_ADLY_2              (BTIP2+BTIP0)  /* 2ms        " */
330
#define BT_ADLY_4              (BTIP2+BTIP1)  /* 4ms        " */
331
#define BT_ADLY_8           (BTIP2+BTIP1+BTIP0)       /* 8ms        " */
332
#define BT_ADLY_16             (BTDIV)        /* 16ms       " */
333
#define BT_ADLY_32             (BTDIV+BTIP0)  /* 32ms       " */
334
#define BT_ADLY_64             (BTDIV+BTIP1)  /* 64ms       " */
335
#define BT_ADLY_125         (BTDIV+BTIP1+BTIP0)       /* 125ms      " */
336
#define BT_ADLY_250            (BTDIV+BTIP2)  /* 250ms      " */
337
#define BT_ADLY_500         (BTDIV+BTIP2+BTIP0)       /* 500ms      " */
338
#define BT_ADLY_1000        (BTDIV+BTIP2+BTIP1)       /* 1000ms     " */
339
#define BT_ADLY_2000        (BTDIV+BTIP2+BTIP1+BTIP0) /* 2000ms     " */
340
/* fCLK2=fMCLK (1MHz) is thought for short interval times */
341
/* the timing for short intervals is more precise than ACLK */
342
/* NOTE */
343
/* Be sure that the SCFQCTL-Register is set to 01Fh so that fMCLK=1MHz */
344
/* Too low interval time results in interrupts too frequent for the processor to handle! */
345
#define BT_MDLY_0_002          (BTSSEL)       /* 0.002ms interval       *** interval times */
346
#define BT_MDLY_0_004          (BTSSEL+BTIP0) /* 0.004ms    "           *** too short for */
347
#define BT_MDLY_0_008          (BTSSEL+BTIP1) /* 0.008ms    "           *** interrupt */
348
#define BT_MDLY_0_016       (BTSSEL+BTIP1+BTIP0)      /* 0.016ms    "           *** handling */
349
#define BT_MDLY_0_032          (BTSSEL+BTIP2) /* 0.032ms    " */
350
#define BT_MDLY_0_064       (BTSSEL+BTIP2+BTIP0)      /* 0.064ms    " */
351
#define BT_MDLY_0_125       (BTSSEL+BTIP2+BTIP1)      /* 0.125ms    " */
352
#define BT_MDLY_0_25        (BTSSEL+BTIP2+BTIP1+BTIP0)/* 0.25ms     " */
353
 
354
/* Hold coded with Bits 6-7 in BT(1)CTL */
355
/* this is for BT */
356
#define BTHOLD_CNT1            (BTHOLD)       /* BTCNT1 is held while BTHOLD is set */
357
#define BTHOLD_CNT1_2          (BTHOLD+BTDIV) /* BT1CNT1 .AND. BT1CNT2 are held while ~ is set */
358
 
359
/* INTERRUPT CONTROL BITS */
360
/* #define BTIE                0x80 */
361
/* #define BTIFG               0x80 */
362
 
363
/************************************************************
364
* Comparator A
365
************************************************************/
366
#define __MSP430_HAS_CAPLUS__                 /* Definition to show that Module is available */
367
 
368
SFR_8BIT(CACTL1);                             /* Comparator A Control 1 */
369
SFR_8BIT(CACTL2);                             /* Comparator A Control 2 */
370
SFR_8BIT(CAPD);                               /* Comparator A Port Disable */
371
 
372
#define CAIFG                  (0x01)         /* Comp. A Interrupt Flag */
373
#define CAIE                   (0x02)         /* Comp. A Interrupt Enable */
374
#define CAIES                  (0x04)         /* Comp. A Int. Edge Select: 0:rising / 1:falling */
375
#define CAON                   (0x08)         /* Comp. A enable */
376
#define CAREF0                 (0x10)         /* Comp. A Internal Reference Select 0 */
377
#define CAREF1                 (0x20)         /* Comp. A Internal Reference Select 1 */
378
#define CARSEL                 (0x40)         /* Comp. A Internal Reference Enable */
379
#define CAEX                   (0x80)         /* Comp. A Exchange Inputs */
380
 
381
#define CAREF_0                (0x00)         /* Comp. A Int. Ref. Select 0 : Off */
382
#define CAREF_1                (0x10)         /* Comp. A Int. Ref. Select 1 : 0.25*Vcc */
383
#define CAREF_2                (0x20)         /* Comp. A Int. Ref. Select 2 : 0.5*Vcc */
384
#define CAREF_3                (0x30)         /* Comp. A Int. Ref. Select 3 : Vt*/
385
 
386
#define CAOUT                  (0x01)         /* Comp. A Output */
387
#define CAF                    (0x02)         /* Comp. A Enable Output Filter */
388
#define P2CA0                  (0x04)         /* Comp. A +Terminal Multiplexer */
389
#define P2CA1                  (0x08)         /* Comp. A -Terminal Multiplexer */
390
#define P2CA2                  (0x10)         /* Comp. A -Terminal Multiplexer */
391
#define P2CA3                  (0x20)         /* Comp. A -Terminal Multiplexer */
392
#define P2CA4                  (0x40)         /* Comp. A +Terminal Multiplexer */
393
#define CASHORT                (0x80)         /* Comp. A Short + and - Terminals */
394
 
395
#define CAPD0                  (0x01)         /* Comp. A Disable Input Buffer of Port Register .0 */
396
#define CAPD1                  (0x02)         /* Comp. A Disable Input Buffer of Port Register .1 */
397
#define CAPD2                  (0x04)         /* Comp. A Disable Input Buffer of Port Register .2 */
398
#define CAPD3                  (0x08)         /* Comp. A Disable Input Buffer of Port Register .3 */
399
#define CAPD4                  (0x10)         /* Comp. A Disable Input Buffer of Port Register .4 */
400
#define CAPD5                  (0x20)         /* Comp. A Disable Input Buffer of Port Register .5 */
401
#define CAPD6                  (0x40)         /* Comp. A Disable Input Buffer of Port Register .6 */
402
#define CAPD7                  (0x80)         /* Comp. A Disable Input Buffer of Port Register .7 */
403
 
404
/*************************************************************
405
* Flash Memory
406
*************************************************************/
407
#define __MSP430_HAS_FLASH2__                 /* Definition to show that Module is available */
408
 
409
SFR_16BIT(FCTL1);                             /* FLASH Control 1 */
410
SFR_16BIT(FCTL2);                             /* FLASH Control 2 */
411
SFR_16BIT(FCTL3);                             /* FLASH Control 3 */
412
 
413
#define FRKEY                  (0x9600)       /* Flash key returned by read */
414
#define FWKEY                  (0xA500)       /* Flash key for write */
415
#define FXKEY                  (0x3300)       /* for use with XOR instruction */
416
 
417
#define ERASE                  (0x0002)       /* Enable bit for Flash segment erase */
418
#define MERAS                  (0x0004)       /* Enable bit for Flash mass erase */
419
#define EEI                    (0x0008)       /* Enable Erase Interrupts */
420
#define EEIEX                  (0x0010)       /* Enable Emergency Interrupt Exit */
421
#define WRT                    (0x0040)       /* Enable bit for Flash write */
422
#define BLKWRT                 (0x0080)       /* Enable bit for Flash segment write */
423
#define SEGWRT                 (0x0080)       /* old definition */ /* Enable bit for Flash segment write */
424
 
425
#define FN0                    (0x0001)       /* Divide Flash clock by 1 to 64 using FN0 to FN5 according to: */
426
#define FN1                    (0x0002)       /*  32*FN5 + 16*FN4 + 8*FN3 + 4*FN2 + 2*FN1 + FN0 + 1 */
427
#ifndef FN2
428
#define FN2                    (0x0004)
429
#endif
430
#ifndef FN3
431
#define FN3                    (0x0008)
432
#endif
433
#ifndef FN4
434
#define FN4                    (0x0010)
435
#endif
436
#define FN5                    (0x0020)
437
#define FSSEL0                 (0x0040)       /* Flash clock select 0 */        /* to distinguish from USART SSELx */
438
#define FSSEL1                 (0x0080)       /* Flash clock select 1 */
439
 
440
#define FSSEL_0                (0x0000)       /* Flash clock select: 0 - ACLK */
441
#define FSSEL_1                (0x0040)       /* Flash clock select: 1 - MCLK */
442
#define FSSEL_2                (0x0080)       /* Flash clock select: 2 - SMCLK */
443
#define FSSEL_3                (0x00C0)       /* Flash clock select: 3 - SMCLK */
444
 
445
#define BUSY                   (0x0001)       /* Flash busy: 1 */
446
#define KEYV                   (0x0002)       /* Flash Key violation flag */
447
#define ACCVIFG                (0x0004)       /* Flash Access violation flag */
448
#define WAIT                   (0x0008)       /* Wait flag for segment write */
449
#define LOCK                   (0x0010)       /* Lock bit: 1 - Flash is locked (read only) */
450
#define EMEX                   (0x0020)       /* Flash Emergency Exit */
451
#define LOCKA                  (0x0040)       /* Segment A Lock bit: read = 1 - Segment is locked (read only) */
452
#define FAIL                   (0x0080)       /* Last Program or Erase failed */
453
 
454
/************************************************************
455
* SYSTEM CLOCK, FLL+
456
************************************************************/
457
#define __MSP430_HAS_FLLPLUS__                /* Definition to show that Module is available */
458
 
459
SFR_8BIT(SCFI0);                              /* System Clock Frequency Integrator 0 */
460
#define FN_2                   (0x04)         /* fDCOCLK =   1.4-12MHz*/
461
#define FN_3                   (0x08)         /* fDCOCLK =   2.2-17Mhz*/
462
#define FN_4                   (0x10)         /* fDCOCLK =   3.2-25Mhz*/
463
#define FN_8                   (0x20)         /* fDCOCLK =     5-40Mhz*/
464
#define FLLD0                  (0x40)         /* Loop Divider Bit : 0 */
465
#define FLLD1                  (0x80)         /* Loop Divider Bit : 1 */
466
 
467
#define FLLD_1                 (0x00)         /* Multiply Selected Loop Freq. By 1 */
468
#define FLLD_2                 (0x40)         /* Multiply Selected Loop Freq. By 2 */
469
#define FLLD_4                 (0x80)         /* Multiply Selected Loop Freq. By 4 */
470
#define FLLD_8                 (0xC0)         /* Multiply Selected Loop Freq. By 8 */
471
 
472
SFR_8BIT(SCFI1);                              /* System Clock Frequency Integrator 1 */
473
SFR_8BIT(SCFQCTL);                            /* System Clock Frequency Control */
474
/* System clock frequency values fMCLK coded with Bits 0-6 in SCFQCTL */
475
/* #define SCFQ_32K            0x00                        fMCLK=1*fACLK       only a range from */
476
#define SCFQ_64K               (0x01)         /* fMCLK=2*fACLK          1+1 to 127+1 is possible */
477
#define SCFQ_128K              (0x03)         /* fMCLK=4*fACLK */
478
#define SCFQ_256K              (0x07)         /* fMCLK=8*fACLK */
479
#define SCFQ_512K              (0x0F)         /* fMCLK=16*fACLK */
480
#define SCFQ_1M                (0x1F)         /* fMCLK=32*fACLK */
481
#define SCFQ_2M                (0x3F)         /* fMCLK=64*fACLK */
482
#define SCFQ_4M                (0x7F)         /* fMCLK=128*fACLK */
483
#define SCFQ_M                 (0x80)         /* Modulation Disable */
484
 
485
SFR_8BIT(FLL_CTL0);                           /* FLL+ Control 0 */
486
#define DCOF                   (0x01)         /* DCO Fault Flag */
487
#define LFOF                   (0x02)         /* Low Frequency Oscillator Fault Flag */
488
#define XT1OF                  (0x04)         /* High Frequency Oscillator 1 Fault Flag */
489
#define OSCCAP0                (0x10)         /* XIN/XOUT Cap 0 */
490
#define OSCCAP1                (0x20)         /* XIN/XOUT Cap 1 */
491
#define XTS_FLL                (0x40)         /* 1: Selects high-freq. oscillator */
492
#define DCOPLUS                (0x80)         /* DCO+ Enable */
493
 
494
#define XCAP0PF                (0x00)         /* XIN Cap = XOUT Cap = 0pf */
495
#define XCAP5_5F               (0x10)         /* XIN Cap = XOUT Cap = 5.5pf */
496
#define XCAP8_5PF              (0x20)         /* XIN Cap = XOUT Cap = 8.5pf */
497
#define XCAP11PF               (0x30)         /* XIN Cap = XOUT Cap = 11pf */
498
#define OSCCAP_0               (0x00)         /* XIN Cap = XOUT Cap: 0 */
499
#define OSCCAP_1               (0x10)         /* XIN Cap = XOUT Cap: 1 */
500
#define OSCCAP_2               (0x20)         /* XIN Cap = XOUT Cap: 2 */
501
#define OSCCAP_3               (0x30)         /* XIN Cap = XOUT Cap: 3 */
502
 
503
SFR_8BIT(FLL_CTL1);                           /* FLL+ Control 1 */
504
#define FLL_DIV0               (0x01)         /* FLL+ Divide Px.x/ACLK 0 */
505
#define FLL_DIV1               (0x02)         /* FLL+ Divide Px.x/ACLK 1 */
506
#define SELM0                  (0x08)         /* MCLK Source Select 0 */
507
#define SELM1                  (0x10)         /* MCLK Source Select 1 */
508
#define SMCLKOFF               (0x40)         /* Peripheral Module Clock (SMCLK) disable */
509
 
510
#define FLL_DIV_1              (0x00)         /* FLL+ Divide Px.x/ACLK By 1 */
511
#define FLL_DIV_2              (0x01)         /* FLL+ Divide Px.x/ACLK By 2 */
512
#define FLL_DIV_4              (0x02)         /* FLL+ Divide Px.x/ACLK By 4 */
513
#define FLL_DIV_8              (0x03)         /* FLL+ Divide Px.x/ACLK By 8 */
514
 
515
#define SELM_DCO               (0x00)         /* Select DCO for CPU MCLK */
516
#define SELM_A                 (0x18)         /* Select A (from LFXT1) for CPU MCLK */
517
 
518
SFR_8BIT(FLL_CTL2);                           /* FLL+ Control 2 */
519
 
520
#define LF1XT1S0               (0x10)         /* Mode 0 for LFXT1 */
521
#define LF1XT1S1               (0x20)         /* Mode 0 for LFXT1 */
522
 
523
#define LF1XT1S_0              (0x00)         /* Mode 0 for LF : 32kHz */
524
#define LF1XT1S_1              (0x10)         /* Mode 1 for LF : reserved */
525
#define LF1XT1S_2              (0x20)         /* Mode 2 for LF : VLO */
526
#define LF1XT1S_3              (0x30)         /* Mode 3 for LF : Digital input signal */
527
 
528
/* INTERRUPT CONTROL BITS */
529
/* These two bits are defined in the Special Function Registers */
530
/* #define OFIFG               0x02 */
531
/* #define OFIE                0x02 */
532
 
533
/************************************************************
534
* LCD_A
535
************************************************************/
536
#define __MSP430_HAS_LCD_A__                  /* Definition to show that Module is available */
537
 
538
SFR_8BIT(LCDACTL);                            /* LCD_A Control Register */
539
#define LCDON                  (0x01)
540
#define LCDSON                 (0x04)
541
#define LCDMX0                 (0x08)
542
#define LCDMX1                 (0x10)
543
#define LCDFREQ0               (0x20)
544
#define LCDFREQ1               (0x40)
545
#define LCDFREQ2               (0x80)
546
/* Display modes coded with Bits 2-4 */
547
#define LCDSTATIC              (LCDSON)
548
#define LCD2MUX                (LCDMX0+LCDSON)
549
#define LCD3MUX                (LCDMX1+LCDSON)
550
#define LCD4MUX                (LCDMX1+LCDMX0+LCDSON)
551
/* Frequency select code with Bits 5-7 */
552
#define LCDFREQ_32             (0x00)         /* LCD Freq: ACLK divided by 32 */
553
#define LCDFREQ_64             (0x20)         /* LCD Freq: ACLK divided by 64 */
554
#define LCDFREQ_96             (0x40)         /* LCD Freq: ACLK divided by 96 */
555
#define LCDFREQ_128            (0x60)         /* LCD Freq: ACLK divided by 128 */
556
#define LCDFREQ_192            (0x80)         /* LCD Freq: ACLK divided by 192 */
557
#define LCDFREQ_256            (0xA0)         /* LCD Freq: ACLK divided by 256 */
558
#define LCDFREQ_384            (0xC0)         /* LCD Freq: ACLK divided by 384 */
559
#define LCDFREQ_512            (0xE0)         /* LCD Freq: ACLK divided by 512 */
560
 
561
SFR_8BIT(LCDAPCTL0);                          /* LCD_A Port Control Register 0 */
562
#define LCDS0                  (0x01)         /* LCD Segment  0 to  3 Enable. */
563
#define LCDS4                  (0x02)         /* LCD Segment  4 to  7 Enable. */
564
#define LCDS8                  (0x04)         /* LCD Segment  8 to 11 Enable. */
565
#define LCDS12                 (0x08)         /* LCD Segment 12 to 15 Enable. */
566
#define LCDS16                 (0x10)         /* LCD Segment 16 to 19 Enable. */
567
#define LCDS20                 (0x20)         /* LCD Segment 20 to 23 Enable. */
568
#define LCDS24                 (0x40)         /* LCD Segment 24 to 27 Enable. */
569
#define LCDS28                 (0x80)         /* LCD Segment 28 to 31 Enable. */
570
 
571
SFR_8BIT(LCDAPCTL1);                          /* LCD_A Port Control Register 1 */
572
#define LCDS32                 (0x01)         /* LCD Segment 32 to 35 Enable. */
573
#define LCDS36                 (0x02)         /* LCD Segment 36 to 39 Enable. */
574
 
575
SFR_8BIT(LCDAVCTL0);                          /* LCD_A Voltage Control Register 0 */
576
#define LCD2B                  (0x01)         /* Selects 1/2 bias. */
577
#define VLCDREF0               (0x02)         /* Selects reference voltage for regulated charge pump: 0 */
578
#define VLCDREF1               (0x04)         /* Selects reference voltage for regulated charge pump: 1 */
579
#define LCDCPEN                (0x08)         /* LCD Voltage Charge Pump Enable. */
580
#define VLCDEXT                (0x10)         /* Select external source for VLCD. */
581
#define LCDREXT                (0x20)         /* Selects external connections for LCD mid voltages. */
582
#define LCDR03EXT              (0x40)         /* Selects external connection for lowest LCD voltage. */
583
 
584
/* Reference voltage source select for the regulated charge pump */
585
#define VLCDREF_0              (0<<1)         /* Internal */
586
#define VLCDREF_1              (1<<1)         /* External */
587
#define VLCDREF_2              (2<<1)         /* Reserved */
588
#define VLCDREF_3              (3<<1)         /* Reserved */
589
 
590
SFR_8BIT(LCDAVCTL1);                          /* LCD_A Voltage Control Register 1 */
591
#define VLCD0                  (0x02)         /* VLCD select: 0 */
592
#define VLCD1                  (0x04)         /* VLCD select: 1 */
593
#define VLCD2                  (0x08)         /* VLCD select: 2 */
594
#define VLCD3                  (0x10)         /* VLCD select: 3 */
595
 
596
/* Charge pump voltage selections */
597
#define VLCD_0                 (0<<1)         /* Charge pump disabled */
598
#define VLCD_1                 (1<<1)         /* VLCD = 2.60V */
599
#define VLCD_2                 (2<<1)         /* VLCD = 2.66V */
600
#define VLCD_3                 (3<<1)         /* VLCD = 2.72V */
601
#define VLCD_4                 (4<<1)         /* VLCD = 2.78V */
602
#define VLCD_5                 (5<<1)         /* VLCD = 2.84V */
603
#define VLCD_6                 (6<<1)         /* VLCD = 2.90V */
604
#define VLCD_7                 (7<<1)         /* VLCD = 2.96V */
605
#define VLCD_8                 (8<<1)         /* VLCD = 3.02V */
606
#define VLCD_9                 (9<<1)         /* VLCD = 3.08V */
607
#define VLCD_10                (10<<1)        /* VLCD = 3.14V */
608
#define VLCD_11                (11<<1)        /* VLCD = 3.20V */
609
#define VLCD_12                (12<<1)        /* VLCD = 3.26V */
610
#define VLCD_13                (12<<1)        /* VLCD = 3.32V */
611
#define VLCD_14                (13<<1)        /* VLCD = 3.38V */
612
#define VLCD_15                (15<<1)        /* VLCD = 3.44V */
613
 
614
#define VLCD_DISABLED          (0<<1)         /* Charge pump disabled */
615
#define VLCD_2_60              (1<<1)         /* VLCD = 2.60V */
616
#define VLCD_2_66              (2<<1)         /* VLCD = 2.66V */
617
#define VLCD_2_72              (3<<1)         /* VLCD = 2.72V */
618
#define VLCD_2_78              (4<<1)         /* VLCD = 2.78V */
619
#define VLCD_2_84              (5<<1)         /* VLCD = 2.84V */
620
#define VLCD_2_90              (6<<1)         /* VLCD = 2.90V */
621
#define VLCD_2_96              (7<<1)         /* VLCD = 2.96V */
622
#define VLCD_3_02              (8<<1)         /* VLCD = 3.02V */
623
#define VLCD_3_08              (9<<1)         /* VLCD = 3.08V */
624
#define VLCD_3_14              (10<<1)        /* VLCD = 3.14V */
625
#define VLCD_3_20              (11<<1)        /* VLCD = 3.20V */
626
#define VLCD_3_26              (12<<1)        /* VLCD = 3.26V */
627
#define VLCD_3_32              (12<<1)        /* VLCD = 3.32V */
628
#define VLCD_3_38              (13<<1)        /* VLCD = 3.38V */
629
#define VLCD_3_44              (15<<1)        /* VLCD = 3.44V */
630
 
631
#define LCDMEM_                (0x0091)       /* LCD Memory */
632
#ifdef __ASM_HEADER__
633
#define LCDMEM                 (LCDMEM_)      /* LCD Memory (for assembler) */
634
#else
635
#define LCDMEM                 ((char*)       LCDMEM_) /* LCD Memory (for C) */
636
#endif
637
SFR_8BIT(LCDM1);                              /* LCD Memory 1 */
638
SFR_8BIT(LCDM2);                              /* LCD Memory 2 */
639
SFR_8BIT(LCDM3);                              /* LCD Memory 3 */
640
SFR_8BIT(LCDM4);                              /* LCD Memory 4 */
641
SFR_8BIT(LCDM5);                              /* LCD Memory 5 */
642
SFR_8BIT(LCDM6);                              /* LCD Memory 6 */
643
SFR_8BIT(LCDM7);                              /* LCD Memory 7 */
644
SFR_8BIT(LCDM8);                              /* LCD Memory 8 */
645
SFR_8BIT(LCDM9);                              /* LCD Memory 9 */
646
SFR_8BIT(LCDM10);                             /* LCD Memory 10 */
647
SFR_8BIT(LCDM11);                             /* LCD Memory 11 */
648
SFR_8BIT(LCDM12);                             /* LCD Memory 12 */
649
SFR_8BIT(LCDM13);                             /* LCD Memory 13 */
650
SFR_8BIT(LCDM14);                             /* LCD Memory 14 */
651
SFR_8BIT(LCDM15);                             /* LCD Memory 15 */
652
SFR_8BIT(LCDM16);                             /* LCD Memory 16 */
653
SFR_8BIT(LCDM17);                             /* LCD Memory 17 */
654
SFR_8BIT(LCDM18);                             /* LCD Memory 18 */
655
SFR_8BIT(LCDM19);                             /* LCD Memory 19 */
656
SFR_8BIT(LCDM20);                             /* LCD Memory 20 */
657
 
658
#define LCDMA                  (LCDM10)       /* LCD Memory A */
659
#define LCDMB                  (LCDM11)       /* LCD Memory B */
660
#define LCDMC                  (LCDM12)       /* LCD Memory C */
661
#define LCDMD                  (LCDM13)       /* LCD Memory D */
662
#define LCDME                  (LCDM14)       /* LCD Memory E */
663
#define LCDMF                  (LCDM15)       /* LCD Memory F */
664
 
665
/************************************************************
666
* DIGITAL I/O Port1/2
667
************************************************************/
668
#define __MSP430_HAS_PORT1__                  /* Definition to show that Module is available */
669
#define __MSP430_HAS_PORT2__                  /* Definition to show that Module is available */
670
 
671
SFR_8BIT(P1IN);                               /* Port 1 Input */
672
SFR_8BIT(P1OUT);                              /* Port 1 Output */
673
SFR_8BIT(P1DIR);                              /* Port 1 Direction */
674
SFR_8BIT(P1IFG);                              /* Port 1 Interrupt Flag */
675
SFR_8BIT(P1IES);                              /* Port 1 Interrupt Edge Select */
676
SFR_8BIT(P1IE);                               /* Port 1 Interrupt Enable */
677
SFR_8BIT(P1SEL);                              /* Port 1 Selection */
678
 
679
SFR_8BIT(P2IN);                               /* Port 2 Input */
680
SFR_8BIT(P2OUT);                              /* Port 2 Output */
681
SFR_8BIT(P2DIR);                              /* Port 2 Direction */
682
SFR_8BIT(P2IFG);                              /* Port 2 Interrupt Flag */
683
SFR_8BIT(P2IES);                              /* Port 2 Interrupt Edge Select */
684
SFR_8BIT(P2IE);                               /* Port 2 Interrupt Enable */
685
SFR_8BIT(P2SEL);                              /* Port 2 Selection */
686
 
687
/************************************************************
688
* DIGITAL I/O Port3/4
689
************************************************************/
690
#define __MSP430_HAS_PORT3__                  /* Definition to show that Module is available */
691
#define __MSP430_HAS_PORT4__                  /* Definition to show that Module is available */
692
 
693
SFR_8BIT(P3IN);                               /* Port 3 Input */
694
SFR_8BIT(P3OUT);                              /* Port 3 Output */
695
SFR_8BIT(P3DIR);                              /* Port 3 Direction */
696
SFR_8BIT(P3SEL);                              /* Port 3 Selection */
697
 
698
SFR_8BIT(P4IN);                               /* Port 4 Input */
699
SFR_8BIT(P4OUT);                              /* Port 4 Output */
700
SFR_8BIT(P4DIR);                              /* Port 4 Direction */
701
SFR_8BIT(P4SEL);                              /* Port 4 Selection */
702
 
703
/************************************************************
704
* DIGITAL I/O Port5/6
705
************************************************************/
706
#define __MSP430_HAS_PORT5__                  /* Definition to show that Module is available */
707
#define __MSP430_HAS_PORT6__                  /* Definition to show that Module is available */
708
 
709
SFR_8BIT(P5IN);                               /* Port 5 Input */
710
SFR_8BIT(P5OUT);                              /* Port 5 Output */
711
SFR_8BIT(P5DIR);                              /* Port 5 Direction */
712
SFR_8BIT(P5SEL);                              /* Port 5 Selection */
713
 
714
SFR_8BIT(P6IN);                               /* Port 6 Input */
715
SFR_8BIT(P6OUT);                              /* Port 6 Output */
716
SFR_8BIT(P6DIR);                              /* Port 6 Direction */
717
SFR_8BIT(P6SEL);                              /* Port 6 Selection */
718
 
719
/************************************************************
720
* DIGITAL I/O Port7
721
************************************************************/
722
#define __MSP430_HAS_PORT7__                  /* Definition to show that Module is available */
723
 
724
SFR_8BIT(P7IN);                               /* Port 7 Input */
725
SFR_8BIT(P7OUT);                              /* Port 7 Output */
726
SFR_8BIT(P7DIR);                              /* Port 7 Direction */
727
SFR_8BIT(P7SEL);                              /* Port 7 Selection */
728
 
729
/************************************************************
730
* Brown-Out, Supply Voltage Supervision (SVS)
731
************************************************************/
732
#define __MSP430_HAS_SVS__                    /* Definition to show that Module is available */
733
 
734
SFR_8BIT(SVSCTL);                             /* SVS Control */
735
#define SVSFG                  (0x01)         /* SVS Flag */
736
#define SVSOP                  (0x02)         /* SVS output (read only) */
737
#define SVSON                  (0x04)         /* Switches the SVS on/off */
738
#define PORON                  (0x08)         /* Enable POR Generation if Low Voltage */
739
#define VLD0                   (0x10)
740
#define VLD1                   (0x20)
741
#define VLD2                   (0x40)
742
#define VLD3                   (0x80)
743
 
744
#define VLDON                  (0x10)
745
#define VLDOFF                 (0x00)
746
#define VLD_1_8V               (0x10)
747
 
748
/************************************************************
749
* Timer0_A3
750
************************************************************/
751
#define __MSP430_HAS_TA3__                    /* Definition to show that Module is available */
752
 
753
SFR_16BIT(TA0IV);                             /* Timer0_A3 Interrupt Vector Word */
754
SFR_16BIT(TA0CTL);                            /* Timer0_A3 Control */
755
SFR_16BIT(TA0CCTL0);                          /* Timer0_A3 Capture/Compare Control 0 */
756
SFR_16BIT(TA0CCTL1);                          /* Timer0_A3 Capture/Compare Control 1 */
757
SFR_16BIT(TA0CCTL2);                          /* Timer0_A3 Capture/Compare Control 2 */
758
SFR_16BIT(TA0R);                              /* Timer0_A3 */
759
SFR_16BIT(TA0CCR0);                           /* Timer0_A3 Capture/Compare 0 */
760
SFR_16BIT(TA0CCR1);                           /* Timer0_A3 Capture/Compare 1 */
761
SFR_16BIT(TA0CCR2);                           /* Timer0_A3 Capture/Compare 2 */
762
 
763
/* Alternate register names */
764
#define TAIV                   TA0IV          /* Timer A Interrupt Vector Word */
765
#define TACTL                  TA0CTL         /* Timer A Control */
766
#define TACCTL0                TA0CCTL0       /* Timer A Capture/Compare Control 0 */
767
#define TACCTL1                TA0CCTL1       /* Timer A Capture/Compare Control 1 */
768
#define TACCTL2                TA0CCTL2       /* Timer A Capture/Compare Control 2 */
769
#define TAR                    TA0R           /* Timer A */
770
#define TACCR0                 TA0CCR0        /* Timer A Capture/Compare 0 */
771
#define TACCR1                 TA0CCR1        /* Timer A Capture/Compare 1 */
772
#define TACCR2                 TA0CCR2        /* Timer A Capture/Compare 2 */
773
#define TAIV_                  TA0IV_         /* Timer A Interrupt Vector Word */
774
#define TACTL_                 TA0CTL_        /* Timer A Control */
775
#define TACCTL0_               TA0CCTL0_      /* Timer A Capture/Compare Control 0 */
776
#define TACCTL1_               TA0CCTL1_      /* Timer A Capture/Compare Control 1 */
777
#define TACCTL2_               TA0CCTL2_      /* Timer A Capture/Compare Control 2 */
778
#define TAR_                   TA0R_          /* Timer A */
779
#define TACCR0_                TA0CCR0_       /* Timer A Capture/Compare 0 */
780
#define TACCR1_                TA0CCR1_       /* Timer A Capture/Compare 1 */
781
#define TACCR2_                TA0CCR2_       /* Timer A Capture/Compare 2 */
782
 
783
/* Alternate register names 2 */
784
#define CCTL0                  TACCTL0        /* Timer A Capture/Compare Control 0 */
785
#define CCTL1                  TACCTL1        /* Timer A Capture/Compare Control 1 */
786
#define CCTL2                  TACCTL2        /* Timer A Capture/Compare Control 2 */
787
#define CCR0                   TACCR0         /* Timer A Capture/Compare 0 */
788
#define CCR1                   TACCR1         /* Timer A Capture/Compare 1 */
789
#define CCR2                   TACCR2         /* Timer A Capture/Compare 2 */
790
#define CCTL0_                 TACCTL0_       /* Timer A Capture/Compare Control 0 */
791
#define CCTL1_                 TACCTL1_       /* Timer A Capture/Compare Control 1 */
792
#define CCTL2_                 TACCTL2_       /* Timer A Capture/Compare Control 2 */
793
#define CCR0_                  TACCR0_        /* Timer A Capture/Compare 0 */
794
#define CCR1_                  TACCR1_        /* Timer A Capture/Compare 1 */
795
#define CCR2_                  TACCR2_        /* Timer A Capture/Compare 2 */
796
 
797
#define TASSEL1                (0x0200)       /* Timer A clock source select 0 */
798
#define TASSEL0                (0x0100)       /* Timer A clock source select 1 */
799
#define ID1                    (0x0080)       /* Timer A clock input divider 1 */
800
#define ID0                    (0x0040)       /* Timer A clock input divider 0 */
801
#define MC1                    (0x0020)       /* Timer A mode control 1 */
802
#define MC0                    (0x0010)       /* Timer A mode control 0 */
803
#define TACLR                  (0x0004)       /* Timer A counter clear */
804
#define TAIE                   (0x0002)       /* Timer A counter interrupt enable */
805
#define TAIFG                  (0x0001)       /* Timer A counter interrupt flag */
806
 
807
#define MC_0                   (0*0x10u)      /* Timer A mode control: 0 - Stop */
808
#define MC_1                   (1*0x10u)      /* Timer A mode control: 1 - Up to CCR0 */
809
#define MC_2                   (2*0x10u)      /* Timer A mode control: 2 - Continous up */
810
#define MC_3                   (3*0x10u)      /* Timer A mode control: 3 - Up/Down */
811
#define ID_0                   (0*0x40u)      /* Timer A input divider: 0 - /1 */
812
#define ID_1                   (1*0x40u)      /* Timer A input divider: 1 - /2 */
813
#define ID_2                   (2*0x40u)      /* Timer A input divider: 2 - /4 */
814
#define ID_3                   (3*0x40u)      /* Timer A input divider: 3 - /8 */
815
#define TASSEL_0               (0*0x100u)     /* Timer A clock source select: 0 - TACLK */
816
#define TASSEL_1               (1*0x100u)     /* Timer A clock source select: 1 - ACLK  */
817
#define TASSEL_2               (2*0x100u)     /* Timer A clock source select: 2 - SMCLK */
818
#define TASSEL_3               (3*0x100u)     /* Timer A clock source select: 3 - INCLK */
819
 
820
#define CM1                    (0x8000)       /* Capture mode 1 */
821
#define CM0                    (0x4000)       /* Capture mode 0 */
822
#define CCIS1                  (0x2000)       /* Capture input select 1 */
823
#define CCIS0                  (0x1000)       /* Capture input select 0 */
824
#define SCS                    (0x0800)       /* Capture sychronize */
825
#define SCCI                   (0x0400)       /* Latched capture signal (read) */
826
#define CAP                    (0x0100)       /* Capture mode: 1 /Compare mode : 0 */
827
#define OUTMOD2                (0x0080)       /* Output mode 2 */
828
#define OUTMOD1                (0x0040)       /* Output mode 1 */
829
#define OUTMOD0                (0x0020)       /* Output mode 0 */
830
#define CCIE                   (0x0010)       /* Capture/compare interrupt enable */
831
#define CCI                    (0x0008)       /* Capture input signal (read) */
832
#define OUT                    (0x0004)       /* PWM Output signal if output mode 0 */
833
#define COV                    (0x0002)       /* Capture/compare overflow flag */
834
#define CCIFG                  (0x0001)       /* Capture/compare interrupt flag */
835
 
836
#define OUTMOD_0               (0*0x20u)      /* PWM output mode: 0 - output only */
837
#define OUTMOD_1               (1*0x20u)      /* PWM output mode: 1 - set */
838
#define OUTMOD_2               (2*0x20u)      /* PWM output mode: 2 - PWM toggle/reset */
839
#define OUTMOD_3               (3*0x20u)      /* PWM output mode: 3 - PWM set/reset */
840
#define OUTMOD_4               (4*0x20u)      /* PWM output mode: 4 - toggle */
841
#define OUTMOD_5               (5*0x20u)      /* PWM output mode: 5 - Reset */
842
#define OUTMOD_6               (6*0x20u)      /* PWM output mode: 6 - PWM toggle/set */
843
#define OUTMOD_7               (7*0x20u)      /* PWM output mode: 7 - PWM reset/set */
844
#define CCIS_0                 (0*0x1000u)    /* Capture input select: 0 - CCIxA */
845
#define CCIS_1                 (1*0x1000u)    /* Capture input select: 1 - CCIxB */
846
#define CCIS_2                 (2*0x1000u)    /* Capture input select: 2 - GND */
847
#define CCIS_3                 (3*0x1000u)    /* Capture input select: 3 - Vcc */
848
#define CM_0                   (0*0x4000u)    /* Capture mode: 0 - disabled */
849
#define CM_1                   (1*0x4000u)    /* Capture mode: 1 - pos. edge */
850
#define CM_2                   (2*0x4000u)    /* Capture mode: 1 - neg. edge */
851
#define CM_3                   (3*0x4000u)    /* Capture mode: 1 - both edges */
852
 
853
/* T0_A3IV Definitions */
854
#define TA0IV_NONE             (0x0000)       /* No Interrupt pending */
855
#define TA0IV_TACCR1           (0x0002)       /* TA0CCR1_CCIFG */
856
#define TA0IV_TACCR2           (0x0004)       /* TA0CCR2_CCIFG */
857
#define TA0IV_6                (0x0006)       /* Reserved */
858
#define TA0IV_8                (0x0008)       /* Reserved */
859
#define TA0IV_TAIFG            (0x000A)       /* TA0IFG */
860
 
861
/************************************************************
862
* Timer1_A5
863
************************************************************/
864
#define __MSP430_HAS_T1A5__                   /* Definition to show that Module is available */
865
 
866
SFR_16BIT(TA1IV);                             /* Timer1_A5 Interrupt Vector Word */
867
SFR_16BIT(TA1CTL);                            /* Timer1_A5 Control */
868
SFR_16BIT(TA1CCTL0);                          /* Timer1_A5 Capture/Compare Control 0 */
869
SFR_16BIT(TA1CCTL1);                          /* Timer1_A5 Capture/Compare Control 1 */
870
SFR_16BIT(TA1CCTL2);                          /* Timer1_A5 Capture/Compare Control 2 */
871
SFR_16BIT(TA1CCTL3);                          /* Timer1_A5 Capture/Compare Control 3 */
872
SFR_16BIT(TA1CCTL4);                          /* Timer1_A5 Capture/Compare Control 4 */
873
SFR_16BIT(TA1R);                              /* Timer1_A5 */
874
SFR_16BIT(TA1CCR0);                           /* Timer1_A5 Capture/Compare 0 */
875
SFR_16BIT(TA1CCR1);                           /* Timer1_A5 Capture/Compare 1 */
876
SFR_16BIT(TA1CCR2);                           /* Timer1_A5 Capture/Compare 2 */
877
SFR_16BIT(TA1CCR3);                           /* Timer1_A5 Capture/Compare 3 */
878
SFR_16BIT(TA1CCR4);                           /* Timer1_A5 Capture/Compare 4 */
879
 
880
/* Bits are already defined within the Timer0_Ax */
881
 
882
/* T1_A5IV Definitions */
883
#define TA1IV_NONE             (0x0000)       /* No Interrupt pending */
884
#define TA1IV_TACCR1           (0x0002)       /* TA1CCR1_CCIFG */
885
#define TA1IV_TACCR2           (0x0004)       /* TA1CCR2_CCIFG */
886
#define TA1IV_TACCR3           (0x0006)       /* TA1CCR3_CCIFG */
887
#define TA1IV_TACCR4           (0x0008)       /* TA1CCR4_CCIFG */
888
#define TA1IV_TAIFG            (0x000A)       /* TA1IFG */
889
 
890
/************************************************************
891
* USCI
892
************************************************************/
893
#define __MSP430_HAS_USCI__                   /* Definition to show that Module is available */
894
 
895
SFR_8BIT(UCA0CTL0);                           /* USCI A0 Control Register 0 */
896
SFR_8BIT(UCA0CTL1);                           /* USCI A0 Control Register 1 */
897
SFR_8BIT(UCA0BR0);                            /* USCI A0 Baud Rate 0 */
898
SFR_8BIT(UCA0BR1);                            /* USCI A0 Baud Rate 1 */
899
SFR_8BIT(UCA0MCTL);                           /* USCI A0 Modulation Control */
900
SFR_8BIT(UCA0STAT);                           /* USCI A0 Status Register */
901
SFR_8BIT(UCA0RXBUF);                          /* USCI A0 Receive Buffer */
902
SFR_8BIT(UCA0TXBUF);                          /* USCI A0 Transmit Buffer */
903
SFR_8BIT(UCA0ABCTL);                          /* USCI A0 LIN Control */
904
SFR_8BIT(UCA0IRTCTL);                         /* USCI A0 IrDA Transmit Control */
905
SFR_8BIT(UCA0IRRCTL);                         /* USCI A0 IrDA Receive Control */
906
 
907
 
908
 
909
SFR_8BIT(UCB0CTL0);                           /* USCI B0 Control Register 0 */
910
SFR_8BIT(UCB0CTL1);                           /* USCI B0 Control Register 1 */
911
SFR_8BIT(UCB0BR0);                            /* USCI B0 Baud Rate 0 */
912
SFR_8BIT(UCB0BR1);                            /* USCI B0 Baud Rate 1 */
913
SFR_8BIT(UCB0I2CIE);                          /* USCI B0 I2C Interrupt Enable Register */
914
SFR_8BIT(UCB0STAT);                           /* USCI B0 Status Register */
915
SFR_8BIT(UCB0RXBUF);                          /* USCI B0 Receive Buffer */
916
SFR_8BIT(UCB0TXBUF);                          /* USCI B0 Transmit Buffer */
917
SFR_16BIT(UCB0I2COA);                         /* USCI B0 I2C Own Address */
918
SFR_16BIT(UCB0I2CSA);                         /* USCI B0 I2C Slave Address */
919
 
920
// UART-Mode Bits
921
#define UCPEN                  (0x80)         /* Async. Mode: Parity enable */
922
#define UCPAR                  (0x40)         /* Async. Mode: Parity     0:odd / 1:even */
923
#define UCMSB                  (0x20)         /* Async. Mode: MSB first  0:LSB / 1:MSB */
924
#define UC7BIT                 (0x10)         /* Async. Mode: Data Bits  0:8-bits / 1:7-bits */
925
#define UCSPB                  (0x08)         /* Async. Mode: Stop Bits  0:one / 1: two */
926
#define UCMODE1                (0x04)         /* Async. Mode: USCI Mode 1 */
927
#define UCMODE0                (0x02)         /* Async. Mode: USCI Mode 0 */
928
#define UCSYNC                 (0x01)         /* Sync-Mode  0:UART-Mode / 1:SPI-Mode */
929
 
930
// SPI-Mode Bits
931
#define UCCKPH                 (0x80)         /* Sync. Mode: Clock Phase */
932
#define UCCKPL                 (0x40)         /* Sync. Mode: Clock Polarity */
933
#define UCMST                  (0x08)         /* Sync. Mode: Master Select */
934
 
935
// I2C-Mode Bits
936
#define UCA10                  (0x80)         /* 10-bit Address Mode */
937
#define UCSLA10                (0x40)         /* 10-bit Slave Address Mode */
938
#define UCMM                   (0x20)         /* Multi-Master Environment */
939
//#define res               (0x10)    /* reserved */
940
#define UCMODE_0               (0x00)         /* Sync. Mode: USCI Mode: 0 */
941
#define UCMODE_1               (0x02)         /* Sync. Mode: USCI Mode: 1 */
942
#define UCMODE_2               (0x04)         /* Sync. Mode: USCI Mode: 2 */
943
#define UCMODE_3               (0x06)         /* Sync. Mode: USCI Mode: 3 */
944
 
945
// UART-Mode Bits
946
#define UCSSEL1                (0x80)         /* USCI 0 Clock Source Select 1 */
947
#define UCSSEL0                (0x40)         /* USCI 0 Clock Source Select 0 */
948
#define UCRXEIE                (0x20)         /* RX Error interrupt enable */
949
#define UCBRKIE                (0x10)         /* Break interrupt enable */
950
#define UCDORM                 (0x08)         /* Dormant (Sleep) Mode */
951
#define UCTXADDR               (0x04)         /* Send next Data as Address */
952
#define UCTXBRK                (0x02)         /* Send next Data as Break */
953
#define UCSWRST                (0x01)         /* USCI Software Reset */
954
 
955
// SPI-Mode Bits
956
//#define res               (0x20)    /* reserved */
957
//#define res               (0x10)    /* reserved */
958
//#define res               (0x08)    /* reserved */
959
//#define res               (0x04)    /* reserved */
960
//#define res               (0x02)    /* reserved */
961
 
962
// I2C-Mode Bits
963
//#define res               (0x20)    /* reserved */
964
#define UCTR                   (0x10)         /* Transmit/Receive Select/Flag */
965
#define UCTXNACK               (0x08)         /* Transmit NACK */
966
#define UCTXSTP                (0x04)         /* Transmit STOP */
967
#define UCTXSTT                (0x02)         /* Transmit START */
968
#define UCSSEL_0               (0x00)         /* USCI 0 Clock Source: 0 */
969
#define UCSSEL_1               (0x40)         /* USCI 0 Clock Source: 1 */
970
#define UCSSEL_2               (0x80)         /* USCI 0 Clock Source: 2 */
971
#define UCSSEL_3               (0xC0)         /* USCI 0 Clock Source: 3 */
972
 
973
#define UCBRF3                 (0x80)         /* USCI First Stage Modulation Select 3 */
974
#define UCBRF2                 (0x40)         /* USCI First Stage Modulation Select 2 */
975
#define UCBRF1                 (0x20)         /* USCI First Stage Modulation Select 1 */
976
#define UCBRF0                 (0x10)         /* USCI First Stage Modulation Select 0 */
977
#define UCBRS2                 (0x08)         /* USCI Second Stage Modulation Select 2 */
978
#define UCBRS1                 (0x04)         /* USCI Second Stage Modulation Select 1 */
979
#define UCBRS0                 (0x02)         /* USCI Second Stage Modulation Select 0 */
980
#define UCOS16                 (0x01)         /* USCI 16-times Oversampling enable */
981
 
982
#define UCBRF_0                (0x00)         /* USCI First Stage Modulation: 0 */
983
#define UCBRF_1                (0x10)         /* USCI First Stage Modulation: 1 */
984
#define UCBRF_2                (0x20)         /* USCI First Stage Modulation: 2 */
985
#define UCBRF_3                (0x30)         /* USCI First Stage Modulation: 3 */
986
#define UCBRF_4                (0x40)         /* USCI First Stage Modulation: 4 */
987
#define UCBRF_5                (0x50)         /* USCI First Stage Modulation: 5 */
988
#define UCBRF_6                (0x60)         /* USCI First Stage Modulation: 6 */
989
#define UCBRF_7                (0x70)         /* USCI First Stage Modulation: 7 */
990
#define UCBRF_8                (0x80)         /* USCI First Stage Modulation: 8 */
991
#define UCBRF_9                (0x90)         /* USCI First Stage Modulation: 9 */
992
#define UCBRF_10               (0xA0)         /* USCI First Stage Modulation: A */
993
#define UCBRF_11               (0xB0)         /* USCI First Stage Modulation: B */
994
#define UCBRF_12               (0xC0)         /* USCI First Stage Modulation: C */
995
#define UCBRF_13               (0xD0)         /* USCI First Stage Modulation: D */
996
#define UCBRF_14               (0xE0)         /* USCI First Stage Modulation: E */
997
#define UCBRF_15               (0xF0)         /* USCI First Stage Modulation: F */
998
 
999
#define UCBRS_0                (0x00)         /* USCI Second Stage Modulation: 0 */
1000
#define UCBRS_1                (0x02)         /* USCI Second Stage Modulation: 1 */
1001
#define UCBRS_2                (0x04)         /* USCI Second Stage Modulation: 2 */
1002
#define UCBRS_3                (0x06)         /* USCI Second Stage Modulation: 3 */
1003
#define UCBRS_4                (0x08)         /* USCI Second Stage Modulation: 4 */
1004
#define UCBRS_5                (0x0A)         /* USCI Second Stage Modulation: 5 */
1005
#define UCBRS_6                (0x0C)         /* USCI Second Stage Modulation: 6 */
1006
#define UCBRS_7                (0x0E)         /* USCI Second Stage Modulation: 7 */
1007
 
1008
#define UCLISTEN               (0x80)         /* USCI Listen mode */
1009
#define UCFE                   (0x40)         /* USCI Frame Error Flag */
1010
#define UCOE                   (0x20)         /* USCI Overrun Error Flag */
1011
#define UCPE                   (0x10)         /* USCI Parity Error Flag */
1012
#define UCBRK                  (0x08)         /* USCI Break received */
1013
#define UCRXERR                (0x04)         /* USCI RX Error Flag */
1014
#define UCADDR                 (0x02)         /* USCI Address received Flag */
1015
#define UCBUSY                 (0x01)         /* USCI Busy Flag */
1016
#define UCIDLE                 (0x02)         /* USCI Idle line detected Flag */
1017
 
1018
//#define res               (0x80)    /* reserved */
1019
//#define res               (0x40)    /* reserved */
1020
//#define res               (0x20)    /* reserved */
1021
//#define res               (0x10)    /* reserved */
1022
#define UCNACKIE               (0x08)         /* NACK Condition interrupt enable */
1023
#define UCSTPIE                (0x04)         /* STOP Condition interrupt enable */
1024
#define UCSTTIE                (0x02)         /* START Condition interrupt enable */
1025
#define UCALIE                 (0x01)         /* Arbitration Lost interrupt enable */
1026
 
1027
#define UCSCLLOW               (0x40)         /* SCL low */
1028
#define UCGC                   (0x20)         /* General Call address received Flag */
1029
#define UCBBUSY                (0x10)         /* Bus Busy Flag */
1030
#define UCNACKIFG              (0x08)         /* NAK Condition interrupt Flag */
1031
#define UCSTPIFG               (0x04)         /* STOP Condition interrupt Flag */
1032
#define UCSTTIFG               (0x02)         /* START Condition interrupt Flag */
1033
#define UCALIFG                (0x01)         /* Arbitration Lost interrupt Flag */
1034
 
1035
#define UCIRTXPL5              (0x80)         /* IRDA Transmit Pulse Length 5 */
1036
#define UCIRTXPL4              (0x40)         /* IRDA Transmit Pulse Length 4 */
1037
#define UCIRTXPL3              (0x20)         /* IRDA Transmit Pulse Length 3 */
1038
#define UCIRTXPL2              (0x10)         /* IRDA Transmit Pulse Length 2 */
1039
#define UCIRTXPL1              (0x08)         /* IRDA Transmit Pulse Length 1 */
1040
#define UCIRTXPL0              (0x04)         /* IRDA Transmit Pulse Length 0 */
1041
#define UCIRTXCLK              (0x02)         /* IRDA Transmit Pulse Clock Select */
1042
#define UCIREN                 (0x01)         /* IRDA Encoder/Decoder enable */
1043
 
1044
#define UCIRRXFL5              (0x80)         /* IRDA Receive Filter Length 5 */
1045
#define UCIRRXFL4              (0x40)         /* IRDA Receive Filter Length 4 */
1046
#define UCIRRXFL3              (0x20)         /* IRDA Receive Filter Length 3 */
1047
#define UCIRRXFL2              (0x10)         /* IRDA Receive Filter Length 2 */
1048
#define UCIRRXFL1              (0x08)         /* IRDA Receive Filter Length 1 */
1049
#define UCIRRXFL0              (0x04)         /* IRDA Receive Filter Length 0 */
1050
#define UCIRRXPL               (0x02)         /* IRDA Receive Input Polarity */
1051
#define UCIRRXFE               (0x01)         /* IRDA Receive Filter enable */
1052
 
1053
//#define res               (0x80)    /* reserved */
1054
//#define res               (0x40)    /* reserved */
1055
#define UCDELIM1               (0x20)         /* Break Sync Delimiter 1 */
1056
#define UCDELIM0               (0x10)         /* Break Sync Delimiter 0 */
1057
#define UCSTOE                 (0x08)         /* Sync-Field Timeout error */
1058
#define UCBTOE                 (0x04)         /* Break Timeout error */
1059
//#define res               (0x02)    /* reserved */
1060
#define UCABDEN                (0x01)         /* Auto Baud Rate detect enable */
1061
 
1062
#define UCGCEN                 (0x8000)       /* I2C General Call enable */
1063
#define UCOA9                  (0x0200)       /* I2C Own Address 9 */
1064
#define UCOA8                  (0x0100)       /* I2C Own Address 8 */
1065
#define UCOA7                  (0x0080)       /* I2C Own Address 7 */
1066
#define UCOA6                  (0x0040)       /* I2C Own Address 6 */
1067
#define UCOA5                  (0x0020)       /* I2C Own Address 5 */
1068
#define UCOA4                  (0x0010)       /* I2C Own Address 4 */
1069
#define UCOA3                  (0x0008)       /* I2C Own Address 3 */
1070
#define UCOA2                  (0x0004)       /* I2C Own Address 2 */
1071
#define UCOA1                  (0x0002)       /* I2C Own Address 1 */
1072
#define UCOA0                  (0x0001)       /* I2C Own Address 0 */
1073
 
1074
#define UCSA9                  (0x0200)       /* I2C Slave Address 9 */
1075
#define UCSA8                  (0x0100)       /* I2C Slave Address 8 */
1076
#define UCSA7                  (0x0080)       /* I2C Slave Address 7 */
1077
#define UCSA6                  (0x0040)       /* I2C Slave Address 6 */
1078
#define UCSA5                  (0x0020)       /* I2C Slave Address 5 */
1079
#define UCSA4                  (0x0010)       /* I2C Slave Address 4 */
1080
#define UCSA3                  (0x0008)       /* I2C Slave Address 3 */
1081
#define UCSA2                  (0x0004)       /* I2C Slave Address 2 */
1082
#define UCSA1                  (0x0002)       /* I2C Slave Address 1 */
1083
#define UCSA0                  (0x0001)       /* I2C Slave Address 0 */
1084
 
1085
/************************************************************
1086
* WATCHDOG TIMER
1087
************************************************************/
1088
#define __MSP430_HAS_WDT__                    /* Definition to show that Module is available */
1089
 
1090
SFR_16BIT(WDTCTL);                            /* Watchdog Timer Control */
1091
/* The bit names have been prefixed with "WDT" */
1092
#define WDTIS0                 (0x0001)
1093
#define WDTIS1                 (0x0002)
1094
#define WDTSSEL                (0x0004)
1095
#define WDTCNTCL               (0x0008)
1096
#define WDTTMSEL               (0x0010)
1097
#define WDTNMI                 (0x0020)
1098
#define WDTNMIES               (0x0040)
1099
#define WDTHOLD                (0x0080)
1100
 
1101
#define WDTPW                  (0x5A00)
1102
 
1103
/* WDT-interval times [1ms] coded with Bits 0-2 */
1104
/* WDT is clocked by fSMCLK (assumed 1MHz) */
1105
#define WDT_MDLY_32         (WDTPW+WDTTMSEL+WDTCNTCL)                         /* 32ms interval (default) */
1106
#define WDT_MDLY_8          (WDTPW+WDTTMSEL+WDTCNTCL+WDTIS0)                  /* 8ms     " */
1107
#define WDT_MDLY_0_5        (WDTPW+WDTTMSEL+WDTCNTCL+WDTIS1)                  /* 0.5ms   " */
1108
#define WDT_MDLY_0_064      (WDTPW+WDTTMSEL+WDTCNTCL+WDTIS1+WDTIS0)           /* 0.064ms " */
1109
/* WDT is clocked by fACLK (assumed 32KHz) */
1110
#define WDT_ADLY_1000       (WDTPW+WDTTMSEL+WDTCNTCL+WDTSSEL)                 /* 1000ms  " */
1111
#define WDT_ADLY_250        (WDTPW+WDTTMSEL+WDTCNTCL+WDTSSEL+WDTIS0)          /* 250ms   " */
1112
#define WDT_ADLY_16         (WDTPW+WDTTMSEL+WDTCNTCL+WDTSSEL+WDTIS1)          /* 16ms    " */
1113
#define WDT_ADLY_1_9        (WDTPW+WDTTMSEL+WDTCNTCL+WDTSSEL+WDTIS1+WDTIS0)   /* 1.9ms   " */
1114
/* Watchdog mode -> reset after expired time */
1115
/* WDT is clocked by fSMCLK (assumed 1MHz) */
1116
#define WDT_MRST_32         (WDTPW+WDTCNTCL)                                  /* 32ms interval (default) */
1117
#define WDT_MRST_8          (WDTPW+WDTCNTCL+WDTIS0)                           /* 8ms     " */
1118
#define WDT_MRST_0_5        (WDTPW+WDTCNTCL+WDTIS1)                           /* 0.5ms   " */
1119
#define WDT_MRST_0_064      (WDTPW+WDTCNTCL+WDTIS1+WDTIS0)                    /* 0.064ms " */
1120
/* WDT is clocked by fACLK (assumed 32KHz) */
1121
#define WDT_ARST_1000       (WDTPW+WDTCNTCL+WDTSSEL)                          /* 1000ms  " */
1122
#define WDT_ARST_250        (WDTPW+WDTCNTCL+WDTSSEL+WDTIS0)                   /* 250ms   " */
1123
#define WDT_ARST_16         (WDTPW+WDTCNTCL+WDTSSEL+WDTIS1)                   /* 16ms    " */
1124
#define WDT_ARST_1_9        (WDTPW+WDTCNTCL+WDTSSEL+WDTIS1+WDTIS0)            /* 1.9ms   " */
1125
 
1126
/* INTERRUPT CONTROL */
1127
/* These two bits are defined in the Special Function Registers */
1128
/* #define WDTIE               0x01 */
1129
/* #define WDTIFG              0x01 */
1130
 
1131
/************************************************************
1132
* Interrupt Vectors (offset from 0xFFE0)
1133
************************************************************/
1134
 
1135
#define VECTOR_NAME(name)       name##_ptr
1136
#define EMIT_PRAGMA(x)          _Pragma(#x)
1137
#define CREATE_VECTOR(name)     void (* const VECTOR_NAME(name))(void) = &name
1138
#define PLACE_VECTOR(vector,section) EMIT_PRAGMA(DATA_SECTION(vector,section))
1139
#define ISR_VECTOR(func,offset) CREATE_VECTOR(func); \
1140
                                PLACE_VECTOR(VECTOR_NAME(func), offset)
1141
 
1142
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
1143
#define BASICTIMER_VECTOR       ".int00"                    /* 0xFFE0 Basic Timer */
1144
#else
1145
#define BASICTIMER_VECTOR       (0 * 1u)                     /* 0xFFE0 Basic Timer */
1146
/*#define BASICTIMER_ISR(func)    ISR_VECTOR(func, ".int00")  */ /* 0xFFE0 Basic Timer */ /* CCE V2 Style */
1147
#endif
1148
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
1149
#define PORT2_VECTOR            ".int01"                    /* 0xFFE2 Port 2 */
1150
#else
1151
#define PORT2_VECTOR            (1 * 1u)                     /* 0xFFE2 Port 2 */
1152
/*#define PORT2_ISR(func)         ISR_VECTOR(func, ".int01")  */ /* 0xFFE2 Port 2 */ /* CCE V2 Style */
1153
#endif
1154
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
1155
#define PORT1_VECTOR            ".int04"                    /* 0xFFE8 Port 1 */
1156
#else
1157
#define PORT1_VECTOR            (4 * 1u)                     /* 0xFFE8 Port 1 */
1158
/*#define PORT1_ISR(func)         ISR_VECTOR(func, ".int04")  */ /* 0xFFE8 Port 1 */ /* CCE V2 Style */
1159
#endif
1160
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
1161
#define TIMER0_A1_VECTOR        ".int05"                    /* 0xFFEA Timer0_A CC1-2, TA0 */
1162
#else
1163
#define TIMER0_A1_VECTOR        (5 * 1u)                     /* 0xFFEA Timer0_A CC1-2, TA0 */
1164
/*#define TIMER0_A1_ISR(func)     ISR_VECTOR(func, ".int05")  */ /* 0xFFEA Timer0_A CC1-2, TA0 */ /* CCE V2 Style */
1165
#endif
1166
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
1167
#define TIMER0_A0_VECTOR        ".int06"                    /* 0xFFEC Timer0_A CC0 */
1168
#else
1169
#define TIMER0_A0_VECTOR        (6 * 1u)                     /* 0xFFEC Timer0_A CC0 */
1170
/*#define TIMER0_A0_ISR(func)     ISR_VECTOR(func, ".int06")  */ /* 0xFFEC Timer0_A CC0 */ /* CCE V2 Style */
1171
#endif
1172
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
1173
#define ADC10_VECTOR            ".int07"                    /* 0xFFEE ADC10 */
1174
#else
1175
#define ADC10_VECTOR            (7 * 1u)                     /* 0xFFEE ADC10 */
1176
/*#define ADC10_ISR(func)         ISR_VECTOR(func, ".int07")  */ /* 0xFFEE ADC10 */ /* CCE V2 Style */
1177
#endif
1178
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
1179
#define USCIAB0TX_VECTOR        ".int08"                    /* 0xFFF0 USCI A0/B0 Transmit */
1180
#else
1181
#define USCIAB0TX_VECTOR        (8 * 1u)                     /* 0xFFF0 USCI A0/B0 Transmit */
1182
/*#define USCIAB0TX_ISR(func)     ISR_VECTOR(func, ".int08")  */ /* 0xFFF0 USCI A0/B0 Transmit */ /* CCE V2 Style */
1183
#endif
1184
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
1185
#define USCIAB0RX_VECTOR        ".int09"                    /* 0xFFF2 USCI A0/B0 Receive */
1186
#else
1187
#define USCIAB0RX_VECTOR        (9 * 1u)                     /* 0xFFF2 USCI A0/B0 Receive */
1188
/*#define USCIAB0RX_ISR(func)     ISR_VECTOR(func, ".int09")  */ /* 0xFFF2 USCI A0/B0 Receive */ /* CCE V2 Style */
1189
#endif
1190
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
1191
#define WDT_VECTOR              ".int10"                    /* 0xFFF4 Watchdog Timer */
1192
#else
1193
#define WDT_VECTOR              (10 * 1u)                    /* 0xFFF4 Watchdog Timer */
1194
/*#define WDT_ISR(func)           ISR_VECTOR(func, ".int10")  */ /* 0xFFF4 Watchdog Timer */ /* CCE V2 Style */
1195
#endif
1196
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
1197
#define COMPARATORA_VECTOR      ".int11"                    /* 0xFFF6 Comparator A */
1198
#else
1199
#define COMPARATORA_VECTOR      (11 * 1u)                    /* 0xFFF6 Comparator A */
1200
/*#define COMPARATORA_ISR(func)   ISR_VECTOR(func, ".int11")  */ /* 0xFFF6 Comparator A */ /* CCE V2 Style */
1201
#endif
1202
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
1203
#define TIMER1_A1_VECTOR        ".int12"                    /* 0xFFF8 Timer1_A CC1-4, TA1 */
1204
#else
1205
#define TIMER1_A1_VECTOR        (12 * 1u)                    /* 0xFFF8 Timer1_A CC1-4, TA1 */
1206
/*#define TIMER1_A1_ISR(func)     ISR_VECTOR(func, ".int12")  */ /* 0xFFF8 Timer1_A CC1-4, TA1 */ /* CCE V2 Style */
1207
#endif
1208
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
1209
#define TIMER1_A0_VECTOR        ".int13"                    /* 0xFFFA Timer1_A CC0 */
1210
#else
1211
#define TIMER1_A0_VECTOR        (13 * 1u)                    /* 0xFFFA Timer1_A CC0 */
1212
/*#define TIMER1_A0_ISR(func)     ISR_VECTOR(func, ".int13")  */ /* 0xFFFA Timer1_A CC0 */ /* CCE V2 Style */
1213
#endif
1214
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
1215
#define NMI_VECTOR              ".int14"                    /* 0xFFFC Non-maskable */
1216
#else
1217
#define NMI_VECTOR              (14 * 1u)                    /* 0xFFFC Non-maskable */
1218
/*#define NMI_ISR(func)           ISR_VECTOR(func, ".int14")  */ /* 0xFFFC Non-maskable */ /* CCE V2 Style */
1219
#endif
1220
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
1221
#define RESET_VECTOR            ".reset"                    /* 0xFFFE Reset [Highest Priority] */
1222
#else
1223
#define RESET_VECTOR            (15 * 1u)                    /* 0xFFFE Reset [Highest Priority] */
1224
/*#define RESET_ISR(func)         ISR_VECTOR(func, ".int15")  */ /* 0xFFFE Reset [Highest Priority] */ /* CCE V2 Style */
1225
#endif
1226
 
1227
/* Alternate Names */
1228
 
1229
/************************************************************
1230
* End of Modules
1231
************************************************************/
1232
 
1233
#ifdef __cplusplus
1234
}
1235
#endif /* extern "C" */
1236
 
1237
#endif /* #ifndef __msp430x41x2 */
1238