rfid_bcd.c
来自「找的一个用U2270B开发的射频卡项目文件」· C语言 代码 · 共 38 行
C
38 行
// $Id: rfid_Bcd.c,v 1.1 2006/09/25 22:08:15 tprescott Exp $
/***************************************************************************
Project : rfid_Bcd.c
Date : 9/08/2006
Author : Toby Prescott
Company : Atmel
Comments: AVR Studio GCC
Revisions:
v1.0 - Started written for CodeVision
v2.6 - Clean for WinAVR
***************************************************************************/
#include "rfid_Bcd.h"
/*****************************************************************************
* Function name : CHAR2BCD2
* Purpose : Convert a character into a BCD encoded character.
* The input must be in the range 0 to 99.
* The result is byte where the high and low nibbles
* contain the tens and ones of the input.
*****************************************************************************/
char bcd_CHAR2BCD2(char input)
{
char high = 0;
while (input >= 10) // Count tens
{
high++;
input -= 10;
}
return (high << 4) | input; // Add ones and return answer
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?