我写的程序,有什么问题么?(TM4C123GH6PM)(CCS)
实际上不能用额。
#include
#include
#include"inc/hw_ints.h"
#include"inc/hw_nvic.h"
#include"inc/hw_memmap.h"
#include"inc/hw_types.h"
#include"driverlib/debug.h"
#include"driverlib/gpio.h"
#include"driverlib/sysctl.h"
#include"driverlib/interrupt.h"
#include"driverlib/pin_map.h"
#include"driverlib/timer.h"
static unsigned char ucFlag = true;
int main(void)
{
SysCtlClockSet(SYSCTL_SYSDIV_4|SYSCTL_USE_PLL|SYSCTL_OSC_MAIN|SYSCTL_XTAL_16MHZ);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE,GPIO_PIN_6);
GPIOPinWrite(GPIO_PORTA_BASE,GPIO_PIN_6,0x00);
GPIOPinTypeGPIOOutput(GPIO_PORTD_BASE,GPIO_PIN_7);
GPIOPinWrite(GPIO_PORTD_BASE,GPIO_PIN_7,0x00);
GPIOPinTypeGPIOInput(GPIO_PORTF_BASE,GPIO_PIN_1);
GPIOPadConfigSet(GPIO_PORTF_BASE,GPIO_PIN_1,GPIO_STRENGTH_2MA,GPIO_PIN_TYPE_STD_WPD);
GPIOIntTypeSet(GPIO_PORTF_BASE,GPIO_PIN_1,GPIO_LOW_LEVEL);
IntPrioritySet(GPIO_INT_PIN_1,0x00);
IntEnable(GPIO_INT_PIN_1);
GPIOIntEnable(GPIO_PORTF_BASE,GPIO_INT_PIN_1);
IntMasterEnable();
while(1);
}
void IntHandler()
{
GPIOIntClear(GPIO_PORTF_BASE,GPIO_PIN_1);
if(ucFlag)
{
GPIOPinWrite(GPIO_PORTA_BASE,GPIO_PIN_6,0x40);
ucFlag = false;
}
else
{
GPIOPinWrite(GPIO_PORTA_BASE,GPIO_PIN_6,0x00);
ucFlag = true;
}
}
说明:
LED是连着A6 Pin脚的。
谢谢!
|