#include <reg52.h>
#define uchar unsigned char
void htoa(char *str,uchar num) { uchar tmp,tab_char[3];
tmp=num;
tmp=tmp&0xf0;
tmp>>=4;
*str=tab_char[tmp];
str++;
*str=tab_char[num&0x0f];
}
void main()
{ uchar tab_char[]={0x03,0x05,0x06};
htoa(tab_char,3);
}
|