⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gpio_led.c

📁 流明615GPIO在IAR5.11上的程序
💻 C
字号:
//*****************************************************************************
//
// gpio_led.c - GPIO example that lights up the LEDs in an amusing fashion.
//
// Copyright (c) 2005-2007 Luminary Micro, Inc.  All rights reserved.
// 
// Software License Agreement
// 
// Luminary Micro, Inc. (LMI) is supplying this software for use solely and
// exclusively on LMI's microcontroller products.
// 
// The software is owned by LMI and/or its suppliers, and is protected under
// applicable copyright laws.  All rights are reserved.  You may not combine
// this software with "viral" open-source software in order to form a larger
// program.  Any use in violation of the foregoing restrictions may subject
// the user to criminal sanctions under applicable laws, as well as to civil
// liability for the breach of the terms and conditions of this license.
// 
// THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
// OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
// LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
// CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
// 
// This is part of revision 1952 of the Stellaris Peripheral Driver Library.
//
//*****************************************************************************
/*
#include "../Luminary/hw_memmap.h"
#include "../Luminary/hw_types.h"
#include "../Luminary/src/debug.h"
#include "../Luminary/src/gpio.h"
#include "../Luminary/src/sysctl.h"
#include "../Luminary/src/systick.h"
#include "../pdc.h"
*/

#include "hw_memmap.h"
#include "hw_types.h"
#include "debug.h"
#include "gpio.h"
#include "sysctl.h"
#include "systick.h"
//#include "../pdc.h"

//*****************************************************************************
//
//! \addtogroup dk_lm3s815_list
//! <h1>GPIO (gpio_led)</h1>
//!
//! This example application uses LEDs connected to GPIO pins to create a
//! ``roving eye'' display.  Port B0-B3 are driven in a sequential manner to
//! give the illusion of an eye looking back and forth.
//!
//! In order for this example to work properly, the ULED0 (JP22), ULED1 (JP23),
//! ULED2 (JP24), and ULED3 (JP25) jumpers must be installed on the board, and
//! the PB1 (JP1) jumper on the daughtercard must be set to pins 2 & 3.
//
//*****************************************************************************

//*****************************************************************************
//
// The set of GPIO pins that will be used for the LED show.
//
//*****************************************************************************
#define PINS    GPIO_PIN_4

void delay(int d)
{
  for( ; d; --d);
}

int main(void)
{
    SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN |
                   SYSCTL_XTAL_6MHZ);

    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
    GPIODirModeSet(GPIO_PORTC_BASE, GPIO_PIN_4, GPIO_DIR_MODE_OUT);
    while(1)
    {
       GPIOPinWrite(GPIO_PORTC_BASE,PINS,PINS);
       delay(200000);
       GPIOPinWrite(GPIO_PORTC_BASE,PINS,~PINS);
       delay(200000);
    }
  
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -