为什么使用ON-CHIP ROM LED 闪烁时间变快了。求助。谢谢
程序如下:
#include <stdint.h>
#include <stdbool.h>
#include "inc/hw_types.h"
#include "inc/hw_memmap.h"
#include "driverlib/sysctl.h"
#include "driverlib/gpio.h"
#include "driverlib/rom.h"
#define RED_LED GPIO_PIN_1
#define BLUE_LED GPIO_PIN_2
#define GREEN_LED GPIO_PIN_3
int
main(void)
{
//
// Setup the system clock to run at 50 Mhz from PLL with crystal reference
//
ROM_SysCtlClockSet(SYSCTL_SYSDIV_4|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|
SYSCTL_OSC_MAIN);
//
// Enable and configure the GPIO port for the LED operation.
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
ROM_GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, RED_LED|BLUE_LED|GREEN_LED);
//
// Loop Forever
//
while(1)
{
//
// Turn on the LED
//
ROM_GPIOPinWrite(GPIO_PORTF_BASE, RED_LED|BLUE_LED|GREEN_LED, RED_LED);
//
// Delay for a bit
//
ROM_SysCtlDelay(5000000);
//
// Turn on the LED
//
ROM_GPIOPinWrite(GPIO_PORTF_BASE, RED_LED|BLUE_LED|GREEN_LED, BLUE_LED);
//
// Delay for a bit
//
ROM_SysCtlDelay(5000000);
ROM_GPIOPinWrite(GPIO_PORTF_BASE, RED_LED|BLUE_LED|GREEN_LED, GREEN_LED);
//
// Delay for a bit
//
ROM_SysCtlDelay(5000000);
}
}
此帖出自
小平头技术问答
一周热门 更多>