05-02-2011 10:59 AM
I'm trying to send the number -8 in decimal (i8 representation) to an external device using visa write. However, when I use the typecast function to convert -8 to a hex string, it converts it to the unsigned equivalent which is F8 in hex and 248 in decimal.
Any way around this happening?
p.s. I posted this question a few days ago in the biobench section by mistake so sorry mods if this isn't allowed but I thought it would be moved to the LabVIEW section.
05-02-2011 11:03 AM
@Strokes wrote:
I'm trying to send the number -8 in decimal (i8 representation) to an external device using visa write. However, when I use the typecast function to convert -8 to a hex string, it converts it to the unsigned equivalent which is F8 in hex and 248 in decimal.
Any way around this happening?
p.s. I posted this question a few days ago in the biobench section by mistake so sorry mods if this isn't allowed but I thought it would be moved to the LabVIEW section.
And what number (in hex) did you expect to see ;).
Take a look here http://en.wikipedia.org/wiki/Two's_complement
05-02-2011 11:59 AM
Coq Rouge wrote:
And what number (in hex) did you expect to see ;).
Take a look here http://en.wikipedia.org/wiki/Two's_complement
Good question, here was me thinking I'd never need to understand two's complement when I was studying it... Thanks for the input, I'll have a look at the wiki page and hopefully the solution should be straight forward enough from there.