LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

byte conversion

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.

0 Kudos
Message 1 of 3
(2,300 Views)

@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



Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
Message 2 of 3
(2,297 Views)

 


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.

0 Kudos
Message 3 of 3
(2,289 Views)