Blinking LED By MSP430
At my this project i used ” __delay_cycles(); ” function it is very useful function.
Theme of the program is; i press the P1.3 as HIGH (3.3V) (not from the button) LEDs will
be on sequencely one after the other one and slower than the buttons not pressed case.
Main goal at this programme for me, i learned from that S2 is connected to the P1.3
and S2’s other pin is connected to the ground. I discovered that by using AVOmeter’s
short circuit channel.
#include <msp430.h> #define B1 0x08 void main(void) { WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer P1SEL = 0x00; P1DIR = 0x41; // SET LED1 and LED2 as output , S1 as input //P1REN = 0x08; for(;;) { while ( ( P1IN & B1 ) == B1 ){ P1OUT = 0x01; __delay_cycles(1000000); P1OUT = 0x40; __delay_cycles(1000000); } P1OUT = 0x01; __delay_cycles(100000); P1OUT = 0x40; __delay_cycles(100000); } }
Kasım 11, 2014 tarihinde MSP430 içinde yayınlandı. Kalıcı bağlantıyı yer imlerinize ekleyin. Yorum yapın.
Yorum yapın
Comments 0