//汉子 转 十进制或十六进制


#include "stdio.h"
#include "stdint.h"


uint8_t num=0,OutData[12]={0};
 
void Receive_Convert(uint8_t *p)
{                             
while(*p!='\0') // 如果没有结束
{       
if(*p>0x80)  // 如果是中文
{
OutData[num++]=*p;     // 区码
OutData[num++]=*(p+1);  // 位码
p+=2;
}
else     //如果是英文
{
OutData[num++]=*p;
p++;
}
}
num=0;

/************************************************************************************************/ 
int main(void)
{
uint8_t InData[12]={"串口调试1234"};
Receive_Convert(InData);     //等效于:Receive_Convert("串口调试1234");
return 0; 

}  

中英文 转 十六进制

相关文章:

  • 2022-02-07
  • 2021-12-04
  • 2021-12-14
  • 2021-07-12
  • 2022-01-23
  • 2022-01-06
  • 2022-02-22
  • 2021-07-21
猜你喜欢
  • 2022-01-09
  • 2022-01-07
  • 2021-12-01
  • 2021-09-25
相关资源
相似解决方案