1 |
2 |
olivier.gi |
#ifndef HARDWARE_H
|
2 |
|
|
#define HARDWARE_H
|
3 |
|
|
|
4 |
212 |
olivier.gi |
#define BIT0 (0x0001)
|
5 |
|
|
#define BIT1 (0x0002)
|
6 |
|
|
#define BIT2 (0x0004)
|
7 |
|
|
#define BIT3 (0x0008)
|
8 |
|
|
#define BIT4 (0x0010)
|
9 |
|
|
#define BIT5 (0x0020)
|
10 |
|
|
#define BIT6 (0x0040)
|
11 |
|
|
#define BIT7 (0x0080)
|
12 |
|
|
#define BIT8 (0x0100)
|
13 |
|
|
#define BIT9 (0x0200)
|
14 |
|
|
#define BITA (0x0400)
|
15 |
|
|
#define BITB (0x0800)
|
16 |
|
|
#define BITC (0x1000)
|
17 |
|
|
#define BITD (0x2000)
|
18 |
|
|
#define BITE (0x4000)
|
19 |
|
|
#define BITF (0x8000)
|
20 |
2 |
olivier.gi |
|
21 |
212 |
olivier.gi |
#define CCIS_0 (0x0000) /* Capture input select: 0 - CCIxA */
|
22 |
|
|
#define CCIS_1 (0x1000) /* Capture input select: 1 - CCIxB */
|
23 |
|
|
#define CCIS_2 (0x2000) /* Capture input select: 2 - GND */
|
24 |
|
|
#define CCIS_3 (0x3000) /* Capture input select: 3 - Vcc */
|
25 |
|
|
#define CM_0 (0x0000) /* Capture mode: 0 - disabled */
|
26 |
|
|
#define CM_1 (0x4000) /* Capture mode: 1 - pos. edge */
|
27 |
|
|
#define CM_2 (0x8000) /* Capture mode: 1 - neg. edge */
|
28 |
|
|
#define CM_3 (0xC000) /* Capture mode: 1 - both edges */
|
29 |
2 |
olivier.gi |
|
30 |
212 |
olivier.gi |
#define CCIE (0x0010) /* Capture/compare interrupt enable */
|
31 |
|
|
#define CCI (0x0008) /* Capture input signal (read) */
|
32 |
|
|
#define SCS (0x0800) /* Capture sychronize */
|
33 |
|
|
#define CAP (0x0100) /* Capture mode: 1 /Compare mode : 0 */
|
34 |
|
|
|
35 |
|
|
|
36 |
2 |
olivier.gi |
//PINS
|
37 |
|
|
//PORT1
|
38 |
|
|
#define TX BIT1
|
39 |
|
|
|
40 |
|
|
//PORT2
|
41 |
|
|
#define RX BIT2
|
42 |
|
|
#define LED BIT1
|
43 |
|
|
|
44 |
|
|
//Port Output Register 'P1OUT, P2OUT':
|
45 |
|
|
#define P1OUT_INIT TX //Init Output data of port1
|
46 |
|
|
#define P2OUT_INIT 0 //Init Output data of port2
|
47 |
|
|
#define P3OUT_INIT 0 //Init Output data of port3
|
48 |
|
|
|
49 |
|
|
//Port Direction Register 'P1DIR, P2DIR':
|
50 |
|
|
#define P1DIR_INIT TX //Init of Port1 Data-Direction Reg (Out=1 / Inp=0)
|
51 |
|
|
#define P2DIR_INIT ~RX //Init of Port2 Data-Direction Reg (Out=1 / Inp=0)
|
52 |
|
|
#define P3DIR_INIT 0xff //Init of Port3 Data-Direction Reg (Out=1 / Inp=0)
|
53 |
|
|
|
54 |
|
|
//Selection of Port or Module -Function on the Pins 'P1SEL, P2SEL'
|
55 |
|
|
#define P1SEL_INIT 0 //P1-Modules:
|
56 |
|
|
#define P2SEL_INIT RX //P2-Modules:
|
57 |
|
|
#define P3SEL_INIT 0 //P3-Modules:
|
58 |
|
|
|
59 |
|
|
//Interrupt capabilities of P1 and P2
|
60 |
|
|
#define P1IE_INIT 0 //Interrupt Enable (0=dis 1=enabled)
|
61 |
|
|
#define P2IE_INIT 0 //Interrupt Enable (0=dis 1=enabled)
|
62 |
|
|
#define P1IES_INIT 0 //Interrupt Edge Select (0=pos 1=neg)
|
63 |
|
|
#define P2IES_INIT 0 //Interrupt Edge Select (0=pos 1=neg)
|
64 |
|
|
|
65 |
|
|
#define IE_INIT 0
|
66 |
|
|
#define WDTCTL_INIT WDTPW|WDTHOLD
|
67 |
|
|
|
68 |
|
|
#define BCSCTL1_FLL XT2OFF|DIVA1|RSEL2|RSEL0
|
69 |
|
|
#define BCSCTL2_FLL 0
|
70 |
|
|
#define TACTL_FLL TASSEL_2|TACLR
|
71 |
|
|
#define CCTL2_FLL CM0|CCIS0|CAP
|
72 |
|
|
|
73 |
|
|
#define TACTL_AFTER_FLL TASSEL_2|TACLR|ID_0
|
74 |
|
|
|
75 |
|
|
//#define BAUD 40 //9600 @3MHz div 8
|
76 |
|
|
//#define BAUD 20 //19200 @3MHz div 8
|
77 |
|
|
//#define BAUD 20 //9600 @1.5MHz div 8
|
78 |
|
|
//#define BAUD 140 //9600 @1.5MHz div 8
|
79 |
|
|
|
80 |
|
|
//#define BAUD 2083 //9600 @20.0MHz div 1
|
81 |
|
|
//#define BAUD 1042 //19200 @20.0MHz div 1
|
82 |
|
|
//#define BAUD 521 //38400 @20.0MHz div 1
|
83 |
|
|
//#define BAUD 347 //57600 @20.0MHz div 1
|
84 |
|
|
#define BAUD 174 //115200 @20.0MHz div 1
|
85 |
|
|
//#define BAUD 87 //230400 @20.0MHz div 1
|
86 |
|
|
|
87 |
|
|
//Selection of 'Digitally Controlled Oszillator' (desired frquency in HZ, 1..3 MHz)
|
88 |
|
|
#define DCO_FREQ 1536000 //3072000/2 makes 9600 a bit more precise
|
89 |
|
|
|
90 |
|
|
//Automatic, do not edit
|
91 |
|
|
#define DCO_FSET (DCO_FREQ/8192) //DCO_FSET = DCO_FREQ / (32768/4)
|
92 |
|
|
#define DCOCTL_MAX 0xff // Used from FLL to check when Rsel must be changed
|
93 |
|
|
#define DCOCTL_MIN 0 // Used from FLL to check when Rsel must be changed
|
94 |
|
|
|
95 |
|
|
|
96 |
|
|
#endif //HARDWARE_H
|