#include "moje_lib.h" #include "msp430g2231.h" #define LED1 BIT0 #define LED2 BIT1 #define LED3 BIT2 #define LED4 BIT3 #define LED5 BIT4 #define LED6 BIT5 #define LED7 BIT6 #define LED8 BIT7 #define DELAY 22000 void main(void) { WDTCTL = WDTPW + WDTHOLD; P1DIR |= (LED1 + LED2 + LED3 + LED4 + LED5 + LED6 + LED7 + LED8); P1OUT &= ~(LED1 + LED2 + LED3 + LED4 + LED5 + LED6 + LED7 + LED8); for (;;) { unsigned int diode; for (diode = 1; diode <= 64; diode = diode + diode) { P1OUT ^= diode; delaytime(DELAY); P1OUT ^= diode; } for (diode = 128; diode >= 2; diode = diode / 2) { P1OUT ^= diode; delaytime(DELAY); P1OUT ^= diode; } } }