Reputation: 23
I am reading data from Serial port on click of a button by using Methods
byte[] query = new byte[8] { 0x01, 0x03, 0x00, 0x00, 0x00, 0x02, 0xC4, 0x0B };
serialPort1.Write(query, 0, query.Length);
incoming = serialPort1.ReadLine();
Textbox1.text=incoming;
I am storing the serially read data in variable Incoming i want this data to be converted in HEX form for further processing
Upvotes: 0
Views: 190
Reputation: 30565
here is an example for Hex conversion
byte[] ba = Encoding.Default.GetBytes(incoming);
var hexString = BitConverter.ToString(ba);
Upvotes: 1