新闻中心

EEPW首页>嵌入式系统>设计应用> LM3S9B96 IAR 新建一个工程

LM3S9B96 IAR 新建一个工程

作者: 时间:2016-11-11 来源:网络 收藏
以闪烁LED为例,讲解如何新建一个project,并配置工程选项。
重点:1) $PROJ_DIR$ 代表什么
2) 需要哪些库,到开发板提供的光盘中找

         

#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "driverlib/gpio.h"
#include "driverlib/sysctl.h"

/* 寄存器地址 ---------------------------------------------------------------*/
#define GPIO_PORTF_APB_DIR_R 0x40025400
#define GPIO_PORTF_APB_DEN_R 0x4002551C

/* 用于调试 PF1 <-> LED -----------------------------------------------------*/
#define LED_PERIPH SYSCTL_PERIPH_GPIOF
#define LED_PORT GPIO_PORTF_BASE
#define LED_PIN GPIO_PIN_1
#define LED_OFF 1 << 1
#define LED_ON ~(1 << 1) // 低电平点亮LED

void Delay(volatile signed long nCount)
{
for(; nCount != 0; nCount--);
}


int main(void)
{
// Set the clocking to run directly from the crystal.
SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ);

SysCtlPeripheralEnable(LED_PERIPH); // 使能LED所在的GPIO端口

GPIOPinTypeGPIOOutput(LED_PORT, LED_PIN); // 设置LED所在管脚为输出

while (1)
{
GPIOPinWrite(LED_PORT, LED_PIN, LED_ON); //点亮LED
Delay(0xfffff);
GPIOPinWrite(LED_PORT, LED_PIN, LED_OFF); //熄灭LED
Delay(0xfffff);
}
}

本文引用地址: //m.amcfsurvey.com/article/201611/317004.htm



关键词:LM3S9B96IAR工

评论


技术专区

关闭