summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile10
-rw-r--r--main.c18
2 files changed, 11 insertions, 17 deletions
diff --git a/Makefile b/Makefile
index 1c1e2c5..494eacc 100644
--- a/Makefile
+++ b/Makefile
@@ -1,10 +1,12 @@
CC=msp430-gcc
-CFLAGS=-Os -Wall -g -mmcu=msp430x2012
+CFLAGS=-Os -Wall -g -mmcu=msp430g2231
OBJS=main.o
+TARGET=main.elf
+all: $(TARGET)
-all: $(OBJS)
+$(TARGET): $(OBJS)
$(CC) $(CFLAGS) -o main.elf $(OBJS)
%.o: %.c
@@ -12,3 +14,7 @@ all: $(OBJS)
clean:
rm -fr main.elf $(OBJS)
+
+.PHONY: prog
+prog: $(TARGET)
+ mspdebug rf2500 "prog $<"
diff --git a/main.c b/main.c
index a52c4cf..1c1f24e 100644
--- a/main.c
+++ b/main.c
@@ -20,17 +20,7 @@ Copyright (c) 2010 - Mike Szczys
THE SOFTWARE.
*/
-//#include <msp430x20x2.h> <-taken care of by including io.h and setting -mmcu=msp430x2012 in cflags
- /* It's interesting to note that this is not the header
- file for the chip we are using. This source code
- is intended for the MSP430G2231 but there's no
- header file for that specific ship. It apprears
- That the MPS430x2012 is closely related and
- I haven't observed any problems with using this
- header file. */
-#include <io.h>
-#include <signal.h>
-
+#include <msp430.h>
#define LED0 BIT0
#define LED1 BIT6
@@ -61,7 +51,7 @@ int main(void) {
BCSCTL3 |= LFXT1S_2; //Set ACLK to use internal VLO (12 kHz clock)
- TACTL = TASSEL__ACLK | MC__UP; //Set TimerA to use auxiliary clock in UP mode
+ TACTL = TASSEL_1 | MC_1; //Set TimerA to use auxiliary clock in UP mode
TACCTL0 = CCIE; //Enable the interrupt for TACCR0 match
TACCR0 = 11999; /*Set TACCR0 which also starts the timer. At
12 kHz, counting to 12000 should output
@@ -75,8 +65,6 @@ int main(void) {
}
}
-interrupt(TIMERA0_VECTOR) TIMERA0_ISR(void) {
+void __attribute__((interrupt (TIMERA0_VECTOR))) TIMERA0_ISR(void) {
LED_OUT ^= (LED0 + LED1); //Toggle both LEDs
}
-
-