嵌入式串口传送汉字乱码
arm3358开发板与其他自带单片机的裸机进行串口通信,开发板发送汉字时出现乱码。
问题出在数据定义上:
//unsigned char AT_SCREENOUT[]="sthis is test 1234\r\n";
1、//unsigned char AT_SCREENOUT[]="s测试1234\r\n";
2、//unsigned char AT_SCREENOUT[]={0x73,0xCE,0xDE,0xCE,0xFD,0xCA,0xD0,0xCD,0xAC,0xCF,0xE8,0x52,0x53,0x32,0x33,0x32,0x0D,0x0A};
3、unsigned char AT_SCREENOUT[]={"s无锡市同翔科技有限公司设计的键盘及显示控制板卡RS232硬件接口通讯协议\r\n"};
ret=Screen_out(fd,AT_SCREENOUT);
(1)会出现乱码,其他两种均可以。