timer_o.c

来自「TIMER OF FRESCALE MICRO」· C语言 代码 · 共 80 行

C
80
字号
/* Copyright 1999 Delphi Delco Electronics Systems *//* * Purpose: to implement a timer overflow counter for CAPCOM1 timer 0 * * Author: kingdj * Date: Wed Nov 19 15:53:17 EST 1997 * $Header: timer_o.c,v 1.2 98/06/02 11:34:07 kingdj Exp $ *//* include files */#include "interrupt.h"#include "io.h"#include "timer_o.h"/* constants and macros *//* type definitions *//* global variables - initialize here *//* local variables - use static */LOCAL_DATA overflow_timer;/* private function prototypes - use static *//* function definitions *//* Purpose: To handle the overflow of Timer 0. * * Parameters: none *//*@unused@*/LOCAL_FUNC interrupt (T0_TRAP_NUM) void Timer_Overflow(void){  /* IR is cleared automatically when ISR executes */  overflow_timer++;}/* Purpose: To report the (adjusted) timer overflow count * *    The count is adjusted upward if the overflow has occurred since *    the time of the passed in pulse * * Parameters: * * input_time - the captured time */EXPORT_FUNC unsigned WORD Overflow_Adjustment( unsigned WORD input_time ){  if ( (input_time < 0x8000) && (T0IR) )    {      /* Add one more count to overflow timer if timer overflow interrupt       * is pending but not yet serviced.  The "not yet serviced" condition       * is determined by a low input time (less than half of 16 bits) with       * the interrupt request bit set. */      return overflow_timer + 1;    }  else    {      return overflow_timer;    }}/* * $SOURCE: ip_project@flint.iac:01_a4_beetle_ip:timer_o.c $ * $REVISION: 1.4 $ * $AUTHOR: flint.iac:/users/wileyeg/dsds/vwnewhw:wileyeg $ */

⌨️ 快捷键说明

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