utils.c

来自「arm开发很好的例程」· C语言 代码 · 共 59 行

C
59
字号

#include "bios.h"

/*
void hex2str(UNS8 *buf,UNS8 *data,UNS8 size)
{
	UNS8 i;
	UNS8 temp;
	
	for(i=0;i<size;i++)
	{
		temp = *data;
		if( (temp&0xf0) < 0xa0)
		{
			*buf = ( temp >> 4 ) + 0x30;	
		}
		else
		{
			*buf = 	( temp >> 4 ) + 0x37;
			
		}
		buf++;
		temp &= 0x0f;
		if( temp < 0x09 )
		{
			
			*buf = temp	+0x30;
		}	
		else
		{
			*buf = temp + 0x37;	
			
		}
		buf++;
		data ++;
		
	}	
	
}
*/

void Delay_us(UNS16 count)
{
	UNS16 i;
	for(;count>0;count--)
		for(i=0;i<40;i++);	
	
}


void Delay_ms(UNS16 count)
{
	for(;count>0;count--)
			Delay_us(1000);
}



⌨️ 快捷键说明

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