Subversion Repositories DevTools

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2850 dpurdie 1
/******************************************************************************/
2
/* Legacy Header File                                                         */
3
/* Not recommended for use in new projects.                                   */
4
/* Please use the msp430.h file or the device specific header file            */
5
/******************************************************************************/
6
 
7
/********************************************************************
8
*
9
* Standard register and bit definitions for the Texas Instruments
10
* MSP430 microcontroller.
11
*
12
* This file supports assembler and C development for
13
* MSP430x22x2 devices.
14
*
15
* Texas Instruments, Version 1.2
16
*
17
* Rev. 1.0, Setup
18
* Rev. 1.1, added definitions for Interrupt Vectors xxIV
19
* Rev. 1.2, Fixed typo in ADC10: SREF3 -> SREF2
20
*
21
********************************************************************/
22
 
23
#ifndef __msp430x22x2
24
#define __msp430x22x2
25
 
26
#ifdef __cplusplus
27
extern "C" {
28
#endif
29
 
30
 
31
/*----------------------------------------------------------------------------*/
32
/* PERIPHERAL FILE MAP                                                        */
33
/*----------------------------------------------------------------------------*/
34
 
35
/* External references resolved by a device-specific linker command file */
36
#define SFR_8BIT(address)   extern volatile unsigned char address
37
#define SFR_16BIT(address)  extern volatile unsigned int address
38
 
39
 
40
/************************************************************
41
* STANDARD BITS
42
************************************************************/
43
 
44
#define BIT0                   (0x0001)
45
#define BIT1                   (0x0002)
46
#define BIT2                   (0x0004)
47
#define BIT3                   (0x0008)
48
#define BIT4                   (0x0010)
49
#define BIT5                   (0x0020)
50
#define BIT6                   (0x0040)
51
#define BIT7                   (0x0080)
52
#define BIT8                   (0x0100)
53
#define BIT9                   (0x0200)
54
#define BITA                   (0x0400)
55
#define BITB                   (0x0800)
56
#define BITC                   (0x1000)
57
#define BITD                   (0x2000)
58
#define BITE                   (0x4000)
59
#define BITF                   (0x8000)
60
 
61
/************************************************************
62
* STATUS REGISTER BITS
63
************************************************************/
64
 
65
#define C                      (0x0001)
66
#define Z                      (0x0002)
67
#define N                      (0x0004)
68
#define V                      (0x0100)
69
#define GIE                    (0x0008)
70
#define CPUOFF                 (0x0010)
71
#define OSCOFF                 (0x0020)
72
#define SCG0                   (0x0040)
73
#define SCG1                   (0x0080)
74
 
75
/* Low Power Modes coded with Bits 4-7 in SR */
76
 
77
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
78
#define LPM0                   (CPUOFF)
79
#define LPM1                   (SCG0+CPUOFF)
80
#define LPM2                   (SCG1+CPUOFF)
81
#define LPM3                   (SCG1+SCG0+CPUOFF)
82
#define LPM4                   (SCG1+SCG0+OSCOFF+CPUOFF)
83
/* End #defines for assembler */
84
 
85
#else /* Begin #defines for C */
86
#define LPM0_bits              (CPUOFF)
87
#define LPM1_bits              (SCG0+CPUOFF)
88
#define LPM2_bits              (SCG1+CPUOFF)
89
#define LPM3_bits              (SCG1+SCG0+CPUOFF)
90
#define LPM4_bits              (SCG1+SCG0+OSCOFF+CPUOFF)
91
 
92
#include "in430.h"
93
 
94
#define LPM0         _bis_SR_register(LPM0_bits)         /* Enter Low Power Mode 0 */
95
#define LPM0_EXIT    _bic_SR_register_on_exit(LPM0_bits) /* Exit Low Power Mode 0 */
96
#define LPM1         _bis_SR_register(LPM1_bits)         /* Enter Low Power Mode 1 */
97
#define LPM1_EXIT    _bic_SR_register_on_exit(LPM1_bits) /* Exit Low Power Mode 1 */
98
#define LPM2         _bis_SR_register(LPM2_bits)         /* Enter Low Power Mode 2 */
99
#define LPM2_EXIT    _bic_SR_register_on_exit(LPM2_bits) /* Exit Low Power Mode 2 */
100
#define LPM3         _bis_SR_register(LPM3_bits)         /* Enter Low Power Mode 3 */
101
#define LPM3_EXIT    _bic_SR_register_on_exit(LPM3_bits) /* Exit Low Power Mode 3 */
102
#define LPM4         _bis_SR_register(LPM4_bits)         /* Enter Low Power Mode 4 */
103
#define LPM4_EXIT    _bic_SR_register_on_exit(LPM4_bits) /* Exit Low Power Mode 4 */
104
#endif /* End #defines for C */
105
 
106
/************************************************************
107
* PERIPHERAL FILE MAP
108
************************************************************/
109
 
110
/************************************************************
111
* SPECIAL FUNCTION REGISTER ADDRESSES + CONTROL BITS
112
************************************************************/
113
 
114
SFR_8BIT(IE1);                                /* Interrupt Enable 1 */
115
#define WDTIE                  (0x01)         /* Watchdog Interrupt Enable */
116
#define OFIE                   (0x02)         /* Osc. Fault  Interrupt Enable */
117
#define NMIIE                  (0x10)         /* NMI Interrupt Enable */
118
#define ACCVIE                 (0x20)         /* Flash Access Violation Interrupt Enable */
119
 
120
SFR_8BIT(IFG1);                               /* Interrupt Flag 1 */
121
#define WDTIFG                 (0x01)         /* Watchdog Interrupt Flag */
122
#define OFIFG                  (0x02)         /* Osc. Fault Interrupt Flag */
123
#define PORIFG                 (0x04)         /* Power On Interrupt Flag */
124
#define RSTIFG                 (0x08)         /* Reset Interrupt Flag */
125
#define NMIIFG                 (0x10)         /* NMI Interrupt Flag */
126
 
127
SFR_8BIT(IE2);                                /* Interrupt Enable 2 */
128
#define UC0IE                  IE2
129
#define UCA0RXIE               (0x01)
130
#define UCA0TXIE               (0x02)
131
#define UCB0RXIE               (0x04)
132
#define UCB0TXIE               (0x08)
133
 
134
SFR_8BIT(IFG2);                               /* Interrupt Flag 2 */
135
#define UC0IFG                 IFG2
136
#define UCA0RXIFG              (0x01)
137
#define UCA0TXIFG              (0x02)
138
#define UCB0RXIFG              (0x04)
139
#define UCB0TXIFG              (0x08)
140
 
141
/************************************************************
142
* ADC10
143
************************************************************/
144
#define __MSP430_HAS_ADC10__                  /* Definition to show that Module is available */
145
 
146
SFR_8BIT(ADC10DTC0);                          /* ADC10 Data Transfer Control 0 */
147
SFR_8BIT(ADC10DTC1);                          /* ADC10 Data Transfer Control 1 */
148
SFR_8BIT(ADC10AE0);                           /* ADC10 Analog Enable 0 */
149
SFR_8BIT(ADC10AE1);                           /* ADC10 Analog Enable 1 */
150
 
151
SFR_16BIT(ADC10CTL0);                         /* ADC10 Control 0 */
152
SFR_16BIT(ADC10CTL1);                         /* ADC10 Control 1 */
153
SFR_16BIT(ADC10MEM);                          /* ADC10 Memory */
154
SFR_16BIT(ADC10SA);                           /* ADC10 Data Transfer Start Address */
155
 
156
/* ADC10CTL0 */
157
#define ADC10SC                (0x001)        /* ADC10 Start Conversion */
158
#define ENC                    (0x002)        /* ADC10 Enable Conversion */
159
#define ADC10IFG               (0x004)        /* ADC10 Interrupt Flag */
160
#define ADC10IE                (0x008)        /* ADC10 Interrupt Enalbe */
161
#define ADC10ON                (0x010)        /* ADC10 On/Enable */
162
#define REFON                  (0x020)        /* ADC10 Reference on */
163
#define REF2_5V                (0x040)        /* ADC10 Ref 0:1.5V / 1:2.5V */
164
#define MSC                    (0x080)        /* ADC10 Multiple SampleConversion */
165
#define REFBURST               (0x100)        /* ADC10 Reference Burst Mode */
166
#define REFOUT                 (0x200)        /* ADC10 Enalbe output of Ref. */
167
#define ADC10SR                (0x400)        /* ADC10 Sampling Rate 0:200ksps / 1:50ksps */
168
#define ADC10SHT0              (0x800)        /* ADC10 Sample Hold Select Bit: 0 */
169
#define ADC10SHT1              (0x1000)       /* ADC10 Sample Hold Select Bit: 1 */
170
#define SREF0                  (0x2000)       /* ADC10 Reference Select Bit: 0 */
171
#define SREF1                  (0x4000)       /* ADC10 Reference Select Bit: 1 */
172
#define SREF2                  (0x8000)       /* ADC10 Reference Select Bit: 2 */
173
#define ADC10SHT_0             (0*0x800u)     /* 4 x ADC10CLKs */
174
#define ADC10SHT_1             (1*0x800u)     /* 8 x ADC10CLKs */
175
#define ADC10SHT_2             (2*0x800u)     /* 16 x ADC10CLKs */
176
#define ADC10SHT_3             (3*0x800u)     /* 64 x ADC10CLKs */
177
 
178
#define SREF_0                 (0*0x2000u)    /* VR+ = AVCC and VR- = AVSS */
179
#define SREF_1                 (1*0x2000u)    /* VR+ = VREF+ and VR- = AVSS */
180
#define SREF_2                 (2*0x2000u)    /* VR+ = VEREF+ and VR- = AVSS */
181
#define SREF_3                 (3*0x2000u)    /* VR+ = VEREF+ and VR- = AVSS */
182
#define SREF_4                 (4*0x2000u)    /* VR+ = AVCC and VR- = VREF-/VEREF- */
183
#define SREF_5                 (5*0x2000u)    /* VR+ = VREF+ and VR- = VREF-/VEREF- */
184
#define SREF_6                 (6*0x2000u)    /* VR+ = VEREF+ and VR- = VREF-/VEREF- */
185
#define SREF_7                 (7*0x2000u)    /* VR+ = VEREF+ and VR- = VREF-/VEREF- */
186
 
187
/* ADC10CTL1 */
188
#define ADC10BUSY              (0x0001)       /* ADC10 BUSY */
189
#define CONSEQ0                (0x0002)       /* ADC10 Conversion Sequence Select 0 */
190
#define CONSEQ1                (0x0004)       /* ADC10 Conversion Sequence Select 1 */
191
#define ADC10SSEL0             (0x0008)       /* ADC10 Clock Source Select Bit: 0 */
192
#define ADC10SSEL1             (0x0010)       /* ADC10 Clock Source Select Bit: 1 */
193
#define ADC10DIV0              (0x0020)       /* ADC10 Clock Divider Select Bit: 0 */
194
#define ADC10DIV1              (0x0040)       /* ADC10 Clock Divider Select Bit: 1 */
195
#define ADC10DIV2              (0x0080)       /* ADC10 Clock Divider Select Bit: 2 */
196
#define ISSH                   (0x0100)       /* ADC10 Invert Sample Hold Signal */
197
#define ADC10DF                (0x0200)       /* ADC10 Data Format 0:binary 1:2's complement */
198
#define SHS0                   (0x0400)       /* ADC10 Sample/Hold Source Bit: 0 */
199
#define SHS1                   (0x0800)       /* ADC10 Sample/Hold Source Bit: 1 */
200
#define INCH0                  (0x1000)       /* ADC10 Input Channel Select Bit: 0 */
201
#define INCH1                  (0x2000)       /* ADC10 Input Channel Select Bit: 1 */
202
#define INCH2                  (0x4000)       /* ADC10 Input Channel Select Bit: 2 */
203
#define INCH3                  (0x8000)       /* ADC10 Input Channel Select Bit: 3 */
204
 
205
#define CONSEQ_0               (0*2u)         /* Single channel single conversion */
206
#define CONSEQ_1               (1*2u)         /* Sequence of channels */
207
#define CONSEQ_2               (2*2u)         /* Repeat single channel */
208
#define CONSEQ_3               (3*2u)         /* Repeat sequence of channels */
209
 
210
#define ADC10SSEL_0            (0*8u)         /* ADC10OSC */
211
#define ADC10SSEL_1            (1*8u)         /* ACLK */
212
#define ADC10SSEL_2            (2*8u)         /* MCLK */
213
#define ADC10SSEL_3            (3*8u)         /* SMCLK */
214
 
215
#define ADC10DIV_0             (0*0x20u)      /* ADC10 Clock Divider Select 0 */
216
#define ADC10DIV_1             (1*0x20u)      /* ADC10 Clock Divider Select 1 */
217
#define ADC10DIV_2             (2*0x20u)      /* ADC10 Clock Divider Select 2 */
218
#define ADC10DIV_3             (3*0x20u)      /* ADC10 Clock Divider Select 3 */
219
#define ADC10DIV_4             (4*0x20u)      /* ADC10 Clock Divider Select 4 */
220
#define ADC10DIV_5             (5*0x20u)      /* ADC10 Clock Divider Select 5 */
221
#define ADC10DIV_6             (6*0x20u)      /* ADC10 Clock Divider Select 6 */
222
#define ADC10DIV_7             (7*0x20u)      /* ADC10 Clock Divider Select 7 */
223
 
224
#define SHS_0                  (0*0x400u)     /* ADC10SC */
225
#define SHS_1                  (1*0x400u)     /* TA3 OUT1 */
226
#define SHS_2                  (2*0x400u)     /* TA3 OUT0 */
227
#define SHS_3                  (3*0x400u)     /* TA3 OUT2 */
228
 
229
#define INCH_0                 (0*0x1000u)    /* Selects Channel 0 */
230
#define INCH_1                 (1*0x1000u)    /* Selects Channel 1 */
231
#define INCH_2                 (2*0x1000u)    /* Selects Channel 2 */
232
#define INCH_3                 (3*0x1000u)    /* Selects Channel 3 */
233
#define INCH_4                 (4*0x1000u)    /* Selects Channel 4 */
234
#define INCH_5                 (5*0x1000u)    /* Selects Channel 5 */
235
#define INCH_6                 (6*0x1000u)    /* Selects Channel 6 */
236
#define INCH_7                 (7*0x1000u)    /* Selects Channel 7 */
237
#define INCH_8                 (8*0x1000u)    /* Selects Channel 8 */
238
#define INCH_9                 (9*0x1000u)    /* Selects Channel 9 */
239
#define INCH_10                (10*0x1000u)   /* Selects Channel 10 */
240
#define INCH_11                (11*0x1000u)   /* Selects Channel 11 */
241
#define INCH_12                (12*0x1000u)   /* Selects Channel 12 */
242
#define INCH_13                (13*0x1000u)   /* Selects Channel 13 */
243
#define INCH_14                (14*0x1000u)   /* Selects Channel 14 */
244
#define INCH_15                (15*0x1000u)   /* Selects Channel 15 */
245
 
246
/* ADC10DTC0 */
247
#define ADC10FETCH             (0x001)        /* This bit should normally be reset */
248
#define ADC10B1                (0x002)        /* ADC10 block one */
249
#define ADC10CT                (0x004)        /* ADC10 continuous transfer */
250
#define ADC10TB                (0x008)        /* ADC10 two-block mode */
251
#define ADC10DISABLE           (0x000)        /* ADC10DTC1 */
252
 
253
/************************************************************
254
* Basic Clock Module
255
************************************************************/
256
#define __MSP430_HAS_BC2__                    /* Definition to show that Module is available */
257
 
258
SFR_8BIT(DCOCTL);                             /* DCO Clock Frequency Control */
259
SFR_8BIT(BCSCTL1);                            /* Basic Clock System Control 1 */
260
SFR_8BIT(BCSCTL2);                            /* Basic Clock System Control 2 */
261
SFR_8BIT(BCSCTL3);                            /* Basic Clock System Control 3 */
262
 
263
#define MOD0                   (0x01)         /* Modulation Bit 0 */
264
#define MOD1                   (0x02)         /* Modulation Bit 1 */
265
#define MOD2                   (0x04)         /* Modulation Bit 2 */
266
#define MOD3                   (0x08)         /* Modulation Bit 3 */
267
#define MOD4                   (0x10)         /* Modulation Bit 4 */
268
#define DCO0                   (0x20)         /* DCO Select Bit 0 */
269
#define DCO1                   (0x40)         /* DCO Select Bit 1 */
270
#define DCO2                   (0x80)         /* DCO Select Bit 2 */
271
 
272
#define RSEL0                  (0x01)         /* Range Select Bit 0 */
273
#define RSEL1                  (0x02)         /* Range Select Bit 1 */
274
#define RSEL2                  (0x04)         /* Range Select Bit 2 */
275
#define RSEL3                  (0x08)         /* Range Select Bit 3 */
276
#define DIVA0                  (0x10)         /* ACLK Divider 0 */
277
#define DIVA1                  (0x20)         /* ACLK Divider 1 */
278
#define XTS                    (0x40)         /* LFXTCLK 0:Low Freq. / 1: High Freq. */
279
#define XT2OFF                 (0x80)         /* Enable XT2CLK */
280
 
281
#define DIVA_0                 (0x00)         /* ACLK Divider 0: /1 */
282
#define DIVA_1                 (0x10)         /* ACLK Divider 1: /2 */
283
#define DIVA_2                 (0x20)         /* ACLK Divider 2: /4 */
284
#define DIVA_3                 (0x30)         /* ACLK Divider 3: /8 */
285
 
286
#define DCOR                   (0x01)         /* Enable External Resistor : 1 */
287
#define DIVS0                  (0x02)         /* SMCLK Divider 0 */
288
#define DIVS1                  (0x04)         /* SMCLK Divider 1 */
289
#define SELS                   (0x08)         /* SMCLK Source Select 0:DCOCLK / 1:XT2CLK/LFXTCLK */
290
#define DIVM0                  (0x10)         /* MCLK Divider 0 */
291
#define DIVM1                  (0x20)         /* MCLK Divider 1 */
292
#define SELM0                  (0x40)         /* MCLK Source Select 0 */
293
#define SELM1                  (0x80)         /* MCLK Source Select 1 */
294
 
295
#define DIVS_0                 (0x00)         /* SMCLK Divider 0: /1 */
296
#define DIVS_1                 (0x02)         /* SMCLK Divider 1: /2 */
297
#define DIVS_2                 (0x04)         /* SMCLK Divider 2: /4 */
298
#define DIVS_3                 (0x06)         /* SMCLK Divider 3: /8 */
299
 
300
#define DIVM_0                 (0x00)         /* MCLK Divider 0: /1 */
301
#define DIVM_1                 (0x10)         /* MCLK Divider 1: /2 */
302
#define DIVM_2                 (0x20)         /* MCLK Divider 2: /4 */
303
#define DIVM_3                 (0x30)         /* MCLK Divider 3: /8 */
304
 
305
#define SELM_0                 (0x00)         /* MCLK Source Select 0: DCOCLK */
306
#define SELM_1                 (0x40)         /* MCLK Source Select 1: DCOCLK */
307
#define SELM_2                 (0x80)         /* MCLK Source Select 2: XT2CLK/LFXTCLK */
308
#define SELM_3                 (0xC0)         /* MCLK Source Select 3: LFXTCLK */
309
 
310
#define LFXT1OF                (0x01)         /* Low/high Frequency Oscillator Fault Flag */
311
#define XT2OF                  (0x02)         /* High frequency oscillator 2 fault flag */
312
#define XCAP0                  (0x04)         /* XIN/XOUT Cap 0 */
313
#define XCAP1                  (0x08)         /* XIN/XOUT Cap 1 */
314
#define LFXT1S0                (0x10)         /* Mode 0 for LFXT1 (XTS = 0) */
315
#define LFXT1S1                (0x20)         /* Mode 1 for LFXT1 (XTS = 0) */
316
#define XT2S0                  (0x40)         /* Mode 0 for XT2 */
317
#define XT2S1                  (0x80)         /* Mode 1 for XT2 */
318
 
319
#define XCAP_0                 (0x00)         /* XIN/XOUT Cap : 0 pF */
320
#define XCAP_1                 (0x04)         /* XIN/XOUT Cap : 6 pF */
321
#define XCAP_2                 (0x08)         /* XIN/XOUT Cap : 10 pF */
322
#define XCAP_3                 (0x0C)         /* XIN/XOUT Cap : 12.5 pF */
323
 
324
#define LFXT1S_0               (0x00)         /* Mode 0 for LFXT1 : Normal operation */
325
#define LFXT1S_1               (0x10)         /* Mode 1 for LFXT1 : Reserved */
326
#define LFXT1S_2               (0x20)         /* Mode 2 for LFXT1 : VLO */
327
#define LFXT1S_3               (0x30)         /* Mode 3 for LFXT1 : Digital input signal */
328
 
329
#define XT2S_0                 (0x00)         /* Mode 0 for XT2 : 0.4 - 1 MHz */
330
#define XT2S_1                 (0x40)         /* Mode 1 for XT2 : 1 - 4 MHz */
331
#define XT2S_2                 (0x80)         /* Mode 2 for XT2 : 2 - 16 MHz */
332
#define XT2S_3                 (0xC0)         /* Mode 3 for XT2 : Digital input signal */
333
 
334
/*************************************************************
335
* Flash Memory
336
*************************************************************/
337
#define __MSP430_HAS_FLASH2__                 /* Definition to show that Module is available */
338
 
339
SFR_16BIT(FCTL1);                             /* FLASH Control 1 */
340
SFR_16BIT(FCTL2);                             /* FLASH Control 2 */
341
SFR_16BIT(FCTL3);                             /* FLASH Control 3 */
342
 
343
#define FRKEY                  (0x9600)       /* Flash key returned by read */
344
#define FWKEY                  (0xA500)       /* Flash key for write */
345
#define FXKEY                  (0x3300)       /* for use with XOR instruction */
346
 
347
#define ERASE                  (0x0002)       /* Enable bit for Flash segment erase */
348
#define MERAS                  (0x0004)       /* Enable bit for Flash mass erase */
349
#define EEI                    (0x0008)       /* Enable Erase Interrupts */
350
#define EEIEX                  (0x0010)       /* Enable Emergency Interrupt Exit */
351
#define WRT                    (0x0040)       /* Enable bit for Flash write */
352
#define BLKWRT                 (0x0080)       /* Enable bit for Flash segment write */
353
#define SEGWRT                 (0x0080)       /* old definition */ /* Enable bit for Flash segment write */
354
 
355
#define FN0                    (0x0001)       /* Divide Flash clock by 1 to 64 using FN0 to FN5 according to: */
356
#define FN1                    (0x0002)       /*  32*FN5 + 16*FN4 + 8*FN3 + 4*FN2 + 2*FN1 + FN0 + 1 */
357
#ifndef FN2
358
#define FN2                    (0x0004)
359
#endif
360
#ifndef FN3
361
#define FN3                    (0x0008)
362
#endif
363
#ifndef FN4
364
#define FN4                    (0x0010)
365
#endif
366
#define FN5                    (0x0020)
367
#define FSSEL0                 (0x0040)       /* Flash clock select 0 */        /* to distinguish from USART SSELx */
368
#define FSSEL1                 (0x0080)       /* Flash clock select 1 */
369
 
370
#define FSSEL_0                (0x0000)       /* Flash clock select: 0 - ACLK */
371
#define FSSEL_1                (0x0040)       /* Flash clock select: 1 - MCLK */
372
#define FSSEL_2                (0x0080)       /* Flash clock select: 2 - SMCLK */
373
#define FSSEL_3                (0x00C0)       /* Flash clock select: 3 - SMCLK */
374
 
375
#define BUSY                   (0x0001)       /* Flash busy: 1 */
376
#define KEYV                   (0x0002)       /* Flash Key violation flag */
377
#define ACCVIFG                (0x0004)       /* Flash Access violation flag */
378
#define WAIT                   (0x0008)       /* Wait flag for segment write */
379
#define LOCK                   (0x0010)       /* Lock bit: 1 - Flash is locked (read only) */
380
#define EMEX                   (0x0020)       /* Flash Emergency Exit */
381
#define LOCKA                  (0x0040)       /* Segment A Lock bit: read = 1 - Segment is locked (read only) */
382
#define FAIL                   (0x0080)       /* Last Program or Erase failed */
383
 
384
/************************************************************
385
* DIGITAL I/O Port1/2 Pull up / Pull down Resistors
386
************************************************************/
387
#define __MSP430_HAS_PORT1_R__                /* Definition to show that Module is available */
388
#define __MSP430_HAS_PORT2_R__                /* Definition to show that Module is available */
389
 
390
SFR_8BIT(P1IN);                               /* Port 1 Input */
391
SFR_8BIT(P1OUT);                              /* Port 1 Output */
392
SFR_8BIT(P1DIR);                              /* Port 1 Direction */
393
SFR_8BIT(P1IFG);                              /* Port 1 Interrupt Flag */
394
SFR_8BIT(P1IES);                              /* Port 1 Interrupt Edge Select */
395
SFR_8BIT(P1IE);                               /* Port 1 Interrupt Enable */
396
SFR_8BIT(P1SEL);                              /* Port 1 Selection */
397
SFR_8BIT(P1REN);                              /* Port 1 Resistor Enable */
398
 
399
SFR_8BIT(P2IN);                               /* Port 2 Input */
400
SFR_8BIT(P2OUT);                              /* Port 2 Output */
401
SFR_8BIT(P2DIR);                              /* Port 2 Direction */
402
SFR_8BIT(P2IFG);                              /* Port 2 Interrupt Flag */
403
SFR_8BIT(P2IES);                              /* Port 2 Interrupt Edge Select */
404
SFR_8BIT(P2IE);                               /* Port 2 Interrupt Enable */
405
SFR_8BIT(P2SEL);                              /* Port 2 Selection */
406
SFR_8BIT(P2REN);                              /* Port 2 Resistor Enable */
407
 
408
/************************************************************
409
* DIGITAL I/O Port3/4 Pull up / Pull down Resistors
410
************************************************************/
411
#define __MSP430_HAS_PORT3_R__                /* Definition to show that Module is available */
412
#define __MSP430_HAS_PORT4_R__                /* Definition to show that Module is available */
413
 
414
SFR_8BIT(P3IN);                               /* Port 3 Input */
415
SFR_8BIT(P3OUT);                              /* Port 3 Output */
416
SFR_8BIT(P3DIR);                              /* Port 3 Direction */
417
SFR_8BIT(P3SEL);                              /* Port 3 Selection */
418
SFR_8BIT(P3REN);                              /* Port 3 Resistor Enable */
419
 
420
SFR_8BIT(P4IN);                               /* Port 4 Input */
421
SFR_8BIT(P4OUT);                              /* Port 4 Output */
422
SFR_8BIT(P4DIR);                              /* Port 4 Direction */
423
SFR_8BIT(P4SEL);                              /* Port 4 Selection */
424
SFR_8BIT(P4REN);                              /* Port 4 Resistor Enable */
425
 
426
/************************************************************
427
* Timer A3
428
************************************************************/
429
#define __MSP430_HAS_TA3__                    /* Definition to show that Module is available */
430
 
431
SFR_16BIT(TAIV);                              /* Timer A Interrupt Vector Word */
432
SFR_16BIT(TACTL);                             /* Timer A Control */
433
SFR_16BIT(TACCTL0);                           /* Timer A Capture/Compare Control 0 */
434
SFR_16BIT(TACCTL1);                           /* Timer A Capture/Compare Control 1 */
435
SFR_16BIT(TACCTL2);                           /* Timer A Capture/Compare Control 2 */
436
SFR_16BIT(TAR);                               /* Timer A Counter Register */
437
SFR_16BIT(TACCR0);                            /* Timer A Capture/Compare 0 */
438
SFR_16BIT(TACCR1);                            /* Timer A Capture/Compare 1 */
439
SFR_16BIT(TACCR2);                            /* Timer A Capture/Compare 2 */
440
 
441
/* Alternate register names */
442
#define CCTL0                  TACCTL0        /* Timer A Capture/Compare Control 0 */
443
#define CCTL1                  TACCTL1        /* Timer A Capture/Compare Control 1 */
444
#define CCTL2                  TACCTL2        /* Timer A Capture/Compare Control 2 */
445
#define CCR0                   TACCR0         /* Timer A Capture/Compare 0 */
446
#define CCR1                   TACCR1         /* Timer A Capture/Compare 1 */
447
#define CCR2                   TACCR2         /* Timer A Capture/Compare 2 */
448
#define CCTL0_                 TACCTL0_       /* Timer A Capture/Compare Control 0 */
449
#define CCTL1_                 TACCTL1_       /* Timer A Capture/Compare Control 1 */
450
#define CCTL2_                 TACCTL2_       /* Timer A Capture/Compare Control 2 */
451
#define CCR0_                  TACCR0_        /* Timer A Capture/Compare 0 */
452
#define CCR1_                  TACCR1_        /* Timer A Capture/Compare 1 */
453
#define CCR2_                  TACCR2_        /* Timer A Capture/Compare 2 */
454
/* Alternate register names - 5xx style */
455
#define TA0IV                  TAIV           /* Timer A Interrupt Vector Word */
456
#define TA0CTL                 TACTL          /* Timer A Control */
457
#define TA0CCTL0               TACCTL0        /* Timer A Capture/Compare Control 0 */
458
#define TA0CCTL1               TACCTL1        /* Timer A Capture/Compare Control 1 */
459
#define TA0CCTL2               TACCTL2        /* Timer A Capture/Compare Control 2 */
460
#define TA0R                   TAR            /* Timer A Counter Register */
461
#define TA0CCR0                TACCR0         /* Timer A Capture/Compare 0 */
462
#define TA0CCR1                TACCR1         /* Timer A Capture/Compare 1 */
463
#define TA0CCR2                TACCR2         /* Timer A Capture/Compare 2 */
464
#define TA0IV_                 TAIV_          /* Timer A Interrupt Vector Word */
465
#define TA0CTL_                TACTL_         /* Timer A Control */
466
#define TA0CCTL0_              TACCTL0_       /* Timer A Capture/Compare Control 0 */
467
#define TA0CCTL1_              TACCTL1_       /* Timer A Capture/Compare Control 1 */
468
#define TA0CCTL2_              TACCTL2_       /* Timer A Capture/Compare Control 2 */
469
#define TA0R_                  TAR_           /* Timer A Counter Register */
470
#define TA0CCR0_               TACCR0_        /* Timer A Capture/Compare 0 */
471
#define TA0CCR1_               TACCR1_        /* Timer A Capture/Compare 1 */
472
#define TA0CCR2_               TACCR2_        /* Timer A Capture/Compare 2 */
473
 
474
#define TASSEL1                (0x0200)       /* Timer A clock source select 0 */
475
#define TASSEL0                (0x0100)       /* Timer A clock source select 1 */
476
#define ID1                    (0x0080)       /* Timer A clock input divider 1 */
477
#define ID0                    (0x0040)       /* Timer A clock input divider 0 */
478
#define MC1                    (0x0020)       /* Timer A mode control 1 */
479
#define MC0                    (0x0010)       /* Timer A mode control 0 */
480
#define TACLR                  (0x0004)       /* Timer A counter clear */
481
#define TAIE                   (0x0002)       /* Timer A counter interrupt enable */
482
#define TAIFG                  (0x0001)       /* Timer A counter interrupt flag */
483
 
484
#define MC_0                   (0*0x10u)      /* Timer A mode control: 0 - Stop */
485
#define MC_1                   (1*0x10u)      /* Timer A mode control: 1 - Up to CCR0 */
486
#define MC_2                   (2*0x10u)      /* Timer A mode control: 2 - Continous up */
487
#define MC_3                   (3*0x10u)      /* Timer A mode control: 3 - Up/Down */
488
#define ID_0                   (0*0x40u)      /* Timer A input divider: 0 - /1 */
489
#define ID_1                   (1*0x40u)      /* Timer A input divider: 1 - /2 */
490
#define ID_2                   (2*0x40u)      /* Timer A input divider: 2 - /4 */
491
#define ID_3                   (3*0x40u)      /* Timer A input divider: 3 - /8 */
492
#define TASSEL_0               (0*0x100u)     /* Timer A clock source select: 0 - TACLK */
493
#define TASSEL_1               (1*0x100u)     /* Timer A clock source select: 1 - ACLK  */
494
#define TASSEL_2               (2*0x100u)     /* Timer A clock source select: 2 - SMCLK */
495
#define TASSEL_3               (3*0x100u)     /* Timer A clock source select: 3 - INCLK */
496
 
497
#define CM1                    (0x8000)       /* Capture mode 1 */
498
#define CM0                    (0x4000)       /* Capture mode 0 */
499
#define CCIS1                  (0x2000)       /* Capture input select 1 */
500
#define CCIS0                  (0x1000)       /* Capture input select 0 */
501
#define SCS                    (0x0800)       /* Capture sychronize */
502
#define SCCI                   (0x0400)       /* Latched capture signal (read) */
503
#define CAP                    (0x0100)       /* Capture mode: 1 /Compare mode : 0 */
504
#define OUTMOD2                (0x0080)       /* Output mode 2 */
505
#define OUTMOD1                (0x0040)       /* Output mode 1 */
506
#define OUTMOD0                (0x0020)       /* Output mode 0 */
507
#define CCIE                   (0x0010)       /* Capture/compare interrupt enable */
508
#define CCI                    (0x0008)       /* Capture input signal (read) */
509
#define OUT                    (0x0004)       /* PWM Output signal if output mode 0 */
510
#define COV                    (0x0002)       /* Capture/compare overflow flag */
511
#define CCIFG                  (0x0001)       /* Capture/compare interrupt flag */
512
 
513
#define OUTMOD_0               (0*0x20u)      /* PWM output mode: 0 - output only */
514
#define OUTMOD_1               (1*0x20u)      /* PWM output mode: 1 - set */
515
#define OUTMOD_2               (2*0x20u)      /* PWM output mode: 2 - PWM toggle/reset */
516
#define OUTMOD_3               (3*0x20u)      /* PWM output mode: 3 - PWM set/reset */
517
#define OUTMOD_4               (4*0x20u)      /* PWM output mode: 4 - toggle */
518
#define OUTMOD_5               (5*0x20u)      /* PWM output mode: 5 - Reset */
519
#define OUTMOD_6               (6*0x20u)      /* PWM output mode: 6 - PWM toggle/set */
520
#define OUTMOD_7               (7*0x20u)      /* PWM output mode: 7 - PWM reset/set */
521
#define CCIS_0                 (0*0x1000u)    /* Capture input select: 0 - CCIxA */
522
#define CCIS_1                 (1*0x1000u)    /* Capture input select: 1 - CCIxB */
523
#define CCIS_2                 (2*0x1000u)    /* Capture input select: 2 - GND */
524
#define CCIS_3                 (3*0x1000u)    /* Capture input select: 3 - Vcc */
525
#define CM_0                   (0*0x4000u)    /* Capture mode: 0 - disabled */
526
#define CM_1                   (1*0x4000u)    /* Capture mode: 1 - pos. edge */
527
#define CM_2                   (2*0x4000u)    /* Capture mode: 1 - neg. edge */
528
#define CM_3                   (3*0x4000u)    /* Capture mode: 1 - both edges */
529
 
530
/* TA3IV Definitions */
531
#define TAIV_NONE              (0x0000)       /* No Interrupt pending */
532
#define TAIV_TACCR1            (0x0002)       /* TACCR1_CCIFG */
533
#define TAIV_TACCR2            (0x0004)       /* TACCR2_CCIFG */
534
#define TAIV_6                 (0x0006)       /* Reserved */
535
#define TAIV_8                 (0x0008)       /* Reserved */
536
#define TAIV_TAIFG             (0x000A)       /* TAIFG */
537
 
538
/************************************************************
539
* Timer B3
540
************************************************************/
541
#define __MSP430_HAS_TB3__                    /* Definition to show that Module is available */
542
 
543
SFR_16BIT(TBIV);                              /* Timer B Interrupt Vector Word */
544
SFR_16BIT(TBCTL);                             /* Timer B Control */
545
SFR_16BIT(TBCCTL0);                           /* Timer B Capture/Compare Control 0 */
546
SFR_16BIT(TBCCTL1);                           /* Timer B Capture/Compare Control 1 */
547
SFR_16BIT(TBCCTL2);                           /* Timer B Capture/Compare Control 2 */
548
SFR_16BIT(TBR);                               /* Timer B Counter Register */
549
SFR_16BIT(TBCCR0);                            /* Timer B Capture/Compare 0 */
550
SFR_16BIT(TBCCR1);                            /* Timer B Capture/Compare 1 */
551
SFR_16BIT(TBCCR2);                            /* Timer B Capture/Compare 2 */
552
 
553
/* Alternate register names - 5xx style */
554
#define TB0IV                  TBIV           /* Timer B Interrupt Vector Word */
555
#define TB0CTL                 TBCTL          /* Timer B Control */
556
#define TB0CCTL0               TBCCTL0        /* Timer B Capture/Compare Control 0 */
557
#define TB0CCTL1               TBCCTL1        /* Timer B Capture/Compare Control 1 */
558
#define TB0CCTL2               TBCCTL2        /* Timer B Capture/Compare Control 2 */
559
#define TB0R                   TBR            /* Timer B Counter Register */
560
#define TB0CCR0                TBCCR0         /* Timer B Capture/Compare 0 */
561
#define TB0CCR1                TBCCR1         /* Timer B Capture/Compare 1 */
562
#define TB0CCR2                TBCCR2         /* Timer B Capture/Compare 2 */
563
#define TB0IV_                 TBIV_          /* Timer B Interrupt Vector Word */
564
#define TB0CTL_                TBCTL_         /* Timer B Control */
565
#define TB0CCTL0_              TBCCTL0_       /* Timer B Capture/Compare Control 0 */
566
#define TB0CCTL1_              TBCCTL1_       /* Timer B Capture/Compare Control 1 */
567
#define TB0CCTL2_              TBCCTL2_       /* Timer B Capture/Compare Control 2 */
568
#define TB0R_                  TBR_           /* Timer B Counter Register */
569
#define TB0CCR0_               TBCCR0_        /* Timer B Capture/Compare 0 */
570
#define TB0CCR1_               TBCCR1_        /* Timer B Capture/Compare 1 */
571
#define TB0CCR2_               TBCCR2_        /* Timer B Capture/Compare 2 */
572
 
573
#define TBCLGRP1               (0x4000)       /* Timer B Compare latch load group 1 */
574
#define TBCLGRP0               (0x2000)       /* Timer B Compare latch load group 0 */
575
#define CNTL1                  (0x1000)       /* Counter lenght 1 */
576
#define CNTL0                  (0x0800)       /* Counter lenght 0 */
577
#define TBSSEL1                (0x0200)       /* Clock source 1 */
578
#define TBSSEL0                (0x0100)       /* Clock source 0 */
579
#define TBCLR                  (0x0004)       /* Timer B counter clear */
580
#define TBIE                   (0x0002)       /* Timer B interrupt enable */
581
#define TBIFG                  (0x0001)       /* Timer B interrupt flag */
582
 
583
#define SHR1                   (0x4000)       /* Timer B Compare latch load group 1 */
584
#define SHR0                   (0x2000)       /* Timer B Compare latch load group 0 */
585
 
586
#define TBSSEL_0               (0*0x0100u)    /* Clock Source: TBCLK */
587
#define TBSSEL_1               (1*0x0100u)    /* Clock Source: ACLK  */
588
#define TBSSEL_2               (2*0x0100u)    /* Clock Source: SMCLK */
589
#define TBSSEL_3               (3*0x0100u)    /* Clock Source: INCLK */
590
#define CNTL_0                 (0*0x0800u)    /* Counter lenght: 16 bit */
591
#define CNTL_1                 (1*0x0800u)    /* Counter lenght: 12 bit */
592
#define CNTL_2                 (2*0x0800u)    /* Counter lenght: 10 bit */
593
#define CNTL_3                 (3*0x0800u)    /* Counter lenght:  8 bit */
594
#define SHR_0                  (0*0x2000u)    /* Timer B Group: 0 - individually */
595
#define SHR_1                  (1*0x2000u)    /* Timer B Group: 1 - 3 groups (1-2, 3-4, 5-6) */
596
#define SHR_2                  (2*0x2000u)    /* Timer B Group: 2 - 2 groups (1-3, 4-6)*/
597
#define SHR_3                  (3*0x2000u)    /* Timer B Group: 3 - 1 group (all) */
598
#define TBCLGRP_0              (0*0x2000u)    /* Timer B Group: 0 - individually */
599
#define TBCLGRP_1              (1*0x2000u)    /* Timer B Group: 1 - 3 groups (1-2, 3-4, 5-6) */
600
#define TBCLGRP_2              (2*0x2000u)    /* Timer B Group: 2 - 2 groups (1-3, 4-6)*/
601
#define TBCLGRP_3              (3*0x2000u)    /* Timer B Group: 3 - 1 group (all) */
602
 
603
/* Additional Timer B Control Register bits are defined in Timer A */
604
 
605
#define CLLD1                  (0x0400)       /* Compare latch load source 1 */
606
#define CLLD0                  (0x0200)       /* Compare latch load source 0 */
607
 
608
#define SLSHR1                 (0x0400)       /* Compare latch load source 1 */
609
#define SLSHR0                 (0x0200)       /* Compare latch load source 0 */
610
 
611
#define SLSHR_0                (0*0x0200u)    /* Compare latch load sourec : 0 - immediate */
612
#define SLSHR_1                (1*0x0200u)    /* Compare latch load sourec : 1 - TBR counts to 0 */
613
#define SLSHR_2                (2*0x0200u)    /* Compare latch load sourec : 2 - up/down */
614
#define SLSHR_3                (3*0x0200u)    /* Compare latch load sourec : 3 - TBR counts to TBCTL0 */
615
 
616
#define CLLD_0                 (0*0x0200u)    /* Compare latch load sourec : 0 - immediate */
617
#define CLLD_1                 (1*0x0200u)    /* Compare latch load sourec : 1 - TBR counts to 0 */
618
#define CLLD_2                 (2*0x0200u)    /* Compare latch load sourec : 2 - up/down */
619
#define CLLD_3                 (3*0x0200u)    /* Compare latch load sourec : 3 - TBR counts to TBCTL0 */
620
 
621
/* TB3IV Definitions */
622
#define TBIV_NONE              (0x0000)       /* No Interrupt pending */
623
#define TBIV_TBCCR1            (0x0002)       /* TBCCR1_CCIFG */
624
#define TBIV_TBCCR2            (0x0004)       /* TBCCR2_CCIFG */
625
#define TBIV_3                 (0x0006)       /* Reserved */
626
#define TBIV_4                 (0x0008)       /* Reserved */
627
#define TBIV_5                 (0x000A)       /* Reserved */
628
#define TBIV_6                 (0x000C)       /* Reserved */
629
#define TBIV_TBIFG             (0x000E)       /* TBIFG */
630
 
631
/************************************************************
632
* USCI
633
************************************************************/
634
#define __MSP430_HAS_USCI__                   /* Definition to show that Module is available */
635
 
636
SFR_8BIT(UCA0CTL0);                           /* USCI A0 Control Register 0 */
637
SFR_8BIT(UCA0CTL1);                           /* USCI A0 Control Register 1 */
638
SFR_8BIT(UCA0BR0);                            /* USCI A0 Baud Rate 0 */
639
SFR_8BIT(UCA0BR1);                            /* USCI A0 Baud Rate 1 */
640
SFR_8BIT(UCA0MCTL);                           /* USCI A0 Modulation Control */
641
SFR_8BIT(UCA0STAT);                           /* USCI A0 Status Register */
642
SFR_8BIT(UCA0RXBUF);                          /* USCI A0 Receive Buffer */
643
SFR_8BIT(UCA0TXBUF);                          /* USCI A0 Transmit Buffer */
644
SFR_8BIT(UCA0ABCTL);                          /* USCI A0 LIN Control */
645
SFR_8BIT(UCA0IRTCTL);                         /* USCI A0 IrDA Transmit Control */
646
SFR_8BIT(UCA0IRRCTL);                         /* USCI A0 IrDA Receive Control */
647
 
648
 
649
 
650
SFR_8BIT(UCB0CTL0);                           /* USCI B0 Control Register 0 */
651
SFR_8BIT(UCB0CTL1);                           /* USCI B0 Control Register 1 */
652
SFR_8BIT(UCB0BR0);                            /* USCI B0 Baud Rate 0 */
653
SFR_8BIT(UCB0BR1);                            /* USCI B0 Baud Rate 1 */
654
SFR_8BIT(UCB0I2CIE);                          /* USCI B0 I2C Interrupt Enable Register */
655
SFR_8BIT(UCB0STAT);                           /* USCI B0 Status Register */
656
SFR_8BIT(UCB0RXBUF);                          /* USCI B0 Receive Buffer */
657
SFR_8BIT(UCB0TXBUF);                          /* USCI B0 Transmit Buffer */
658
SFR_16BIT(UCB0I2COA);                         /* USCI B0 I2C Own Address */
659
SFR_16BIT(UCB0I2CSA);                         /* USCI B0 I2C Slave Address */
660
 
661
// UART-Mode Bits
662
#define UCPEN                  (0x80)         /* Async. Mode: Parity enable */
663
#define UCPAR                  (0x40)         /* Async. Mode: Parity     0:odd / 1:even */
664
#define UCMSB                  (0x20)         /* Async. Mode: MSB first  0:LSB / 1:MSB */
665
#define UC7BIT                 (0x10)         /* Async. Mode: Data Bits  0:8-bits / 1:7-bits */
666
#define UCSPB                  (0x08)         /* Async. Mode: Stop Bits  0:one / 1: two */
667
#define UCMODE1                (0x04)         /* Async. Mode: USCI Mode 1 */
668
#define UCMODE0                (0x02)         /* Async. Mode: USCI Mode 0 */
669
#define UCSYNC                 (0x01)         /* Sync-Mode  0:UART-Mode / 1:SPI-Mode */
670
 
671
// SPI-Mode Bits
672
#define UCCKPH                 (0x80)         /* Sync. Mode: Clock Phase */
673
#define UCCKPL                 (0x40)         /* Sync. Mode: Clock Polarity */
674
#define UCMST                  (0x08)         /* Sync. Mode: Master Select */
675
 
676
// I2C-Mode Bits
677
#define UCA10                  (0x80)         /* 10-bit Address Mode */
678
#define UCSLA10                (0x40)         /* 10-bit Slave Address Mode */
679
#define UCMM                   (0x20)         /* Multi-Master Environment */
680
//#define res               (0x10)    /* reserved */
681
#define UCMODE_0               (0x00)         /* Sync. Mode: USCI Mode: 0 */
682
#define UCMODE_1               (0x02)         /* Sync. Mode: USCI Mode: 1 */
683
#define UCMODE_2               (0x04)         /* Sync. Mode: USCI Mode: 2 */
684
#define UCMODE_3               (0x06)         /* Sync. Mode: USCI Mode: 3 */
685
 
686
// UART-Mode Bits
687
#define UCSSEL1                (0x80)         /* USCI 0 Clock Source Select 1 */
688
#define UCSSEL0                (0x40)         /* USCI 0 Clock Source Select 0 */
689
#define UCRXEIE                (0x20)         /* RX Error interrupt enable */
690
#define UCBRKIE                (0x10)         /* Break interrupt enable */
691
#define UCDORM                 (0x08)         /* Dormant (Sleep) Mode */
692
#define UCTXADDR               (0x04)         /* Send next Data as Address */
693
#define UCTXBRK                (0x02)         /* Send next Data as Break */
694
#define UCSWRST                (0x01)         /* USCI Software Reset */
695
 
696
// SPI-Mode Bits
697
//#define res               (0x20)    /* reserved */
698
//#define res               (0x10)    /* reserved */
699
//#define res               (0x08)    /* reserved */
700
//#define res               (0x04)    /* reserved */
701
//#define res               (0x02)    /* reserved */
702
 
703
// I2C-Mode Bits
704
//#define res               (0x20)    /* reserved */
705
#define UCTR                   (0x10)         /* Transmit/Receive Select/Flag */
706
#define UCTXNACK               (0x08)         /* Transmit NACK */
707
#define UCTXSTP                (0x04)         /* Transmit STOP */
708
#define UCTXSTT                (0x02)         /* Transmit START */
709
#define UCSSEL_0               (0x00)         /* USCI 0 Clock Source: 0 */
710
#define UCSSEL_1               (0x40)         /* USCI 0 Clock Source: 1 */
711
#define UCSSEL_2               (0x80)         /* USCI 0 Clock Source: 2 */
712
#define UCSSEL_3               (0xC0)         /* USCI 0 Clock Source: 3 */
713
 
714
#define UCBRF3                 (0x80)         /* USCI First Stage Modulation Select 3 */
715
#define UCBRF2                 (0x40)         /* USCI First Stage Modulation Select 2 */
716
#define UCBRF1                 (0x20)         /* USCI First Stage Modulation Select 1 */
717
#define UCBRF0                 (0x10)         /* USCI First Stage Modulation Select 0 */
718
#define UCBRS2                 (0x08)         /* USCI Second Stage Modulation Select 2 */
719
#define UCBRS1                 (0x04)         /* USCI Second Stage Modulation Select 1 */
720
#define UCBRS0                 (0x02)         /* USCI Second Stage Modulation Select 0 */
721
#define UCOS16                 (0x01)         /* USCI 16-times Oversampling enable */
722
 
723
#define UCBRF_0                (0x00)         /* USCI First Stage Modulation: 0 */
724
#define UCBRF_1                (0x10)         /* USCI First Stage Modulation: 1 */
725
#define UCBRF_2                (0x20)         /* USCI First Stage Modulation: 2 */
726
#define UCBRF_3                (0x30)         /* USCI First Stage Modulation: 3 */
727
#define UCBRF_4                (0x40)         /* USCI First Stage Modulation: 4 */
728
#define UCBRF_5                (0x50)         /* USCI First Stage Modulation: 5 */
729
#define UCBRF_6                (0x60)         /* USCI First Stage Modulation: 6 */
730
#define UCBRF_7                (0x70)         /* USCI First Stage Modulation: 7 */
731
#define UCBRF_8                (0x80)         /* USCI First Stage Modulation: 8 */
732
#define UCBRF_9                (0x90)         /* USCI First Stage Modulation: 9 */
733
#define UCBRF_10               (0xA0)         /* USCI First Stage Modulation: A */
734
#define UCBRF_11               (0xB0)         /* USCI First Stage Modulation: B */
735
#define UCBRF_12               (0xC0)         /* USCI First Stage Modulation: C */
736
#define UCBRF_13               (0xD0)         /* USCI First Stage Modulation: D */
737
#define UCBRF_14               (0xE0)         /* USCI First Stage Modulation: E */
738
#define UCBRF_15               (0xF0)         /* USCI First Stage Modulation: F */
739
 
740
#define UCBRS_0                (0x00)         /* USCI Second Stage Modulation: 0 */
741
#define UCBRS_1                (0x02)         /* USCI Second Stage Modulation: 1 */
742
#define UCBRS_2                (0x04)         /* USCI Second Stage Modulation: 2 */
743
#define UCBRS_3                (0x06)         /* USCI Second Stage Modulation: 3 */
744
#define UCBRS_4                (0x08)         /* USCI Second Stage Modulation: 4 */
745
#define UCBRS_5                (0x0A)         /* USCI Second Stage Modulation: 5 */
746
#define UCBRS_6                (0x0C)         /* USCI Second Stage Modulation: 6 */
747
#define UCBRS_7                (0x0E)         /* USCI Second Stage Modulation: 7 */
748
 
749
#define UCLISTEN               (0x80)         /* USCI Listen mode */
750
#define UCFE                   (0x40)         /* USCI Frame Error Flag */
751
#define UCOE                   (0x20)         /* USCI Overrun Error Flag */
752
#define UCPE                   (0x10)         /* USCI Parity Error Flag */
753
#define UCBRK                  (0x08)         /* USCI Break received */
754
#define UCRXERR                (0x04)         /* USCI RX Error Flag */
755
#define UCADDR                 (0x02)         /* USCI Address received Flag */
756
#define UCBUSY                 (0x01)         /* USCI Busy Flag */
757
#define UCIDLE                 (0x02)         /* USCI Idle line detected Flag */
758
 
759
//#define res               (0x80)    /* reserved */
760
//#define res               (0x40)    /* reserved */
761
//#define res               (0x20)    /* reserved */
762
//#define res               (0x10)    /* reserved */
763
#define UCNACKIE               (0x08)         /* NACK Condition interrupt enable */
764
#define UCSTPIE                (0x04)         /* STOP Condition interrupt enable */
765
#define UCSTTIE                (0x02)         /* START Condition interrupt enable */
766
#define UCALIE                 (0x01)         /* Arbitration Lost interrupt enable */
767
 
768
#define UCSCLLOW               (0x40)         /* SCL low */
769
#define UCGC                   (0x20)         /* General Call address received Flag */
770
#define UCBBUSY                (0x10)         /* Bus Busy Flag */
771
#define UCNACKIFG              (0x08)         /* NAK Condition interrupt Flag */
772
#define UCSTPIFG               (0x04)         /* STOP Condition interrupt Flag */
773
#define UCSTTIFG               (0x02)         /* START Condition interrupt Flag */
774
#define UCALIFG                (0x01)         /* Arbitration Lost interrupt Flag */
775
 
776
#define UCIRTXPL5              (0x80)         /* IRDA Transmit Pulse Length 5 */
777
#define UCIRTXPL4              (0x40)         /* IRDA Transmit Pulse Length 4 */
778
#define UCIRTXPL3              (0x20)         /* IRDA Transmit Pulse Length 3 */
779
#define UCIRTXPL2              (0x10)         /* IRDA Transmit Pulse Length 2 */
780
#define UCIRTXPL1              (0x08)         /* IRDA Transmit Pulse Length 1 */
781
#define UCIRTXPL0              (0x04)         /* IRDA Transmit Pulse Length 0 */
782
#define UCIRTXCLK              (0x02)         /* IRDA Transmit Pulse Clock Select */
783
#define UCIREN                 (0x01)         /* IRDA Encoder/Decoder enable */
784
 
785
#define UCIRRXFL5              (0x80)         /* IRDA Receive Filter Length 5 */
786
#define UCIRRXFL4              (0x40)         /* IRDA Receive Filter Length 4 */
787
#define UCIRRXFL3              (0x20)         /* IRDA Receive Filter Length 3 */
788
#define UCIRRXFL2              (0x10)         /* IRDA Receive Filter Length 2 */
789
#define UCIRRXFL1              (0x08)         /* IRDA Receive Filter Length 1 */
790
#define UCIRRXFL0              (0x04)         /* IRDA Receive Filter Length 0 */
791
#define UCIRRXPL               (0x02)         /* IRDA Receive Input Polarity */
792
#define UCIRRXFE               (0x01)         /* IRDA Receive Filter enable */
793
 
794
//#define res               (0x80)    /* reserved */
795
//#define res               (0x40)    /* reserved */
796
#define UCDELIM1               (0x20)         /* Break Sync Delimiter 1 */
797
#define UCDELIM0               (0x10)         /* Break Sync Delimiter 0 */
798
#define UCSTOE                 (0x08)         /* Sync-Field Timeout error */
799
#define UCBTOE                 (0x04)         /* Break Timeout error */
800
//#define res               (0x02)    /* reserved */
801
#define UCABDEN                (0x01)         /* Auto Baud Rate detect enable */
802
 
803
#define UCGCEN                 (0x8000)       /* I2C General Call enable */
804
#define UCOA9                  (0x0200)       /* I2C Own Address 9 */
805
#define UCOA8                  (0x0100)       /* I2C Own Address 8 */
806
#define UCOA7                  (0x0080)       /* I2C Own Address 7 */
807
#define UCOA6                  (0x0040)       /* I2C Own Address 6 */
808
#define UCOA5                  (0x0020)       /* I2C Own Address 5 */
809
#define UCOA4                  (0x0010)       /* I2C Own Address 4 */
810
#define UCOA3                  (0x0008)       /* I2C Own Address 3 */
811
#define UCOA2                  (0x0004)       /* I2C Own Address 2 */
812
#define UCOA1                  (0x0002)       /* I2C Own Address 1 */
813
#define UCOA0                  (0x0001)       /* I2C Own Address 0 */
814
 
815
#define UCSA9                  (0x0200)       /* I2C Slave Address 9 */
816
#define UCSA8                  (0x0100)       /* I2C Slave Address 8 */
817
#define UCSA7                  (0x0080)       /* I2C Slave Address 7 */
818
#define UCSA6                  (0x0040)       /* I2C Slave Address 6 */
819
#define UCSA5                  (0x0020)       /* I2C Slave Address 5 */
820
#define UCSA4                  (0x0010)       /* I2C Slave Address 4 */
821
#define UCSA3                  (0x0008)       /* I2C Slave Address 3 */
822
#define UCSA2                  (0x0004)       /* I2C Slave Address 2 */
823
#define UCSA1                  (0x0002)       /* I2C Slave Address 1 */
824
#define UCSA0                  (0x0001)       /* I2C Slave Address 0 */
825
 
826
/************************************************************
827
* WATCHDOG TIMER
828
************************************************************/
829
#define __MSP430_HAS_WDT__                    /* Definition to show that Module is available */
830
 
831
SFR_16BIT(WDTCTL);                            /* Watchdog Timer Control */
832
/* The bit names have been prefixed with "WDT" */
833
#define WDTIS0                 (0x0001)
834
#define WDTIS1                 (0x0002)
835
#define WDTSSEL                (0x0004)
836
#define WDTCNTCL               (0x0008)
837
#define WDTTMSEL               (0x0010)
838
#define WDTNMI                 (0x0020)
839
#define WDTNMIES               (0x0040)
840
#define WDTHOLD                (0x0080)
841
 
842
#define WDTPW                  (0x5A00)
843
 
844
/* WDT-interval times [1ms] coded with Bits 0-2 */
845
/* WDT is clocked by fSMCLK (assumed 1MHz) */
846
#define WDT_MDLY_32         (WDTPW+WDTTMSEL+WDTCNTCL)                         /* 32ms interval (default) */
847
#define WDT_MDLY_8          (WDTPW+WDTTMSEL+WDTCNTCL+WDTIS0)                  /* 8ms     " */
848
#define WDT_MDLY_0_5        (WDTPW+WDTTMSEL+WDTCNTCL+WDTIS1)                  /* 0.5ms   " */
849
#define WDT_MDLY_0_064      (WDTPW+WDTTMSEL+WDTCNTCL+WDTIS1+WDTIS0)           /* 0.064ms " */
850
/* WDT is clocked by fACLK (assumed 32KHz) */
851
#define WDT_ADLY_1000       (WDTPW+WDTTMSEL+WDTCNTCL+WDTSSEL)                 /* 1000ms  " */
852
#define WDT_ADLY_250        (WDTPW+WDTTMSEL+WDTCNTCL+WDTSSEL+WDTIS0)          /* 250ms   " */
853
#define WDT_ADLY_16         (WDTPW+WDTTMSEL+WDTCNTCL+WDTSSEL+WDTIS1)          /* 16ms    " */
854
#define WDT_ADLY_1_9        (WDTPW+WDTTMSEL+WDTCNTCL+WDTSSEL+WDTIS1+WDTIS0)   /* 1.9ms   " */
855
/* Watchdog mode -> reset after expired time */
856
/* WDT is clocked by fSMCLK (assumed 1MHz) */
857
#define WDT_MRST_32         (WDTPW+WDTCNTCL)                                  /* 32ms interval (default) */
858
#define WDT_MRST_8          (WDTPW+WDTCNTCL+WDTIS0)                           /* 8ms     " */
859
#define WDT_MRST_0_5        (WDTPW+WDTCNTCL+WDTIS1)                           /* 0.5ms   " */
860
#define WDT_MRST_0_064      (WDTPW+WDTCNTCL+WDTIS1+WDTIS0)                    /* 0.064ms " */
861
/* WDT is clocked by fACLK (assumed 32KHz) */
862
#define WDT_ARST_1000       (WDTPW+WDTCNTCL+WDTSSEL)                          /* 1000ms  " */
863
#define WDT_ARST_250        (WDTPW+WDTCNTCL+WDTSSEL+WDTIS0)                   /* 250ms   " */
864
#define WDT_ARST_16         (WDTPW+WDTCNTCL+WDTSSEL+WDTIS1)                   /* 16ms    " */
865
#define WDT_ARST_1_9        (WDTPW+WDTCNTCL+WDTSSEL+WDTIS1+WDTIS0)            /* 1.9ms   " */
866
 
867
/* INTERRUPT CONTROL */
868
/* These two bits are defined in the Special Function Registers */
869
/* #define WDTIE               0x01 */
870
/* #define WDTIFG              0x01 */
871
 
872
/************************************************************
873
* Calibration Data in Info Mem
874
************************************************************/
875
 
876
#ifndef __DisableCalData
877
 
878
SFR_8BIT(CALDCO_16MHZ);                       /* DCOCTL  Calibration Data for 16MHz */
879
SFR_8BIT(CALBC1_16MHZ);                       /* BCSCTL1 Calibration Data for 16MHz */
880
SFR_8BIT(CALDCO_12MHZ);                       /* DCOCTL  Calibration Data for 12MHz */
881
SFR_8BIT(CALBC1_12MHZ);                       /* BCSCTL1 Calibration Data for 12MHz */
882
SFR_8BIT(CALDCO_8MHZ);                        /* DCOCTL  Calibration Data for 8MHz */
883
SFR_8BIT(CALBC1_8MHZ);                        /* BCSCTL1 Calibration Data for 8MHz */
884
SFR_8BIT(CALDCO_1MHZ);                        /* DCOCTL  Calibration Data for 1MHz */
885
SFR_8BIT(CALBC1_1MHZ);                        /* BCSCTL1 Calibration Data for 1MHz */
886
 
887
#endif /* #ifndef __DisableCalData */
888
 
889
/************************************************************
890
* Interrupt Vectors (offset from 0xFFE0)
891
************************************************************/
892
 
893
#define VECTOR_NAME(name)       name##_ptr
894
#define EMIT_PRAGMA(x)          _Pragma(#x)
895
#define CREATE_VECTOR(name)     void (* const VECTOR_NAME(name))(void) = &name
896
#define PLACE_VECTOR(vector,section) EMIT_PRAGMA(DATA_SECTION(vector,section))
897
#define ISR_VECTOR(func,offset) CREATE_VECTOR(func); \
898
                                PLACE_VECTOR(VECTOR_NAME(func), offset)
899
 
900
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
901
#define PORT1_VECTOR            ".int02"                    /* 0xFFE4 Port 1 */
902
#else
903
#define PORT1_VECTOR            (2 * 1u)                     /* 0xFFE4 Port 1 */
904
/*#define PORT1_ISR(func)         ISR_VECTOR(func, ".int02")  */ /* 0xFFE4 Port 1 */ /* CCE V2 Style */
905
#endif
906
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
907
#define PORT2_VECTOR            ".int03"                    /* 0xFFE6 Port 2 */
908
#else
909
#define PORT2_VECTOR            (3 * 1u)                     /* 0xFFE6 Port 2 */
910
/*#define PORT2_ISR(func)         ISR_VECTOR(func, ".int03")  */ /* 0xFFE6 Port 2 */ /* CCE V2 Style */
911
#endif
912
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
913
#define ADC10_VECTOR            ".int05"                    /* 0xFFEA ADC10 */
914
#else
915
#define ADC10_VECTOR            (5 * 1u)                     /* 0xFFEA ADC10 */
916
/*#define ADC10_ISR(func)         ISR_VECTOR(func, ".int05")  */ /* 0xFFEA ADC10 */ /* CCE V2 Style */
917
#endif
918
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
919
#define USCIAB0TX_VECTOR        ".int06"                    /* 0xFFEC USCI A0/B0 Transmit */
920
#else
921
#define USCIAB0TX_VECTOR        (6 * 1u)                     /* 0xFFEC USCI A0/B0 Transmit */
922
/*#define USCIAB0TX_ISR(func)     ISR_VECTOR(func, ".int06")  */ /* 0xFFEC USCI A0/B0 Transmit */ /* CCE V2 Style */
923
#endif
924
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
925
#define USCIAB0RX_VECTOR        ".int07"                    /* 0xFFEE USCI A0/B0 Receive */
926
#else
927
#define USCIAB0RX_VECTOR        (7 * 1u)                     /* 0xFFEE USCI A0/B0 Receive */
928
/*#define USCIAB0RX_ISR(func)     ISR_VECTOR(func, ".int07")  */ /* 0xFFEE USCI A0/B0 Receive */ /* CCE V2 Style */
929
#endif
930
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
931
#define TIMERA1_VECTOR          ".int08"                    /* 0xFFF0 Timer A CC1-2, TA */
932
#else
933
#define TIMERA1_VECTOR          (8 * 1u)                     /* 0xFFF0 Timer A CC1-2, TA */
934
/*#define TIMERA1_ISR(func)       ISR_VECTOR(func, ".int08")  */ /* 0xFFF0 Timer A CC1-2, TA */ /* CCE V2 Style */
935
#endif
936
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
937
#define TIMERA0_VECTOR          ".int09"                    /* 0xFFF2 Timer A CC0 */
938
#else
939
#define TIMERA0_VECTOR          (9 * 1u)                     /* 0xFFF2 Timer A CC0 */
940
/*#define TIMERA0_ISR(func)       ISR_VECTOR(func, ".int09")  */ /* 0xFFF2 Timer A CC0 */ /* CCE V2 Style */
941
#endif
942
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
943
#define WDT_VECTOR              ".int10"                    /* 0xFFF4 Watchdog Timer */
944
#else
945
#define WDT_VECTOR              (10 * 1u)                    /* 0xFFF4 Watchdog Timer */
946
/*#define WDT_ISR(func)           ISR_VECTOR(func, ".int10")  */ /* 0xFFF4 Watchdog Timer */ /* CCE V2 Style */
947
#endif
948
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
949
#define TIMERB1_VECTOR          ".int12"                    /* 0xFFF8 Timer B CC1-2, TB */
950
#else
951
#define TIMERB1_VECTOR          (12 * 1u)                    /* 0xFFF8 Timer B CC1-2, TB */
952
/*#define TIMERB1_ISR(func)       ISR_VECTOR(func, ".int12")  */ /* 0xFFF8 Timer B CC1-2, TB */ /* CCE V2 Style */
953
#endif
954
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
955
#define TIMERB0_VECTOR          ".int13"                    /* 0xFFFA Timer B CC0 */
956
#else
957
#define TIMERB0_VECTOR          (13 * 1u)                    /* 0xFFFA Timer B CC0 */
958
/*#define TIMERB0_ISR(func)       ISR_VECTOR(func, ".int13")  */ /* 0xFFFA Timer B CC0 */ /* CCE V2 Style */
959
#endif
960
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
961
#define NMI_VECTOR              ".int14"                    /* 0xFFFC Non-maskable */
962
#else
963
#define NMI_VECTOR              (14 * 1u)                    /* 0xFFFC Non-maskable */
964
/*#define NMI_ISR(func)           ISR_VECTOR(func, ".int14")  */ /* 0xFFFC Non-maskable */ /* CCE V2 Style */
965
#endif
966
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
967
#define RESET_VECTOR            ".reset"                    /* 0xFFFE Reset [Highest Priority] */
968
#else
969
#define RESET_VECTOR            (15 * 1u)                    /* 0xFFFE Reset [Highest Priority] */
970
/*#define RESET_ISR(func)         ISR_VECTOR(func, ".int15")  */ /* 0xFFFE Reset [Highest Priority] */ /* CCE V2 Style */
971
#endif
972
 
973
/************************************************************
974
* End of Modules
975
************************************************************/
976
 
977
#ifdef __cplusplus
978
}
979
#endif /* extern "C" */
980
 
981
#endif /* #ifndef __msp430x22x2 */