Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <msp430g2553.h>
- #define MAX 3000
- unsigned int i = 0; // Initialize variables. This will keep count of how many cycles between LED toggles
- void delay()
- {
- for(i=0;i<=MAX;i++);
- for(i=0;i<=MAX;i++);
- }
- void main(void)
- {
- WDTCTL = WDTPW + WDTHOLD;
- P1DIR |= BIT0;
- P1DIR |= BIT1;
- P1DIR |= BIT2;
- P1DIR |= BIT3;
- P1DIR |= BIT4;
- P1OUT |= BIT0; // initially i off the bit
- P1OUT |= BIT1;
- P1OUT |= BIT2;
- P1OUT |= BIT3;
- P1OUT |= BIT4;
- for(;;)
- {
- P1OUT &= ~BIT0;
- delay();
- P1OUT |= BIT0;
- P1OUT &= ~BIT1;
- delay();
- P1OUT |= BIT1;
- P1OUT &= ~BIT2;
- delay();
- P1OUT |= BIT2;
- P1OUT &= ~BIT3;
- delay();
- P1OUT |= BIT3;
- P1OUT &= ~BIT4;
- delay();
- P1OUT |= BIT4;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement