common.c

来自「1-wire"从机"模拟程序, 不是主机,1-wire的主机模拟程序网上很多.使」· C语言 代码 · 共 95 行

C
95
字号
/*
*********************************************************************************************************
*
* File    : COMMON.C
* Data	  : March 20, 2007
*********************************************************************************************************
*/

#include "hal.h"

/*
*********************************************************************************************************
*                                         HALWAIT
*
* Description      :
* Arguments        :
* Returned Values  : none
* Note(s)/Warnings :
*********************************************************************************************************
*/
/*
#ifdef MCLK_1M       //Pause 10uS
void HalWait(void)
{
    _NOP();
    _NOP();
    _NOP();
    _NOP();
    _NOP();
    _NOP();
    _NOP();
}
#endif*/
/*
*********************************************************************************************************
*                                         PAUSE_10US
*
* Description      :
* Arguments        :
* Returned Values  : none
* Note(s)/Warnings :
*********************************************************************************************************
*/
void Pause_10uS(BYTE delay)
{
	
	while(delay--){
#ifdef MCLK_1M
      _NOP();
      _NOP();
      _NOP();
      _NOP();
      _NOP();
      _NOP();
      _NOP();
#endif
#ifdef MCLK_2M
      _NOP();
      _NOP();
      _NOP();
      _NOP();
      _NOP();
      _NOP();
      _NOP();
	  _NOP();
      _NOP();
      _NOP();
      _NOP();
      _NOP();
      _NOP();
      _NOP();
#endif
	}
}

/*
*********************************************************************************************************
*                                         PAUSE_1MS
*
* Description      :
* Arguments        :
* Returned Values  : none
* Note(s)/Warnings :
*********************************************************************************************************
*/
void Pause_1mS(BYTE delay)
{
  	while(delay--)
    	Pause_10uS(100);
}
//-------------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------------


⌨️ 快捷键说明

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