|
TM4C123G板子中的GPIOPinTypeGPIOOutput存在死程序的问题
[复制链接]
用最简单亮灯代码为例:
#include
#include
#include
#include"inc/hw_memmap.h"
#include"inc/hw_types.h"
#include"driverlib/gpio.h"
#include"driverlib/sysctl.h"
#include"driverlib/uart.h"
#include"driverlib/pin_map.h"
uint32_t ui32SysClockPerSec;
void UART0SendStr(char *str);
void UART0SendStr(char *str)
{
unsigned char i;
unsigned char length;
length = strlen(str);
for(i = 0; i
UARTCharPut(UART0_BASE, str[i]);
}
void main()
{
uint32_t ui32SysClock;
uint32_t ui32Temp = 0xffff;
SysCtlClockSet(SYSCTL_SYSDIV_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_1);//代码会“死在”这里,过不去,有时好有时坏,不知原因
GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1, 0XFF);
ui32SysClock = SysCtlClockGet();
ui32SysClockPerSec = ui32SysClock / 3;
while(1)
{
SysCtlDelay(ui32SysClockPerSec);
GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1, 0X00);
SysCtlDelay(ui32SysClockPerSec);
ui32Temp = GPIOPinRead(GPIO_PORTF_BASE, GPIO_PIN_1);
GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1, ~ui32Temp);
}
}
代码总是死在GPIOPinTypeGPIOOutput();那里!不知道为什么,求大神指教
|
|