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