EDN Admin
Well-known member
I need some thought input on how I can take my string of HEX values and convert them to ASCII according to the specifications below: A function would be ideal since I need to quickly decode about 250 records all having 20 thresholds to record.
C67FCBC67FBCB7BCCBC6CB7FD0CB7FBCBCBCC6CB
<br/>
Threshold Data: <br/>
<br/>
Right ear data, then left ear data, for each of the following thresholds: 1k/V, 250, 500,
<br/>
1k, 1.5k, 2k, 3k, 4k, 6k, 8k. Each threshold encoded as an 8-bit hex number,
<br/>
transmitted as two ASCII digits (2 chars * 10 frequencies * 2 ears = 40 chars). <br/>
<br/>
The 8-bit hex number: <br/>
bit 7: 1 means threshold set automatically; <br/>
0 means the threshold was set manually. <br/>
bits 0-6: 7F means Not Tested <br/>
7E means No Response <br/>
anything else is Threshold + 10dB: subtract 10 dB to get Threshold. <br/>
e.g., "FE" means NR determined automatically; "23" means 25dB threshold
<br/>
manually set. <br/>
<br/>
<br/>
EXAMPLES (Threshold decoding) <br/>
<br/>
You receive the following pair of ASCII characters indicating a threshold: 2 D (32H, 44H). Combine and
<br/>
convert them into a single hexadecimal number: 2DH. Note that bit 7 is 0, so the threshold was set
<br/>
manually. Subtract 0AH to get threshold: 2DH - 0AH = 23H --> 35 decimal. The threshold is 35 dB,
<br/>
tested manually. <br/>
<br/>
Another example: threshold indicated by received characters B 2 (42H, 32H). Combine and convert:
<br/>
B2H. Bit 7 is set, so the threshold was set manually. Stripping off bit 7 leaves 32H. Subtract 0AH and
<br/>
convert to decimal: 32H - 0AH = 28H --> 40 decimal. The threshold is 40 dB, determined automatically.
<br/>
<br/>
<br/>
View the full article
C67FCBC67FBCB7BCCBC6CB7FD0CB7FBCBCBCC6CB
<br/>
Threshold Data: <br/>
<br/>
Right ear data, then left ear data, for each of the following thresholds: 1k/V, 250, 500,
<br/>
1k, 1.5k, 2k, 3k, 4k, 6k, 8k. Each threshold encoded as an 8-bit hex number,
<br/>
transmitted as two ASCII digits (2 chars * 10 frequencies * 2 ears = 40 chars). <br/>
<br/>
The 8-bit hex number: <br/>
bit 7: 1 means threshold set automatically; <br/>
0 means the threshold was set manually. <br/>
bits 0-6: 7F means Not Tested <br/>
7E means No Response <br/>
anything else is Threshold + 10dB: subtract 10 dB to get Threshold. <br/>
e.g., "FE" means NR determined automatically; "23" means 25dB threshold
<br/>
manually set. <br/>
<br/>
<br/>
EXAMPLES (Threshold decoding) <br/>
<br/>
You receive the following pair of ASCII characters indicating a threshold: 2 D (32H, 44H). Combine and
<br/>
convert them into a single hexadecimal number: 2DH. Note that bit 7 is 0, so the threshold was set
<br/>
manually. Subtract 0AH to get threshold: 2DH - 0AH = 23H --> 35 decimal. The threshold is 35 dB,
<br/>
tested manually. <br/>
<br/>
Another example: threshold indicated by received characters B 2 (42H, 32H). Combine and convert:
<br/>
B2H. Bit 7 is set, so the threshold was set manually. Stripping off bit 7 leaves 32H. Subtract 0AH and
<br/>
convert to decimal: 32H - 0AH = 28H --> 40 decimal. The threshold is 40 dB, determined automatically.
<br/>
<br/>
<br/>
View the full article