Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!
The progression in this thread never ceases to amaze me. I have only four lots of parts to arrive, then I can start building......which makes me about two years behind
boolean debounced = false;
byte pushCounter = 0;
#include <msp430g2553.h>
void setup(){ //Everything in Setup except the pinMode line is from this post:
//http://e2e.ti.com/support/microcontrollers/msp43016-bit_ultra-low_power_mcus/f/166/t/178595.aspx
//A few changes have been made to suit my speeds and purposes.
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
P1DIR |= 0x0C; // P1.2/TA0.1 and P1.3 output
P1SEL |= 0x0C; // P1.2 and P1.3 TA1/2 options
P2DIR |= 0x02; // P2.1/TA1.1 output
P2SEL |= 0x02; // P2.1 options
CCR0 = 640; // PWM Period
CCTL1 = OUTMOD_7; // CCR1 reset/set
CCTL2 = OUTMOD_7; // CCR1 reset/set
CCR1 = CCR0 / 2; // CCR1 PWM duty cycle
TACTL = TASSEL_2 + MC_1; // SMCLK, up mode
__delay_cycles (16000000); //wait one second at 50% PWM to kickstart the fan.
pinMode(PUSH2,INPUT_PULLUP); //Need to enable the button and turn the pullup on
}
void loop(){
if (digitalRead(PUSH2) == LOW && !debounced){ //Button got pressed!
pushCounter++; //Increment the counter.
if (pushCounter > 5){ //Make sure the counter doesn't get out of hand
pushCounter = 0; //this wraps it back around to zero
}
debounced = true; //This prevents the button from activating continually while held
CCR1 = pushCounter * 128; //Turn the counter into a PWM level.
__delay_cycles (5000000); //Wait a bit, 5 million CPU cycles.
}
if (debounced && digitalRead(PUSH2) == HIGH){ //Button has been released if this is true
__delay_cycles(800000); //wait a bit incase it's a bouncing button spike.
debounced = false; //enable the next button press.
}
}
I wonder, where do you guys fab your PCBs?
my previous one had 20mils of trace width and 10mils of clearance with no copper pour and it got bridges all over the place
I've had great luck with that outfit, they do really good work.
I'd make the VCC12V traces wider on that PCB, they look awfully small given that all the fans feed through the one trace (though it is fed at both ends, I like that). It looks like you could make a pretty juicy VCC12V plane on the top side of the board.
That said, I like overkill
You could always put a fuse on it. Not a bad idea really.