main.c

来自「最新版IAR FOR ARM(EWARM)5.11中的代码例子」· C语言 代码 · 共 63 行

C
63
字号
/*************************************************************************
 *
 *    Used with ICCARM and AARM.
 *
 *    (c) Copyright IAR Systems 2006
 *
 *    File name   : main.c
 *    Description : Define main module
 *
 *    History :
 *    1. Date        : 7 Feb. 2006
 *       Author      : Stanimir Bonev
 *       Description : Create
 *
 *  This example project shows how to use the IAR Embedded Workbench for ARM
 * to develop code for the Freescale MXL ADS evaluation board based on
 * MC9328MXL. It shows basic use of I/O, timer and the interrupt controller.
 *  It blinks the LEDs PA2 and PA23.
 *
 *    $Revision: 13146 $
**************************************************************************/
#include "includes.h"

#define LED_PA2           (1UL<<2)
#define LED_PA23          (1UL<<23)

Int32U Gpt1Counter = 0;

/*************************************************************************
 * Function Name: Gpt2_Handler
 * Parameters: none
 *
 * Return: none
 *
 * Description: GPT2 interrupt handler
 *
 *************************************************************************/
void Gpt2_Handler (void)
{
  // Clear interrupt flag
  TSTAT2_bit.COMP = 1;
  ++Gpt1Counter;
}

/*************************************************************************
 * Function Name: main
 * Parameters: none
 *
 * Return: int
 *
 * Description: Main subroutine
 *
 *************************************************************************/
int main(void)
{
Int32U LedState;

  DbgUartPrint ("\n\rEnter in main() section\n\r");

  // GPIO init
  GIUS_A |= LED_PA2 | LED_PA23;   // set PA2, PA23 as GPIO
  DDIR_A |= LED_PA2 | LED_PA23;   // set PA2, PA23 as oputs
  OCR1_A_bit.PIN2 = 3;            // PA2 Output Configuration 

⌨️ 快捷键说明

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