From: Pat Thoyts Date: Sat, 6 Dec 2014 18:07:30 +0000 (+0000) Subject: Moved clock coil control pins to P1.6 and P1.7 and removed LED. X-Git-Url: https://privyetmir.co.uk/gitweb.cgi?a=commitdiff_plain;h=cab0b7009b00c78c7726dc24ff1b7c91227465fe;p=vetinari_clock Moved clock coil control pins to P1.6 and P1.7 and removed LED. This matches the constructed perfboard circuit layout. --- diff --git a/Makefile b/Makefile index d46acdc..6049ba5 100644 --- a/Makefile +++ b/Makefile @@ -3,15 +3,18 @@ CC = msp430-gcc CFLAGS=-Wall -g -Os -mmcu=$(MCU) LDFLAGS= +all: main.elf + main.elf: main.c $(CC) $(CFLAGS) -o $@ $< %.o: %.c $(CC) $(CFLAGS) -c $< -o $@ -prog: program program: main.elf MCU=$(MCU) mspdebug rf2500 "prog $<" clean: - rm -f main.elf + -rm -f main.elf + +.PHONY: clean program diff --git a/main.c b/main.c index 85ce41f..b18e3f8 100644 --- a/main.c +++ b/main.c @@ -3,17 +3,17 @@ #include #include -#define LED0 BIT0 /* P1.0 */ -#define CLKP BIT1 /* P1.1 */ -#define CLKN BIT2 /* P1.2 */ +//#define LED0 BIT0 /* P1.0 */ +#define CLKP BIT6 /* P1.6 */ +#define CLKN BIT7 /* P1.7 */ static void -init_leds(void) +setup(void) { //P1DIR |= LED0 | CLKP | CLKN; /* set P1.0,P1.1,P1.2 as output */ //P1OUT |= LED0 | CLKP | CLKN; /* set P1.0,P1.1,P1.2 low */ P1DIR = 0xff; /* set P1.* to output for reduced power consumption */ - P1OUT = LED0 | CLKP | CLKN; + P1OUT = CLKP | CLKN; /* set the counter to match on 511 which is 1s for 32kHz/8/8 (timer * re-divides the interrupt clock by 8 */ @@ -35,7 +35,7 @@ main(void) BCSCTL3 |= XCAP_3; /* enable 12.5pF internal capacitance */ srand(0xf00d); - init_leds(); + setup(); /* enable global interrupts */ eint(); @@ -64,7 +64,7 @@ TIMERA0_ISR(void) /* if driving the stepper coil, stop after 32ms (1 interrupt) */ if (state == State_Driving) { state = State_Wait; - P1OUT &= ~(CLKP | CLKN | LED0); + P1OUT &= ~(CLKP | CLKN); } if (count == 32) { @@ -76,7 +76,7 @@ TIMERA0_ISR(void) --offset; if (offset == 0) { state = State_Driving; - P1OUT |= pin_pos | LED0; + P1OUT |= pin_pos; P1OUT &= ~pin_neg; /* swap the pins for the next tick */ uint8_t t = pin_pos;