📄 tools.c
字号:
/***********************************************************************************
/----------------------Copyright (c) 2005 ~ 2008 Miartech. All Rights Reserved.-----------------------/
/***********************************************************************************
**-----------------------------------------File Info--------------------------------------------
** Last Modified Date: 2008-06-24
** Descriptions: Time Delay Fuctions
**--------------------------------------------------------------------------------------------
** Created By: Kelven
** Created Date: 2007-04-17
**--------------------------------------------------------------------------------------------
** Modified by: Kelven
** Modified date: 2007-09-04
** Version: V4.0.0
** Descriptions:
**--------------------------------------------------------------------------------------------
** Modified by: Kelven
** Modified date: 2008-06-24
** Version: V4.0.1
** Descriptions: Updating Key Configrating Function, Added PLC Chip Register Value Setting Module
***********************************************************************************/
#include "..\inc\Tools.h"
/***********************************************************************************
** Function Name: TOOL_Delay_MS
** Input Parameters:cDelay_Cnt
** Output Parameters:None
** Description:Time Delay Function (Millisecond Level)
***********************************************************************************/
void TOOL_Delay_MS(BYTE cDelay_Cnt)
{
BYTE cForCnt1;
BYTE cForCnt2;
for(cForCnt1 = 0; cForCnt1 < cDelay_Cnt; cForCnt1++)
{
for(cForCnt2 = 0; cForCnt2 < 200; cForCnt2++)
{
_nop_();
_nop_();
}
}
}
/***********************************************************************************
** Function Name: TOOL_Delay_S
** Input Parameters:cDelay_Cnt
** Output Parameters:None
** Implement:Time Delay Function (Microsecond Level)
***********************************************************************************/
void TOOL_Delay_S(BYTE cDelay_Cnt)
{
BYTE cForCnt1;
WORD cForCnt2;
for(cForCnt1 = 0; cForCnt1 < cDelay_Cnt*5; cForCnt1++)
{
for(cForCnt2 = 0; cForCnt2 < 8000; cForCnt2++)
{
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
}
}
}
/***********************************************************************************
** Function Name: Nop_N
** Input Parameters:None
** Output Parameters:None
** Implement:N Nop Time Delay Function (Second Level)
***********************************************************************************/
void TOOL_Nop_N(void)
{
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
}
/***********************************************************************************
** Function Name: PRN_Debug_MSG
** Input Parameters: cmd: 0, print debug message to serial port; other, do not print
** Output Parameters:None
** Implement: print debug message to serial port.
***********************************************************************************/
void PRN_Debug_MSG(unsigned char cmd, const char *format, ...)
{
va_list arg_ptr;
va_start(arg_ptr, format);
if(!cmd)
vprintf(format, arg_ptr);
va_end(arg_ptr);
}
/***********************************************************************************
** End Of File **
***********************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -