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

📄 timertst.c

📁 arm嵌入式开发实例
💻 C
字号:
/**************************************************************************************************
 *                                                                          
 * Copyright (c) 2001 - 2003 Winbond Electronics Corp. All rights reserved.      
 *                                                                         
 * FILENAME
 *     timertst.c
 *
 * VERSION  
 *     1.0
 *
 * DESCRIPTION
 *     This file contains the main routine for timer test.
 *
 * DATA STRUCTURES
 *     None
 *
 * FUNCTIONS
 *     1. main()
 *
 * HISTORY
 *     04/14/2003		 Ver 1.0 Created by PC30 MNCheng
 *
 * REMARK
 *     None
 *     
 *************************************************************************************************/
#include <stdio.h>
#include "740defs.h"

#define  TIMER_CHANNEL   1  //Timer channel 1

int main()
{
  volatile uint32 btime;
  uint32   oldvect;
  int      temp;
	  
  UART_printf("\n\nW90N740 DIAG Program 1.0 - UART/TIMER/AIC\n\n");

  /* clear CPSR I bit */
  __asm
  {
      MRS    temp, CPSR
      AND    temp, temp, 0x7F
      MSR    CPSR_c, temp
  }

  /* replace IRQ exception entry */
   oldvect = *(volatile unsigned int *)0x38;
   *(volatile unsigned int *)0x38 = (unsigned int) IRQ_IntHandler;

  TimerInitialize(TIMER_CHANNEL);

  btime = cur_ticks;
  while(1)
  {
    //UART_printf("cur_ticks = %d\n", cur_ticks);
    if ((cur_ticks - btime) >= TICKS_PER_SEC)
    {
       btime = cur_ticks;
       ShowCurTime();       
    } 	
 	
  }

  *(volatile unsigned int *)0x38 = oldvect;
  
  return 0;
}

⌨️ 快捷键说明

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