I am writing some code to talk to a device via a serial port. I am testing my program by using a loopback, so I can see that what I send is correct.
I am sending an unsigned hex array, and when I display the values (before they are sent), they are fine. However, when the array comes back, values over 7F (127) are not correct. For instance, if I send FA (which is 250), it comes back as 7A (122). But if I send 7A, it comes back as 7A so there is no way to differentiate.
I tried using a regular array (e.g. not specifying signed/unsigned) and values over 7F are negative (which would be fine, I can just add 256) but then it also comes back as 7A (122).
Any idea why this is? I am new to C so please excuse me if this is some simple and fundamental part of arrays or hex in C that I am unaware of.
Regards,
Scott