⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 general.c.bak

📁 MSP430系列单片机 是c语言原码
💻 BAK
字号:
/****************************************************************************
Filename:general.c
programmer:zhang chen
Description:通用子程序库

内容:
	DelayMs:延时ms毫秒
   ToBCD:将一个整数转换为BCD码

版本变更:
		2003年10月11日   1.0
*****************************************************************************/
#include "general.h"

/**************************************************************************
延时
ms:延时的毫秒数
***************************************************************************/
void DelayMs(unsigned int ms)
{
	unsigned int iq0, iq1;
	for (iq0 = ms; iq0 > 0; iq0--)
	for (iq1 = LOOPCNT; iq1 > 0; iq1--)
	;
}

/**************************************************************************
将一个无符号整数转换为BCD码
shu:要转换的无符号整数
pdst:指向转化完成后保存的数组的首地址,*pdest放最高位, *(pdest+3)放最低位
***************************************************************************/
void ToBCD(unsigned int shu,unsigned char *pdst)
{
	unsigned int iq1;

	*pdst=shu/1000;
	iq1=shu%1000;
	pdst++;
	*pdst=iq1/100;
	iq1=iq1%100;
	pdst++;
	*pdst=iq1/10;
	pdst++;
	*pdst=iq1%10;
}

⌨️ 快捷键说明

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