📄 verv1.h
字号:
/*******************************************************************************************
Module : UtilV1 -- Utilities Module .
Version : 1.0
Author : K. KARTHIKEYAN , S.R.Labs, Hyd.,India.
All rights reserved with the author.
Description: This module is to handle general utilities.
Any miscallaneous modules can be added in this header.
*******************************************************************************************/
# include <8052.h>
# ifndef __UTIL_V1__
# define __UTIL_V1__
/* ***************************************************************************Prototypes* */
void DisplayVersion();
void ToAsciiDecimal(unsigned char ucValue, unsigned char *ucAscii);
void ToAsciiHex(unsigned char ucValue, unsigned char *ucAscii);
/* ************************************************************************************** */
void DisplayVersion()
{
LcdInit();
LcdPuts("FingrPrint based");
LcdCmd(NEW_LINE);
LcdPuts("Access Control.");
}
/* ************************************************************************************** */
void ToAsciiDecimal(unsigned char ucValue, unsigned char *ucAscii)
{
unsigned char ucNum,ucRem;
unsigned char ucCounter = 0,ucTemp1 = 0,ucTemp2 = 0;
unsigned char ucResult[6];
ucNum = ucValue;
while(ucNum > 0)
{
ucRem = ucNum % 10;
ucNum = ucNum / 10;
ucResult[ucCounter] = ucRem;
ucResult[ucCounter] = ucResult[ucCounter] + '0';
ucCounter++;
}
ucTemp2 = ucCounter-1;
for(ucTemp1 = 0; ucTemp1 < ucCounter; ucTemp1++,ucTemp2--)
{
*(ucAscii + ucTemp2) = ucResult[ucTemp1];
}
*(ucAscii + ucTemp1) = 0;
}
/* ************************************************************************************** */
void ToAsciiHex(unsigned char ucValue, unsigned char *ucAscii)
{
unsigned char ch1,ch2;
ucAscii[0] = '0';
ucAscii[1] = 'X';
ch1 = ((ucValue & 0xf0) >> 4);
switch(ch1)
{
case 0x0a:
ucAscii[2] = 'A';
break;
case 0x0b:
ucAscii[2] = 'B';
break;
case 0x0c:
ucAscii[2] = 'C';
break;
case 0x0d:
ucAscii[2] = 'D';
break;
case 0x0e:
ucAscii[2] = 'E';
break;
case 0x0f:
ucAscii[2] = 'F';
break;
default:
ucAscii[2] = (ch1 + '0');
break;
}
ch2 = (ucValue & 0x0f);
switch(ch2)
{
case 0x0a:
ucAscii[3] = 'A';
break;
case 0x0b:
ucAscii[3] = 'B';
break;
case 0x0c:
ucAscii[3] = 'C';
break;
case 0x0d:
ucAscii[3] = 'D';
break;
case 0x0e:
ucAscii[3] = 'E';
break;
case 0x0f:
ucAscii[3] = 'F';
break;
default:
ucAscii[3] = (ch2 + '0');
break;
}
}
/* ************************************************************************************** */
# endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -