FoxProProgrammer
Programmer
I have an array that contains a char that represents a hex number. The array might look like the following:
stimByte[0][0] = "13"
stimByte[0][1] = "FB"
stimByte[1][0] = "FC"
stimByte[1][1] = "53"
The hex data is:
0x13FB
0xFC53
I need to convert the char array to hex data.
I tried the following:
val[n] = stimByte[n][0] << 8;
val[n] += stimByte[n][1];
Here's what happens when n = 0.
val[0] = stimByte[0][0] << 8 = 1300 (so far so good)
val[0] +- stimByte[0][1] = 12FB
I don't understand why it calculates 12FB. I get 13FB when I add the numbers manually. Any suggestions?
Thanks!
dz
stimByte[0][0] = "13"
stimByte[0][1] = "FB"
stimByte[1][0] = "FC"
stimByte[1][1] = "53"
The hex data is:
0x13FB
0xFC53
I need to convert the char array to hex data.
I tried the following:
val[n] = stimByte[n][0] << 8;
val[n] += stimByte[n][1];
Here's what happens when n = 0.
val[0] = stimByte[0][0] << 8 = 1300 (so far so good)
val[0] +- stimByte[0][1] = 12FB
I don't understand why it calculates 12FB. I get 13FB when I add the numbers manually. Any suggestions?
Thanks!
dz