#include "inc/hw_ints.h"
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "gpio.h"
#include "sysctl.h"
#define PINS GPIO_PIN_0
void delay(int d)
{
for(;d;--d);
}
void SysCtlClockSet(unsigned long ulConfig)
{}
void SysCtlPeripheralEnable (unsigned long ulPeripheral)
{}
void GPIODirModeSet(unsigned long ulPort,unsigned char ucPins,unsigned long ulPinIO)
{}
void GPIOPinWrite(unsigned long ulPort, unsigned char ucPins, unsigned char ucVal)
{}
int main(void)
{
unsigned int i;
SysCtlClockSet(SYSCTL_SYSDIV_1|SYSCTL_USE_OSC|SYSCTL_OSC_MAIN|SYSCTL_XTAL_6MHZ);//直接使用外部晶振
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);//使能GPIO的PA模块
GPIODirModeSet(GPIO_PORTD_BASE,PINS,GPIO_DIR_MODE_OUT);//设置PD0输出
for(i=0;i<10;i++);
{
GPIOPinWrite(GPIO_PORTD_BASE,PINS,~PINS);//置PD0低电平
delay(20000);
GPIOPinWrite(GPIO_PORTD_BASE,PINS,PINS);//置PD0高电平
delay(20000);
}
SysCtlClockSet(SYSCTL_SYSDIV_1|SYSCTL_USE_PLL|SYSCTL_OSC_MAIN|SYSCTL_XTAL_6MHZ);//使用PLL
for(i=0;i<10;i++)
{GPIOPinWrite(GPIO_PORTD_BASE,PINS,PINS);
delay(20000);
GPIOPinWrite(GPIO_PORTD_BASE,PINS,PINS);
delay(20000);
}
return 0;
}
用的CCSV5 编译时没问题 DEBUG时就出现CORTEX_M3_0: GEL Output:
Memory Map Initialization Complete
CORTEX_M3_0: GEL Output: Watchdog Timer Enabled
CORTEX_M3_0: GEL Output: UARTs Enabled
CORTEX_M3_0: Flash Programmer: Timed out while writing to Flash memory
CORTEX_M3_0: Trouble Writing Memory Block at 0x0 on Page 0 of Length 0x3b0
CORTEX_M3_0: GEL: File: F:\xuzhetao\CCS\LAB2\Debug\LAB2.out: Load failed. |