MSP430F149学习之路——按键与LED】的更多相关文章

代码 /*********************************** 程序功能:用按键控制LED状态 缺点:按键按下后无法改变LED灯的状态,可以利用板上的复位键^~^ *************************************/ #include <msp430x14x.h> ; void int_clk(); void led(int n); void main() { WDTCTL = WDTPW + WDTHOLD; int_clk(); P1DIR = 0X…
代码一: /********************************** 程序功能:用按键控制LED灯熄灭 ***********************************/ #include <msp430x14x.h> void int_clk(); void main() { WDTCTL = WDTPW + WDTHOLD; int_clk(); P1DIR = 0Xf0; P1OUT = 0Xff; P6DIR = 0XFF; P6OUT = 0x00; ) { swi…
#include <msp430x14x.h> void int_clk(); void delay(int i); void main() { WDTCTL = WDTPW + WDTHOLD; int_clk(); P6DIR = 0XFF; P6OUT = 0Xff; ) { P6OUT = 0XFF; delay(); P6OUT = 0x00; delay(); } } void int_clk() { BCSCTL1 &= ~XT2OFF; BCSCTL2 |= SELM_…
代码一: /************************** 功能:LED每隔1秒闪烁一次 ****************************/ #include <msp430x14x.h> void main() { P6DIR = 0XFF; P6OUT = 0X00; TACCR0 = ; TACCTL0 = CCIE; TACTL = TASSEL_1 + ID_3 + MC_1; _EINT(); LPM3; } #pragma vector=TIMERA0_VECTOR…
代码一:Timer_A触发转换 #include <msp430x14x.h> void main() { WDTCTL = WDTPW + WDTHOLD; P6SEL |= BIT0; TACTL |= TASSEL_2 + MC_2; TACCTL1 = OUTMOD_3; TACCR1 = 0X0FFF; ADC12CTL0 = ADC12ON + SHT0_2; ADC12CTL1 = SHS_1 + SHP; ) { ADC12CTL0 |= ENC; ADC12CTL0 |= A…
注意蓝牙模块的接法! #include <msp430x14x.h> ]; ; void int_clk() { BCSCTL1 &= ~XT2OFF; BCSCTL2 |= SELM_2 + SELS; do { IFG1 &= ~OFIFG; ;i<;i++) _NOP(); }); IFG1 &= ~OFIFG; } void int_usart() { U0CTL |= SWRST; U0CTL |= CHAR; U0TCTL |= SSEL1; U0BR…
代码一: //****************************************************************************** //Description:SPI slave talks to SPI master using 3-wire mode. Data is sent //to the master starting at 0x00 and increments. Received data from the //master is expe…
代码一: #include <msp430x14x.h> void int_clk() { BCSCTL1 &= ~XT2OFF; BCSCTL2 |= SELM_2 + SELS; do { IFG1 &= ~OFIFG; ;i<;i++) _NOP(); }); IFG1 &= ~OFIFG; } void int_usart() { U0CTL |= SWRST; //复位串口 U0CTL |= CHAR; //8位数据 U0TCTL |= SSEL1; /…
代码一: #include <msp430x14x.h> ; void int_clk() { BCSCTL1 &= ~XT2OFF; BCSCTL2 |= SELM_2 + SELS; do { IFG1 &= ~OFIFG; ;i<;i++) _NOP(); }); IFG1 &= ~OFIFG; } void int_COMPARATORA() { P2SEL |= BIT3 + BIT4; //P2.3,P2.4分别作为比较器的输出和输入 P2DIR |=…
代码一: /******************************* 程序功能:ACLK=32768Hz PWM波 T=512/32768 占空比75% *********************************/ #include <msp430x14x.h> void main() { WDTCTL = WDTPW + WDTHOLD; TACTL = TASSEL_1 + TACLR; CCTL0 = 0X00; CCTL1 = 0X00; CCR0 = -; //T=51…