myfunclib.c

来自「51单片机控制wavecom24系列模块的GPRS传输的C源程序」· C语言 代码 · 共 54 行

C
54 行
字号
#include "myfunclib.h"

/*****************************************************
description:
  copy m characters from *dest to sorce[n]~sorce[n+m-1]
  n is the startPointer in sorce
  m is the startpointer in dest
  l is the length of string which will be copied
  no returm value
/****************************************************/
void mymemncpy(unsigned char *dest,unsigned char n,
	  unsigned char *source,unsigned char m,unsigned l)
{
	unsigned char data j,Dp,Sp;

	for(j=0;j<l;j++)
	{
    	Dp=(n+j)&0xff;
		Sp=(m+j)&0xff;
		dest[Dp]=source[Sp];
	}
}
//============================================================================
unsigned char mymemcmp(unsigned char *s,unsigned char p,	//OK: return 0; False:return 1
	unsigned char *d,unsigned char l)
{
    unsigned char xdata m,n;
    for(m=0;m<l;m++)
    { n=(p+m)&0xff;
      if(s[n]!=d[m]) return d[m]-s[n];}
    return 0;
}

void DelaySecond(WORD ds)
{	
	WORD xdata i;
	for(;ds;ds--)
	{
		for(i=0;i<10;i++)
		{
			Delay10ms();
		}
	}
}
void Delay10ms()
{
   WORD xdata i;
   for(i=0;i<10000;i++);
} 	

	


⌨️ 快捷键说明

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