以下是我写的代码,求各位指教
#include <msp430.h>
#include<xianshi.h>
#include<GPIO_init.h>
#include<dushuju.h>
////上位机
/*
* main.c
*/
unsigned char shidu,wendu,shiduh,shidul,wenduh,wendul,i;
void main(void) {
WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer
GPIO_init();
Init5110();
P2DIR&=~BIT0;
P2REN|=BIT0;
P2OUT&=~BIT0; //设置为下拉电阻
P2IES&=~BIT0; //上升沿中断
P2IFG&=~BIT0;
P2IE|=BIT0;
_enable_interrupts();
}
#pragma vector=PORT2_VECTOR
__interrupt void PORT_2(void)
{ P4DIR|=BIT7; //
P4OUT|=BIT7; //点亮led灯
P2IFG&=~BIT0;
}
void abort(void)
{
/*-------------------------------------------------------------------*/
/* SET C$EXIT LABEL SO THE DEBUGGER KNOWS WHEN THE C++ PROGRAM HAS */
/* COMPLETED. THIS CAN BE REMOVED IF THE DEBUGGER IS NOT USED. */
/*-------------------------------------------------------------------*/
__asm(" .global C$EXIT");
__asm("C$EXIT: nop");
for (;;); /* SPINS FOREVER */
}
|