-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
109 lines (70 loc) · 1.57 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#include "msp430g2553.h"
#include "timer.h"
#include "pins.h"
#include "xbee_s1.h"
#define BUTTON BIT3
void startTest(void);
bool startT;
char btnpress;
unsigned char check;
char value;
/*
* main.c
*/
int main(void) {
WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer
if (CALDCO_16MHZ == 0xFF) // If calibration constant erased
{
while (1)
; // do not load, trap CPU!!
}
DCOCTL = 0; // Select lowest DCOx and MODx settings
BCSCTL1 = CALBC1_16MHZ; // Set DCO
DCOCTL = CALBC1_16MHZ;
InitializeClockTime();
initPins();
//endbtn
btnpress = 0;
XbeeS1 xbee;
_BIS_SR(GIE); // Enable CPU interrupts
Xbee16Addr adr(0x00,0x01);
Xbee64Addr adr64(0x00,0x13,0xA2,0x00,0x40,0x92,0xBA,0xEF);
unsigned char counter=0;
while (1) {
// TXNODE EX1
if (startT && counter < 1) {
//xbee.txPacket(adr, teste, 150, strlen(teste));
//xbee.txPacket(adr, teste);
//xbee.TxRequest64(adr64, "teste");
//xbee.TxRemoteATCommand(adr64,'C','H');
counter++;
QuaterMillisElapsed(100);
//RED_LED_TOGGLE();
}else{
startT = false;
counter = 0;
}
while (!xbee.IsEmpty()) {
//RED_LED_TOGGLE();
//rxPacket = xbee.get_packet();
//RED_LED_TOGGLE();
}
//ENDTXNODE
if (btnpress == 1) {
//RED_LED_TOGGLE();
startTest();
SecondsElapsed(1);
btnpress = 0;
}
}
}
void startTest() {
startT = true;
BeginTest();
}
#pragma vector=PORT1_VECTOR
__interrupt void Port_1(void) {
btnpress++;
P1IFG &= ~BUTTON;
//P1IES ^= BUTTON;
}