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

📄 timer.c

📁 EP9315的wince下载程序。download.exe
💻 C
字号:
//****************************************************************************
//
// timer.c - Routines dealing with the timer.
//
// Copyright (c) 2005 Cirrus Logic, Inc.
//
//****************************************************************************
#include "ep93xx.h"
#include "timer.h"

//****************************************************************************
//
// Enable the debug timer for delayr.
//
//****************************************************************************
void enable_debugtimer()
{
    volatile unsigned long * tim_debugvaluehigh= (volatile unsigned long *)TIM_DEBUGVALUEHIGH;
    
    *tim_debugvaluehigh |= 0x100;
}

//****************************************************************************
//
// Delay a certain number of millisecond.
//
//****************************************************************************
void delay_msec(int ms)
{
    delay_usec(ms*1000);
}


//****************************************************************************
//
// Delay a certain number of microseconds.
//
//****************************************************************************
void delay_usec(int us)
{
    unsigned long passed, starttime;
    volatile unsigned long * tim_debugvaluelow = (volatile unsigned long *)TIM_DEBUGVALUELOW;

    starttime= *tim_debugvaluelow;
    passed=0;
    while ( passed < us) 
    {
       passed = (*tim_debugvaluelow - starttime);
    }
}

⌨️ 快捷键说明

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