C# reads the string sent by the microcontroller and solves the garbled problem

Publisher:Lihua1314520Latest update time:2018-10-08 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1. MCU code

printf("Start updating firmware...\r\n");

 

2.C# host computer

The received data is stored in the array RevData, length Length

string ReadDataStr = Encoding.GetEncoding("GB2312").GetString(RevData,0 ,Length);

Summary: When converting between arrays and characters, you must pay attention to the encoding type, otherwise you will get garbled characters.


Reference address:C# reads the string sent by the microcontroller and solves the garbled problem

Previous article:SPI four working mode timing diagram
Next article:Design of Commonly Used Driver and Isolation Circuits for Single Chip Microcomputer I/O

Latest Microcontroller Articles
Change More Related Popular Components
Guess you like

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号