Bike-X
0.8
Main Page
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
main.c
Go to the documentation of this file.
1
#include<msp430g2553.h>
2
3
#include <
launchpad.h
>
4
#include <
Wrap.h
>
5
6
7
int
main
()
8
{
9
/* Counting parameters */
10
volatile
int
counter = 0, endcount = 1000;
11
char
ch;
12
13
14
desabWDT
();
15
/* botao(); */
16
dco1mhz
();
17
hserial
();
18
19
hled
(
VERM
|
VERD
);
20
ligled
(
VERM
);
21
//P1OUT ^= VERM;
22
/* Defined in Wrap.h */
23
int
cmd;
24
25
for
(;;)
26
{
27
//P1OUT ^= VERM;
28
cmd =
getchar
();
29
switch
(cmd)
30
{
31
case
ALL_VALUES
:
32
//printf("[%d,%d]\n", adc_read(0),adc_read(1));
33
break
;
34
case
'a'
:
35
case
BREAK_MSP
:
36
37
//dly_coxa(1000);
38
39
ch =
getchar
();
40
41
if
((ch >=
'0'
) && (ch <=
'9'
))
42
endcount = 1000 + (int) ((
unsigned
char
) ch-
'0'
)*10000/10;
43
44
//if(counter >= endcount)
45
//{
46
counter = 0;
47
P1OUT ^=
VERD
;
48
//}
49
//else
50
//{
51
//counter++;
52
//}
53
54
55
/*
56
Read new value from serial
57
and use this value to set the
58
position of the servo motor
59
*/
60
break
;
61
case
DIRECTION_MSP
:
62
//printf("[%d]\n", adc_read(0));
63
break
;
64
case
VELOCITY_MSP
:
65
//printf("[%d]\n", adc_read(0));
66
break
;
67
default
:
68
break
;
69
}
70
71
72
if
(counter >= endcount)
73
{
74
counter = 0;
75
P1OUT ^=
VERM
;
76
}
77
else
78
{
79
counter++;
80
}
81
82
}
83
84
return
0;
85
}
86
main
int main()
Definition:
main.c:7
ALL_VALUES
#define ALL_VALUES
Definition:
Wrap.h:19
ligled
void ligled(char numled)
Definition:
launchpad.c:64
VELOCITY_MSP
#define VELOCITY_MSP
Definition:
Wrap.h:21
VERM
#define VERM
Definition:
launchpad.h:13
hled
void hled(unsigned char numled)
Enable LED.
Definition:
launchpad.c:33
hserial
void hserial()
launchpad.h
Wrap.h
dco1mhz
void dco1mhz()
Definition:
launchpad.c:95
VERD
#define VERD
Definition:
launchpad.h:14
getchar
char getchar()
desabWDT
void desabWDT()
Desable Watchdog.
Definition:
launchpad.c:9
device.scripts.startx.BREAK_MSP
BREAK_MSP
Definition:
startx.py:80
DIRECTION_MSP
#define DIRECTION_MSP
Definition:
Wrap.h:20
device
msp430dev
main.c
Generated on Wed Oct 1 2014 00:45:20 for Bike-X by
1.8.6