-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
61 lines (58 loc) · 1.33 KB
/
main.c
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
//*****************************************************************************
//
// MSP432 main.c
//
//****************************************************************************
#include "msp.h"
#include "stdio.h"
#include "stdlib.h"
#include "ADC.h"
#include "UART.h"
#include "Timer16.h"
#include "interface.h"
//#include "spi.h"
extern volatile uint16_t num0;
extern volatile uint16_t num2;
extern uint8_t transmit_state;
extern uint8_t type;
volatile uint8_t rxd_command;
//#include <float.h>
void main(void)
{
P2DIR=BIT5|BIT4;
P1DIR=BIT0;
P5DIR=BIT6;
WDTCTL = WDTPW | WDTHOLD;// Stop watchdog timer
configure_serial_port(BAUD_9600);
__enable_interrupt();
while(1){
if(!transmit_state){
//char get = getchar();
char get = rxd_command;
//printf("%d\n",get);
while(!(UCA3IFG & UCTXIFG));
UCA3TXBUF =0x5A;
switch (get){
case 'A'://channel 1 sampling & transmitting
ADC_channel1_start();
break;
case 'B'://channel 2 sampling & transmitting
ADC_channel2_start();
break;
case 'C'://sampling & transmitting stop
ADC_channel_stop();
break;
}
}
else{
switch(type){
case 0x01:
ADC_channel1_transmit();
break;
case 0x02:
ADC_channel2_transmit();
break;
}
}
}
}