delay.c

来自「BC3.1编译,小交换机计费系统.使用Dos做出如此好的界面,少有.」· C语言 代码 · 共 50 行

C
50
字号
#include <dos.h>

#include <def.inc>
#include <func.inc>

extern UL *Tick_cnt_ptr;

/* --------------------------------------------------------------------
	FUNCTION:   Suspends execution for interval.
	CALLS:		None.
	CALLED BY:	This is a General-purposed routine with event flags
				processing inside.
	INPUT:		nticks -- suspending period(Unit: TICKS=55ms).
	OUTPUT:		None.
	RETURN:		None.
   -------------------------------------------------------------------- */
void delay_tick(UI nticks)
{
UL time1;
UI time;

	time1 = *Tick_cnt_ptr;
	time  = (UI) (*Tick_cnt_ptr - time1);
	while ( time<nticks )
	{
		check_event_flag();
		time = (UI) (*Tick_cnt_ptr - time1);
	}
}

/* --------------------------------------------------------------------
	FUNCTION:   Suspends execution for interval.
	CALLS:		delay();
	CALLED BY:	This is a General-purposed routine with event flags
				processing inside.
	INPUT:		n_10ms -- suspending period(Unit: 10ms).
	OUTPUT:		None.
	RETURN:		None.
   -------------------------------------------------------------------- */
void delay_10ms(UI n_10ms)
{
UI loop;

	for (loop=0; loop<n_10ms; loop++)
	{
		check_event_flag();
		delay(10);
	}
}

⌨️ 快捷键说明

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