第一个ARM程序 ,控制led闪烁、、、、但是没看太懂,,,速求、、、谢、、、、
LED.rar
(56.84 KB)
#include "hw_ints.h"
#include "hw_memmap.h"
#include "hw_types.h"
#include "gpio.h"
#include "sysctl.h"
#include "cpu.h"
#include "interrupt.h"
#define LED_PERIPH SYSCTL_PERIPH_GPIOB
#define LED_PORT GPIO_PORTB_BASE
#define LED GPIO_PIN_5 // PB5控制D1
void delay (int a)
{
for (; a > 0; a--);
}
int main(void)
{
SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN |
SYSCTL_XTAL_6MHZ);
SysCtlPeripheralEnable(LED_PERIPH);
GPIOPinTypeGPIOOutput(LED_PORT, LED);
GPIOPadConfigSet(LED_PORT, LED, GPIO_STRENGTH_8MA,
GPIO_PIN_TYPE_STD_WPU);
for(;;)
{
GPIOPinWrite(LED_PORT, LED, 0xFF);
delay(1000000);
GPIOPinWrite(LED_PORT, LED, 0x00);
delay(1000000);
}
} |