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
* MSP430x31x devices.
14
*
15
* Texas Instruments, Version 2.2
16
*
17
* Rev. 1.1, Changed definition of LPM4 bits (device effect not changed)
18
*           Corrected LPMx_EXIT to reference new intrinsic    _bic_SR_register_on_exit
19
*           The file contents were reordered
20
* Rev. 1.2, Enclose all #define statements with parentheses
21
* Rev. 1.3, Added sfrb for TCDAT and TCPLD
22
* Rev. 1.4, Removed incorrect label 'BTRESET'
23
* Rev. 2.1, Alignment of defintions in Users Guide and of version numbers
24
* Rev. 2.2, Removed definitions for BTRESET
25
*
26
********************************************************************/
27
 
28
#ifndef __msp430x31x
29
#define __msp430x31x
30
 
31
#ifdef __cplusplus
32
extern "C" {
33
#endif
34
 
35
 
36
/*----------------------------------------------------------------------------*/
37
/* PERIPHERAL FILE MAP                                                        */
38
/*----------------------------------------------------------------------------*/
39
 
40
/* External references resolved by a device-specific linker command file */
41
#define SFR_8BIT(address)   extern volatile unsigned char address
42
#define SFR_16BIT(address)  extern volatile unsigned int address
43
 
44
 
45
/************************************************************
46
* STANDARD BITS
47
************************************************************/
48
 
49
#define BIT0                   (0x0001)
50
#define BIT1                   (0x0002)
51
#define BIT2                   (0x0004)
52
#define BIT3                   (0x0008)
53
#define BIT4                   (0x0010)
54
#define BIT5                   (0x0020)
55
#define BIT6                   (0x0040)
56
#define BIT7                   (0x0080)
57
#define BIT8                   (0x0100)
58
#define BIT9                   (0x0200)
59
#define BITA                   (0x0400)
60
#define BITB                   (0x0800)
61
#define BITC                   (0x1000)
62
#define BITD                   (0x2000)
63
#define BITE                   (0x4000)
64
#define BITF                   (0x8000)
65
 
66
/************************************************************
67
* STATUS REGISTER BITS
68
************************************************************/
69
 
70
#define C                      (0x0001)
71
#define Z                      (0x0002)
72
#define N                      (0x0004)
73
#define V                      (0x0100)
74
#define GIE                    (0x0008)
75
#define CPUOFF                 (0x0010)
76
#define OSCOFF                 (0x0020)
77
#define SCG0                   (0x0040)
78
#define SCG1                   (0x0080)
79
 
80
/* Low Power Modes coded with Bits 4-7 in SR */
81
 
82
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
83
#define LPM0                   (CPUOFF)
84
#define LPM1                   (SCG0+CPUOFF)
85
#define LPM2                   (SCG1+CPUOFF)
86
#define LPM3                   (SCG1+SCG0+CPUOFF)
87
#define LPM4                   (SCG1+SCG0+OSCOFF+CPUOFF)
88
/* End #defines for assembler */
89
 
90
#else /* Begin #defines for C */
91
#define LPM0_bits              (CPUOFF)
92
#define LPM1_bits              (SCG0+CPUOFF)
93
#define LPM2_bits              (SCG1+CPUOFF)
94
#define LPM3_bits              (SCG1+SCG0+CPUOFF)
95
#define LPM4_bits              (SCG1+SCG0+OSCOFF+CPUOFF)
96
 
97
#include "in430.h"
98
 
99
#define LPM0         _bis_SR_register(LPM0_bits)         /* Enter Low Power Mode 0 */
100
#define LPM0_EXIT    _bic_SR_register_on_exit(LPM0_bits) /* Exit Low Power Mode 0 */
101
#define LPM1         _bis_SR_register(LPM1_bits)         /* Enter Low Power Mode 1 */
102
#define LPM1_EXIT    _bic_SR_register_on_exit(LPM1_bits) /* Exit Low Power Mode 1 */
103
#define LPM2         _bis_SR_register(LPM2_bits)         /* Enter Low Power Mode 2 */
104
#define LPM2_EXIT    _bic_SR_register_on_exit(LPM2_bits) /* Exit Low Power Mode 2 */
105
#define LPM3         _bis_SR_register(LPM3_bits)         /* Enter Low Power Mode 3 */
106
#define LPM3_EXIT    _bic_SR_register_on_exit(LPM3_bits) /* Exit Low Power Mode 3 */
107
#define LPM4         _bis_SR_register(LPM4_bits)         /* Enter Low Power Mode 4 */
108
#define LPM4_EXIT    _bic_SR_register_on_exit(LPM4_bits) /* Exit Low Power Mode 4 */
109
#endif /* End #defines for C */
110
 
111
/************************************************************
112
* PERIPHERAL FILE MAP
113
************************************************************/
114
 
115
/************************************************************
116
* SPECIAL FUNCTION REGISTER ADDRESSES + CONTROL BITS
117
************************************************************/
118
 
119
SFR_8BIT(IE1);                                /* Interrupt Enable 1 */
120
#define WDTIE                  (0x01)
121
#define OFIE                   (0x02)
122
#define P0IE_0                 (0x04)
123
#define P0IE_1                 (0x08)
124
 
125
SFR_8BIT(IFG1);                               /* Interrupt Flag 1 */
126
#define WDTIFG                 (0x01)
127
#define OFIFG                  (0x02)
128
#define P0IFG_0                (0x04)
129
#define P0IFG_1                (0x08)
130
#define NMIIFG                 (0x10)
131
 
132
SFR_8BIT(IE2);                                /* Interrupt Enable 2 */
133
#define TPIE                   (0x04)
134
#define BTIE                   (0x80)
135
 
136
SFR_8BIT(IFG2);                               /* Interrupt Flag 2 */
137
#define BTIFG                  (0x80)
138
 
139
/************************************************************
140
* WATCHDOG TIMER
141
************************************************************/
142
#define __MSP430_HAS_WDT__                    /* Definition to show that Module is available */
143
 
144
SFR_16BIT(WDTCTL);                            /* Watchdog Timer Control */
145
/* The bit names have been prefixed with "WDT" */
146
#define WDTIS0                 (0x0001)
147
#define WDTIS1                 (0x0002)
148
#define WDTSSEL                (0x0004)
149
#define WDTCNTCL               (0x0008)
150
#define WDTTMSEL               (0x0010)
151
#define WDTNMI                 (0x0020)
152
#define WDTNMIES               (0x0040)
153
#define WDTHOLD                (0x0080)
154
 
155
#define WDTPW                  (0x5A00)
156
 
157
/* WDT-interval times [1ms] coded with Bits 0-2 */
158
/* WDT is clocked by fSMCLK (assumed 1MHz) */
159
#define WDT_MDLY_32         (WDTPW+WDTTMSEL+WDTCNTCL)                         /* 32ms interval (default) */
160
#define WDT_MDLY_8          (WDTPW+WDTTMSEL+WDTCNTCL+WDTIS0)                  /* 8ms     " */
161
#define WDT_MDLY_0_5        (WDTPW+WDTTMSEL+WDTCNTCL+WDTIS1)                  /* 0.5ms   " */
162
#define WDT_MDLY_0_064      (WDTPW+WDTTMSEL+WDTCNTCL+WDTIS1+WDTIS0)           /* 0.064ms " */
163
/* WDT is clocked by fACLK (assumed 32KHz) */
164
#define WDT_ADLY_1000       (WDTPW+WDTTMSEL+WDTCNTCL+WDTSSEL)                 /* 1000ms  " */
165
#define WDT_ADLY_250        (WDTPW+WDTTMSEL+WDTCNTCL+WDTSSEL+WDTIS0)          /* 250ms   " */
166
#define WDT_ADLY_16         (WDTPW+WDTTMSEL+WDTCNTCL+WDTSSEL+WDTIS1)          /* 16ms    " */
167
#define WDT_ADLY_1_9        (WDTPW+WDTTMSEL+WDTCNTCL+WDTSSEL+WDTIS1+WDTIS0)   /* 1.9ms   " */
168
/* Watchdog mode -> reset after expired time */
169
/* WDT is clocked by fSMCLK (assumed 1MHz) */
170
#define WDT_MRST_32         (WDTPW+WDTCNTCL)                                  /* 32ms interval (default) */
171
#define WDT_MRST_8          (WDTPW+WDTCNTCL+WDTIS0)                           /* 8ms     " */
172
#define WDT_MRST_0_5        (WDTPW+WDTCNTCL+WDTIS1)                           /* 0.5ms   " */
173
#define WDT_MRST_0_064      (WDTPW+WDTCNTCL+WDTIS1+WDTIS0)                    /* 0.064ms " */
174
/* WDT is clocked by fACLK (assumed 32KHz) */
175
#define WDT_ARST_1000       (WDTPW+WDTCNTCL+WDTSSEL)                          /* 1000ms  " */
176
#define WDT_ARST_250        (WDTPW+WDTCNTCL+WDTSSEL+WDTIS0)                   /* 250ms   " */
177
#define WDT_ARST_16         (WDTPW+WDTCNTCL+WDTSSEL+WDTIS1)                   /* 16ms    " */
178
#define WDT_ARST_1_9        (WDTPW+WDTCNTCL+WDTSSEL+WDTIS1+WDTIS0)            /* 1.9ms   " */
179
 
180
/* INTERRUPT CONTROL */
181
/* These two bits are defined in the Special Function Registers */
182
/* #define WDTIE               0x01 */
183
/* #define WDTIFG              0x01 */
184
 
185
/************************************************************
186
* DIGITAL I/O PORT0
187
************************************************************/
188
#define __MSP430_HAS_PORT0__                  /* Definition to show that Module is available */
189
 
190
SFR_8BIT(P0IN);                               /* Port 0 Input */
191
#define P0IN_0                 (0x01)
192
#define P0IN_1                 (0x02)
193
#define P0IN_2                 (0x04)
194
#define P0IN_3                 (0x08)
195
#define P0IN_4                 (0x10)
196
#define P0IN_5                 (0x20)
197
#define P0IN_6                 (0x40)
198
#define P0IN_7                 (0x80)
199
 
200
SFR_8BIT(P0OUT);                              /* Port 0 Output */
201
#define P0OUT_0                (0x01)
202
#define P0OUT_1                (0x02)
203
#define P0OUT_2                (0x04)
204
#define P0OUT_3                (0x08)
205
#define P0OUT_4                (0x10)
206
#define P0OUT_5                (0x20)
207
#define P0OUT_6                (0x40)
208
#define P0OUT_7                (0x80)
209
 
210
SFR_8BIT(P0DIR);                              /* Port 0 Direction */
211
#define P0DIR_0                (0x01)
212
#define P0DIR_1                (0x02)
213
#define P0DIR_2                (0x04)
214
#define P0DIR_3                (0x08)
215
#define P0DIR_4                (0x10)
216
#define P0DIR_5                (0x20)
217
#define P0DIR_6                (0x40)
218
#define P0DIR_7                (0x80)
219
 
220
SFR_8BIT(P0IFG);                              /* Port 0 Interrupt Flag */
221
/* These two bits are defined in Interrupt Flag 1 */
222
/* #define P0IFG_0             0x01 */
223
/* #define P0IFG_1             0x02 */
224
#define P0IFG_2                (0x04)
225
#define P0IFG_3                (0x08)
226
#define P0IFG_4                (0x10)
227
#define P0IFG_5                (0x20)
228
#define P0IFG_6                (0x40)
229
#define P0IFG_7                (0x80)
230
 
231
SFR_8BIT(P0IES);                              /* Port 0 Interrupt Edge Select */
232
#define P0IES_0                (0x01)
233
#define P0IES_1                (0x02)
234
#define P0IES_2                (0x04)
235
#define P0IES_3                (0x08)
236
#define P0IES_4                (0x10)
237
#define P0IES_5                (0x20)
238
#define P0IES_6                (0x40)
239
#define P0IES_7                (0x80)
240
 
241
SFR_8BIT(P0IE);                               /* Port 0 Interrupt Enable */
242
/* These two bits are defined in Interrupt Enable 1 */
243
/* #define P0IE_0              0x01 */
244
/* #define P0IE_1              0x02 */
245
#define P0IE_2                 (0x04)
246
#define P0IE_3                 (0x08)
247
#define P0IE_4                 (0x10)
248
#define P0IE_5                 (0x20)
249
#define P0IE_6                 (0x40)
250
#define P0IE_7                 (0x80)
251
 
252
/************************************************************
253
* LCD REGISTER
254
************************************************************/
255
#define __MSP430_HAS_LCD__                    /* Definition to show that Module is available */
256
 
257
SFR_8BIT(LCDCTL);                             /* LCD Control */
258
/* the names of the mode bits are different from the spec */
259
#define LCDON                  (0x01)
260
#define LCDLOWR                (0x02)
261
#define LCDSON                 (0x04)
262
#define LCDMX0                 (0x08)
263
#define LCDMX1                 (0x10)
264
#define LCDP0                  (0x20)
265
#define LCDP1                  (0x40)
266
#define LCDP2                  (0x80)
267
/* Display modes coded with Bits 2-4 */
268
#define LCDSTATIC              (LCDSON)
269
#define LCD2MUX                (LCDMX0+LCDSON)
270
#define LCD3MUX                (LCDMX1+LCDSON)
271
#define LCD4MUX                (LCDMX1+LCDMX0+LCDSON)
272
/* Group select code with Bits 5-7                     Seg.lines   Dig.output */
273
#define LCDSG0                 (0x00)         /* S0  - S1    O2  - O29 (default) */
274
#define LCDSG0_1               (LCDP0)        /* S0  - S5    O6  - O29 */
275
#define LCDSG0_2               (LCDP1)        /* S0  - S9    O10 - O29 */
276
#define LCDSG0_3               (LCDP1+LCDP0)  /* S0  - S13   O14 - O29 */
277
#define LCDSG0_4               (LCDP2)        /* S0  - S17   O18 - O29 */
278
#define LCDSG0_5               (LCDP2+LCDP0)  /* S0  - S21   O22 - O29 */
279
#define LCDSG0_6               (LCDP2+LCDP1)  /* S0  - S25   O26 - O29 */
280
#define LCDSG0_7            (LCDP2+LCDP1+LCDP0)       /* S0  - S29   --------- */
281
/* NOTE: YOU CAN ONLY USE THE 'S' OR 'G' DECLARATIONS FOR A COMMAND */
282
/* MOV  #LCDSG0_3+LCDOG2_7,&LCDCTL ACTUALY MEANS MOV  #LCDP1,&LCDCTL! */
283
#define LCDOG1_7               (0x00)         /* S0  - S1    O2  - O29 (default) */
284
#define LCDOG2_7               (LCDP0)        /* S0  - S5    O6  - O29 */
285
#define LCDOG3_7               (LCDP1)        /* S0  - S9    O10 - O29 */
286
#define LCDOG4_7               (LCDP1+LCDP0)  /* S0  - S13   O14 - O29 */
287
#define LCDOG5_7               (LCDP2)        /* S0  - S17   O18 - O29 */
288
#define LCDOG6_7               (LCDP2+LCDP0)  /* S0  - S21   O22 - O29 */
289
#define LCDOG7                 (LCDP2+LCDP1)  /* S0  - S25   O26 - O29 */
290
#define LCDOGOFF            (LCDP2+LCDP1+LCDP0)       /* S0  - S29   --------- */
291
 
292
#define LCDMEM_                (0x0031)       /* LCD Memory */
293
#ifdef __ASM_HEADER__
294
#define LCDMEM                 (LCDMEM_)      /* LCD Memory (for assembler) */
295
#else
296
#define LCDMEM                 ((char*)       LCDMEM_) /* LCD Memory (for C) */
297
#endif
298
SFR_8BIT(LCDM1);                              /* LCD Memory 1 */
299
SFR_8BIT(LCDM2);                              /* LCD Memory 2 */
300
SFR_8BIT(LCDM3);                              /* LCD Memory 3 */
301
SFR_8BIT(LCDM4);                              /* LCD Memory 4 */
302
SFR_8BIT(LCDM5);                              /* LCD Memory 5 */
303
SFR_8BIT(LCDM6);                              /* LCD Memory 6 */
304
SFR_8BIT(LCDM7);                              /* LCD Memory 7 */
305
SFR_8BIT(LCDM8);                              /* LCD Memory 8 */
306
SFR_8BIT(LCDM9);                              /* LCD Memory 9 */
307
SFR_8BIT(LCDM10);                             /* LCD Memory 10 */
308
SFR_8BIT(LCDM11);                             /* LCD Memory 11 */
309
SFR_8BIT(LCDM12);                             /* LCD Memory 12 */
310
SFR_8BIT(LCDM13);                             /* LCD Memory 13 */
311
SFR_8BIT(LCDM14);                             /* LCD Memory 14 */
312
SFR_8BIT(LCDM15);                             /* LCD Memory 15 */
313
 
314
#define LCDMA                  (LCDM10)       /* LCD Memory A */
315
#define LCDMB                  (LCDM11)       /* LCD Memory B */
316
#define LCDMC                  (LCDM12)       /* LCD Memory C */
317
#define LCDMD                  (LCDM13)       /* LCD Memory D */
318
#define LCDME                  (LCDM14)       /* LCD Memory E */
319
#define LCDMF                  (LCDM15)       /* LCD Memory F */
320
 
321
/************************************************************
322
* BASIC TIMER
323
************************************************************/
324
#define __MSP430_HAS_BT__                     /* Definition to show that Module is available */
325
 
326
SFR_8BIT(BTCTL);                              /* Basic Timer Control */
327
/* The bit names have been prefixed with "BT" */
328
#define BTIP0                  (0x01)
329
#define BTIP1                  (0x02)
330
#define BTIP2                  (0x04)
331
#define BTFRFQ0                (0x08)
332
#define BTFRFQ1                (0x10)
333
#define BTDIV                  (0x20)         /* fCLK2 = ACLK:256 */
334
#define BTHOLD                 (0x40)         /* BT1 is held if this bit is set */
335
#define BTSSEL                 (0x80)         /* fBT = fMCLK (main clock) */
336
 
337
SFR_8BIT(BTCNT1);                             /* Basic Timer Count 1 */
338
SFR_8BIT(BTCNT2);                             /* Basic Timer Count 2 */
339
 
340
/* Frequency of the BTCNT2 coded with Bit 5 and 7 in BTCTL */
341
#define BT_fCLK2_ACLK          (0x00)
342
#define BT_fCLK2_ACLK_DIV256   (BTDIV)
343
#define BT_fCLK2_MCLK          (BTSSEL)
344
 
345
/* Interrupt interval time fINT coded with Bits 0-2 in BTCTL */
346
#define BT_fCLK2_DIV2          (0x00)         /* fINT = fCLK2:2 (default) */
347
#define BT_fCLK2_DIV4          (BTIP0)        /* fINT = fCLK2:4 */
348
#define BT_fCLK2_DIV8          (BTIP1)        /* fINT = fCLK2:8 */
349
#define BT_fCLK2_DIV16         (BTIP1+BTIP0)  /* fINT = fCLK2:16 */
350
#define BT_fCLK2_DIV32         (BTIP2)        /* fINT = fCLK2:32 */
351
#define BT_fCLK2_DIV64         (BTIP2+BTIP0)  /* fINT = fCLK2:64 */
352
#define BT_fCLK2_DIV128        (BTIP2+BTIP1)  /* fINT = fCLK2:128 */
353
#define BT_fCLK2_DIV256     (BTIP2+BTIP1+BTIP0)       /* fINT = fCLK2:256 */
354
/* Frequency of LCD coded with Bits 3-4 */
355
#define BT_fLCD_DIV32          (0x00)         /* fLCD = fACLK:32 (default) */
356
#define BT_fLCD_DIV64          (BTFRFQ0)      /* fLCD = fACLK:64 */
357
#define BT_fLCD_DIV128         (BTFRFQ1)      /* fLCD = fACLK:128 */
358
#define BT_fLCD_DIV256      (BTFRFQ1+BTFRFQ0)         /* fLCD = fACLK:256 */
359
/* LCD frequency values with fBT=fACLK */
360
#define BT_fLCD_1K             (0x00)         /* fACLK:32 (default) */
361
#define BT_fLCD_512            (BTFRFQ0)      /* fACLK:64 */
362
#define BT_fLCD_256            (BTFRFQ1)      /* fACLK:128 */
363
#define BT_fLCD_128         (BTFRFQ1+BTFRFQ0)         /* fACLK:256 */
364
/* LCD frequency values with fBT=fMCLK */
365
#define BT_fLCD_31K            (BTSSEL)       /* fMCLK:32 */
366
#define BT_fLCD_15_5K       (BTSSEL+BTFRFQ0)          /* fMCLK:64 */
367
#define BT_fLCD_7_8K        (BTSSEL+BTFRFQ1+BTFRFQ0)  /* fMCLK:256 */
368
/* with assumed vlues of fACLK=32KHz, fMCLK=1MHz */
369
/* fBT=fACLK is thought for longer interval times */
370
#define BT_ADLY_0_064          (0x00)         /* 0.064ms interval (default) */
371
#define BT_ADLY_0_125          (BTIP0)        /* 0.125ms    " */
372
#define BT_ADLY_0_25           (BTIP1)        /* 0.25ms     " */
373
#define BT_ADLY_0_5            (BTIP1+BTIP0)  /* 0.5ms      " */
374
#define BT_ADLY_1              (BTIP2)        /* 1ms        " */
375
#define BT_ADLY_2              (BTIP2+BTIP0)  /* 2ms        " */
376
#define BT_ADLY_4              (BTIP2+BTIP1)  /* 4ms        " */
377
#define BT_ADLY_8           (BTIP2+BTIP1+BTIP0)       /* 8ms        " */
378
#define BT_ADLY_16             (BTDIV)        /* 16ms       " */
379
#define BT_ADLY_32             (BTDIV+BTIP0)  /* 32ms       " */
380
#define BT_ADLY_64             (BTDIV+BTIP1)  /* 64ms       " */
381
#define BT_ADLY_125         (BTDIV+BTIP1+BTIP0)       /* 125ms      " */
382
#define BT_ADLY_250            (BTDIV+BTIP2)  /* 250ms      " */
383
#define BT_ADLY_500         (BTDIV+BTIP2+BTIP0)       /* 500ms      " */
384
#define BT_ADLY_1000        (BTDIV+BTIP2+BTIP1)       /* 1000ms     " */
385
#define BT_ADLY_2000        (BTDIV+BTIP2+BTIP1+BTIP0) /* 2000ms     " */
386
/* fCLK2=fMCLK (1MHz) is thought for short interval times */
387
/* the timing for short intervals is more precise than ACLK */
388
/* NOTE */
389
/* Be sure that the SCFQCTL-Register is set to 01Fh so that fMCLK=1MHz */
390
/* Too low interval time results in interrupts too frequent for the processor to handle! */
391
#define BT_MDLY_0_002          (BTSSEL)       /* 0.002ms interval       *** interval times */
392
#define BT_MDLY_0_004          (BTSSEL+BTIP0) /* 0.004ms    "           *** too short for */
393
#define BT_MDLY_0_008          (BTSSEL+BTIP1) /* 0.008ms    "           *** interrupt */
394
#define BT_MDLY_0_016       (BTSSEL+BTIP1+BTIP0)      /* 0.016ms    "           *** handling */
395
#define BT_MDLY_0_032          (BTSSEL+BTIP2) /* 0.032ms    " */
396
#define BT_MDLY_0_064       (BTSSEL+BTIP2+BTIP0)      /* 0.064ms    " */
397
#define BT_MDLY_0_125       (BTSSEL+BTIP2+BTIP1)      /* 0.125ms    " */
398
#define BT_MDLY_0_25        (BTSSEL+BTIP2+BTIP1+BTIP0)/* 0.25ms     " */
399
 
400
/* Reset/Hold coded with Bits 6-7 in BT(1)CTL */
401
/* this is for BT */
402
//#define BTRESET_CNT1        (BTRESET)           /* BTCNT1 is reset while BTRESET is set */
403
//#define BTRESET_CNT1_2      (BTRESET+BTDIV)     /* BTCNT1 .AND. BTCNT2 are reset while ~ is set */
404
/* this is for BT1 */
405
#define BTHOLD_CNT1            (BTHOLD)       /* BTCNT1 is held while BTHOLD is set */
406
#define BTHOLD_CNT1_2          (BTHOLD+BTDIV) /* BT1CNT1 .AND. BT1CNT2 are held while ~ is set */
407
 
408
/* INTERRUPT CONTROL BITS */
409
/* #define BTIE                0x80 */
410
/* #define BTIFG               0x80 */
411
 
412
/************************************************************
413
* SYSTEM CLOCK GENERATOR
414
************************************************************/
415
#define __MSP430_HAS_FLL__                    /* Definition to show that Module is available */
416
 
417
SFR_8BIT(SCFI0);                              /* System Clock Frequency Integrator 0 */
418
#define FN_2                   (0x04)
419
#define FN_3                   (0x08)
420
#define FN_4                   (0x10)
421
 
422
SFR_8BIT(SCFI1);                              /* System Clock Frequency Integrator 1 */
423
SFR_8BIT(SCFQCTL);                            /* System Clock Frequency Control */
424
/* System clock frequency values fMCLK coded with Bits 0-6 in SCFQCTL */
425
/* #define SCFQ_32K            0x00                        fMCLK=1*fACLK          only a range from */
426
/* #define SCFQ_64K            0x01                        fMCLK=2*fACLK          3+1 to 127+1 is possible */
427
#define SCFQ_128K              (0x03)         /* fMCLK=4*fACLK */
428
#define SCFQ_256K              (0x07)         /* fMCLK=8*fACLK */
429
#define SCFQ_512K              (0x0F)         /* fMCLK=16*fACLK */
430
#define SCFQ_1M                (0x1F)         /* fMCLK=32*fACLK */
431
#define SCFQ_2M                (0x3F)         /* fMCLK=64*fACLK */
432
#define SCFQ_4M                (0x7F)         /* fMCLK=128*fACLK        not possible for ICE */
433
 
434
SFR_8BIT(CBCTL);                              /* Crystal Buffer Control *** WRITE-ONLY *** */
435
#define CBE                    (0x01)
436
#define CBSEL0                 (0x02)
437
#define CBSEL1                 (0x04)
438
/* Source select of frequency at output pin XBUF coded with Bits 1-2 in CBCTL */
439
#define CBSEL_ACLK             (0x00)         /* source is ACLK         (default after POR) */
440
#define CBSEL_ACLK_DIV2        (CBSEL0)       /* source is ACLK/2 */
441
#define CBSEL_ACLK_DIV4        (CBSEL1)       /* source is ACLK/4 */
442
#define CBSEL_MCLK          (CBSEL1+CBSEL0)           /* source is MCLK */
443
 
444
/* INTERRUPT CONTROL BITS */
445
/* These two bits are defined in the Special Function Registers */
446
/* #define OFIFG               0x02 */
447
/* #define OFIE                0x02 */
448
 
449
/************************************************************
450
* 8BIT TIMER/COUNTER
451
************************************************************/
452
#define __MSP430_HAS_8BTC__                   /* Definition to show that Module is available */
453
 
454
SFR_8BIT(TCCTL);                              /* Timer/Counter Control */
455
/* The bit names have been prefixed with "TC" */
456
#define TCRXD                  (0x01)
457
#define TCTXD                  (0x02)
458
#define TCRXACT                (0x04)
459
#define TCENCNT                (0x08)
460
#define TCTXE                  (0x10)
461
#define TCISCTL                (0x20)
462
#define TCSSEL0                (0x40)
463
#define TCSSEL1                (0x80)
464
/* Source select of clock input coded with Bits 6-7 */
465
#define TCSSEL_P01             (0x00)         /* source is signal at pin P0.1 (default) */
466
#define TCSSEL_ACLK            (TCSSEL0)      /* source is ACLK */
467
#define TCSSEL_MCLK            (TCSSEL1)      /* source is MCLK */
468
#define TCSSEL_P01_MCLK     (TCSSEL1+TCSSEL0)         /* source is signal pin P0.1 .AND. MCLK */
469
 
470
SFR_8BIT(TCPLD);                              /* Timer/Counter Preload */
471
SFR_8BIT(TCDAT);                              /* Timer/Counter Data */
472
 
473
/************************************************************
474
* TIMER/PORT
475
************************************************************/
476
#define __MSP430_HAS_TP__                     /* Definition to show that Module is available */
477
 
478
SFR_8BIT(TPCTL);                              /* Timer/Port Control */
479
#define EN1FG                  (0x01)
480
#define RC1FG                  (0x02)
481
#define RC2FG                  (0x04)
482
#define EN1                    (0x08)
483
#define ENA                    (0x10)
484
#define ENB                    (0x20)
485
#define TPSSEL0                (0x40)
486
#define TPSSEL1                (0x80)
487
/* The EN1 signal of TPCNT1 is coded with with Bits 3-5 in TPCTL */
488
#define TPCNT1_EN_OFF          (0x00)         /* TPCNT1 is disabled */
489
#define TPCNT1_EN_ON           (ENA)          /*   "    is enabled */
490
#define TPCNT1_EN_nTPIN5       (ENB)          /*   "    is enabled with ~TPIN.5 */
491
#define TPCNT1_EN_TPIN5        (TPSSEL0+ENB)  /*   "    is enabled with TPIN.5 */
492
#define TPCNT1_EN_nCIN         (ENB+ENA)      /*   "    is enabled with ~CIN */
493
#define TPCNT1_EN_CIN        (TPSSEL0+ENB+ENA)       /*   "    is enabled with CIN */
494
 
495
/* Source select of clock input coded with Bits 6-7 in TPCTL */
496
#define TPSSEL_CLK1_CIN        (0x00)         /* CLK1 source is signal at CIN   (default) */
497
#define TPSSEL_CLK1_ACLK       (TPSSEL0)      /* CLK1 source is ACLK */
498
#define TPSSEL_CLK1_MCLK       (TPSSEL1)      /* CLK1 source is MCLK */
499
 
500
/* DATA REGISTER ADDRESSES */
501
SFR_8BIT(TPCNT1);                             /* Timer/Port Counter 1 */
502
SFR_8BIT(TPCNT2);                             /* Timer/Port Counter 2 */
503
 
504
SFR_8BIT(TPD);                                /* Timer/Port Data */
505
#define TPD_0                  (0x01)
506
#define TPD_1                  (0x02)
507
#define TPD_2                  (0x04)
508
#define TPD_3                  (0x08)
509
#define TPD_4                  (0x10)
510
#define TPD_5                  (0x20)
511
#define CPON                   (0x40)
512
#define B16                    (0x80)
513
 
514
SFR_8BIT(TPE);                                /* Timer/Port Enable */
515
#define TPE_0                  (0x01)
516
#define TPE_1                  (0x02)
517
#define TPE_2                  (0x04)
518
#define TPE_3                  (0x08)
519
#define TPE_4                  (0x10)
520
#define TPE_5                  (0x20)
521
#define TPSSEL2                (0x40)
522
#define TPSSEL3                (0x80)
523
/* Source select of clock input coded with Bits 6-7 in TPE
524
   NOTE: If the control bit B16 in TPD is set, TPSSEL2/3
525
         are 'don't care' and the clock source of counter
526
         TPCNT2 is the same as of the counter TPCNT1. */
527
#define TPSSEL_CLK2_TPIN5      (0x00)         /* CLK2 source is signal TPIN.5 (default) */
528
#define TPSSEL_CLK2_ACLK       (TPSSEL2)      /* CLK2 source is ACLK */
529
#define TPSSEL_CLK2_MCLK       (TPSSEL3)      /* CLK2 source is MCLK */
530
#define TPSSEL_CLK2_OFF     (TPSSEL3+TPSSEL2)/* CLK2 source is disabled  */
531
 
532
/************************************************************
533
* EPROM CONTROL
534
************************************************************/
535
#define __MSP430_HAS_EPROM__                  /* Definition to show that Module is available */
536
 
537
SFR_8BIT(EPCTL);                              /* EPROM Control */
538
#define EPEXE                  (0x01)
539
#define EPVPPS                 (0x02)
540
 
541
/************************************************************
542
* Interrupt Vectors (offset from 0xFFE0)
543
************************************************************/
544
 
545
#define VECTOR_NAME(name)       name##_ptr
546
#define EMIT_PRAGMA(x)          _Pragma(#x)
547
#define CREATE_VECTOR(name)     void (* const VECTOR_NAME(name))(void) = &name
548
#define PLACE_VECTOR(vector,section) EMIT_PRAGMA(DATA_SECTION(vector,section))
549
#define ISR_VECTOR(func,offset) CREATE_VECTOR(func); \
550
                                PLACE_VECTOR(VECTOR_NAME(func), offset)
551
 
552
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
553
#define PORT0_VECTOR            ".int00"                    /* 0xFFE0 Port 0 Bits 2-7 [Lowest Priority] */
554
#else
555
#define PORT0_VECTOR            (0 * 1u)                     /* 0xFFE0 Port 0 Bits 2-7 [Lowest Priority] */
556
/*#define PORT0_ISR(func)         ISR_VECTOR(func, ".int00")  */ /* 0xFFE0 Port 0 Bits 2-7 [Lowest Priority] */ /* CCE V2 Style */
557
#endif
558
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
559
#define BASICTIMER_VECTOR       ".int01"                    /* 0xFFE2 Basic Timer */
560
#else
561
#define BASICTIMER_VECTOR       (1 * 1u)                     /* 0xFFE2 Basic Timer */
562
/*#define BASICTIMER_ISR(func)    ISR_VECTOR(func, ".int01")  */ /* 0xFFE2 Basic Timer */ /* CCE V2 Style */
563
#endif
564
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
565
#define TIMERPORT_VECTOR        ".int05"                    /* 0xFFE8 Timer/Port */
566
#else
567
#define TIMERPORT_VECTOR        (5 * 1u)                     /* 0xFFE8 Timer/Port */
568
/*#define TIMERPORT_ISR(func)     ISR_VECTOR(func, ".int05")  */ /* 0xFFE8 Timer/Port */ /* CCE V2 Style */
569
#endif
570
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
571
#define WDT_VECTOR              ".int10"                    /* 0xFFF4 Watchdog Timer */
572
#else
573
#define WDT_VECTOR              (10 * 1u)                    /* 0xFFF4 Watchdog Timer */
574
/*#define WDT_ISR(func)           ISR_VECTOR(func, ".int10")  */ /* 0xFFF4 Watchdog Timer */ /* CCE V2 Style */
575
#endif
576
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
577
#define IO1_VECTOR              ".int12"                    /* 0xFFF8 Dedicated IO (P0.1) */
578
#else
579
#define IO1_VECTOR              (12 * 1u)                    /* 0xFFF8 Dedicated IO (P0.1) */
580
/*#define IO1_ISR(func)           ISR_VECTOR(func, ".int12")  */ /* 0xFFF8 Dedicated IO (P0.1) */ /* CCE V2 Style */
581
#endif
582
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
583
#define IO0_VECTOR              ".int13"                    /* 0xFFFA Dedicated IO (P0.0) */
584
#else
585
#define IO0_VECTOR              (13 * 1u)                    /* 0xFFFA Dedicated IO (P0.0) */
586
/*#define IO0_ISR(func)           ISR_VECTOR(func, ".int13")  */ /* 0xFFFA Dedicated IO (P0.0) */ /* CCE V2 Style */
587
#endif
588
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
589
#define NMI_VECTOR              ".int14"                    /* 0xFFFC Non-maskable */
590
#else
591
#define NMI_VECTOR              (14 * 1u)                    /* 0xFFFC Non-maskable */
592
/*#define NMI_ISR(func)           ISR_VECTOR(func, ".int14")  */ /* 0xFFFC Non-maskable */ /* CCE V2 Style */
593
#endif
594
#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
595
#define RESET_VECTOR            ".reset"                    /* 0xFFFE Reset [Highest Priority] */
596
#else
597
#define RESET_VECTOR            (15 * 1u)                    /* 0xFFFE Reset [Highest Priority] */
598
/*#define RESET_ISR(func)         ISR_VECTOR(func, ".int15")  */ /* 0xFFFE Reset [Highest Priority] */ /* CCE V2 Style */
599
#endif
600
 
601
/************************************************************
602
* End of Modules
603
************************************************************/
604
 
605
#ifdef __cplusplus
606
}
607
#endif /* extern "C" */
608
 
609
#endif /* #ifndef __msp430x31x */
610