Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "msp430g2231.h"
- int main(void)
- {
- WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer
- P1DIR |= 0x0001;
- P1DIR |= 0x0040;
- P1DIR |= 0x0004;
- P1DIR |= 0x0008;
- P1DIR |= 0x0010;
- P1DIR |= 0x0020;
- P1OUT = 0;
- BCSCTL3 |= LFXT1S_2; // LFXT1 = VLO
- IFG1 &= ~OFIFG; // Clear OSCFault flag
- __bis_SR_register(SCG1 + SCG0); // Stop DCO
- BCSCTL2 |= SELM_3 + DIVM_3; // MCLK = VLO/8
- unsigned int counter = 0;
- while(counter < 100)
- {
- P1OUT = 0x0004;
- _delay_cycles(20);
- P1OUT = 0x0008;
- _delay_cycles(20);
- P1OUT = 0x0010;
- _delay_cycles(20);
- P1OUT = 0x0020;
- _delay_cycles(60);
- counter = counter + 1;
- }
- P1OUT = 0x0000;
- }
Advertisement
Add Comment
Please, Sign In to add comment