c# read serial in hex

If the data is coming as a string then it’s simple as:

string inputData = "AA C0 D4 04 3A 0A A1 60 1D AB";
var inputDataSplit = inputData.Split(' ');
// Concatenate the fourth and the third string, and convert it to integer with base 16 (hex)
int pmValue = Convert.ToInt32(inputDataSplit[3] + inputDataSplit[2], 16);
        
// 1236
Console.Write(pmValue);

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top