📄 wait.c
字号:
/*****************************************************************************
* *
* ********** *
* ************ *
* *** *** *
* *** +++ *** *
* *** + + *** *
* *** + CHIPCON CC1010 *
* *** + + *** HAL - Wait *
* *** +++ *** *
* *** *** *
* *********** *
* ********* *
* *
*****************************************************************************
* *
*****************************************************************************
* Author: ROH *
*****************************************************************************
* Revision history: *
* *
* $Log: Wait.c,v $
* Revision 1.4 2004/01/08 19:21:46 tos
* Reverted to "old" algorithm constant.
*
* Revision 1.3 2003/08/11 15:02:39 tos
* Corrected reentrant usage in library: reentrant only if using large memory model.
*
* Revision 1.2 2003/07/29 11:25:33 tos
* Made halWait() and halConfigTimer23() reentrant.
*
* Revision 1.1 2002/10/14 13:04:37 tos
* Initial version in CVS.
*
* *
****************************************************************************/
#include <chipcon/hal.h>
//----------------------------------------------------------------------------
// byte* halWait(...)
//
// Description:
// A wait functions which performs a number of iterations of a simple
// wait loop, so that at least _timeOut_ ms goes by before the
// function returns.
//
// Arguments:
// byte timeOut
// The time to wait in ms.
// word clkFreq
// The XOSC clock frequency in kHz.
//
// Return value:
// void
//----------------------------------------------------------------------------
#if (__MODEL__ == 0) // Memory model: 0 = SMALL, 1 = COMPACT, 2 = LARGE
void halWait(byte timeOut, word clkFreq) {
#else
void halWait(byte timeOut, word clkFreq) reentrant {
#endif
ulong wait;
wait=(ulong)timeOut*(ulong)clkFreq/192;
while (wait--);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -