ÐèÇ󣺿ª·¢¹ý³ÌÖÐÓÈÆäÊÇÓöµ½¿ª·¢ÐÒéµ÷ÊÔʱ£¬¾³£»áÓö¼ûÐèÒª½«ÐÒéÊý¾Ý´òÓ¡³öÀ´£¬ÕâʱÈç¹û´®¿ÚÔÚHEXģʽÏÂÏÔʾÔò»á¹Û²ì²»Çå³þÄÄЩʵ¼ÊÊÇÎÒÃÇÒª¿´µÄÊý¾Ý£¬´Ëʱ¾ÍÐèÔÚÎı¾Ä£Ê½Ï°ÑHEXÖµ´òÓ¡³öÀ´·½±ã¹Û²ì£¬ÒÔÏÂÌṩ´®¿Ú¹¤¾ßÔÚÎı¾Ä£Ê½ÏµĴ®¿Ú´òÓ¡HEXÎļþϵÄʵÏÖ·½·¨¡£
uint8 ASCIITAB_MAX[16] = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
uint8 ASCIITAB_MIN[16] = {'0','1','2','3','4','5','6','7','8','9','a','b','c','c','c','f'};
/****************************************************************
º¯ÊýÃû: void PCTxByte(uint8 data)
²Î Êý: uint8 data
¹¦ ÄÜ: USART1·¢ËÍÒ»¸ö×Ö½Ú
·µ»ØÖµ: ÎÞ
×÷ Õß: chenbin
ʱ ¼ä: 2017Äê3ÔÂ8ÈÕ23:02:14
*****************************************************************/
void PCTxByte(uint8 data)
{
while(!(USART1->SR &(0X01<<7)));
USART1->DR = data;
}
/****************************************************************
º¯ÊýÃû: void PCTx16Hex(uint8 *Txbuf,uint16 len)
²Î Êý: uint8 *Txbuf:Êý¾ÝÆðʼµØÖ· uint16 len:·¢Ëͳ¤¶È
¹¦ ÄÜ: USART1·¢ËÍ16½øÖÆÊý¾Ý
·µ»ØÖµ: ÎÞ
×÷ Õß: chenbin
ʱ ¼ä: 2017Äê3ÔÂ8ÈÕ23:08:38
*****************************************************************/
void PCTx16Hex(uint8 *Txbuf,uint16 len)
{
uint8 i;
for(i=0;i<len;i++)
{
PCTxByte(ASCIITAB_MAX[((*(Txbuf+i)&0XF0) >>4)]);
PCTxByte(ASCIITAB_MAX[(*(Txbuf+i)&0X0F)]);
PCTxByte(' ');//¿Õ¸ñ
}
}