03-19-2010 02:04 PM
Hi all,
Supose that I am doing a VISA read, and the result that I expect to get is A602000000A8 in hex. However, since I am doing a VISA read, I am going to get the Ascii equivalent of that hex. I know how to convert the Ascii into hex, so that's not the problem. Let me give you an example (see attachment).
If I expect to get A9 in hex back from the read, I should be reading \n\t from VISA read. When I do the conversion, instead of getting A9, I get 0A09. This is due to the fact that ASCII is 8 bits. However, since I am expecting a Hex number, all I care about is 0-F in hex. In another word, I only need 4 bits.
In summary, how do you convert \n\t in string to A9 in hex (not 0A09).
Yik
Solved! Go to Solution.
03-19-2010 02:18 PM
NO,NO,NO. You are not getting the 'ASCII' equivalent of hex. You are getting bytes that you choose to display as ASCII or Hex. VISA does not convert anything to anything. It just reads whatever is sent. Each
Hex A9 is not \r\t. Hex A9 is a single byte (8 bits!). A \n\t is two bytes (16 bits). Just right click on your string indicator and select 'Hex Display'.
03-19-2010 03:10 PM
Hi Dennis,
If I am supposed to read A602000000A8 in hex from VISA read, which is "displayed" as a string, and I want to process it so that at the end, I only get the first two hex number (number format), which is A6. What is the best way of doing this? Thanks!
Yik
03-19-2010 03:20 PM
03-19-2010 03:45 PM
You are right. I got confused for no reason. Thank you!
Yik