LabVIEW

cancel
Showing results for
Did you mean:

Solved!
Go to solution

Decimal to binary two's complement

Hello!

I want to convert a decimal number (from -32768 to 32767) into a 16 bits Binary two's complement.

Any suggestion?

Message 1 of 7
(746 Views)

Re: Decimal to binary two's complement

What is the datatype of the "decimal number"? A I16 numeric integer? A decimal string?

What output do you want? (binary string? I16 numeric?) What is the byte order?

It always helps to attach a small VI containing your input in a diagram constant to avoid ambiguities. Thanks!

LabVIEW Champion. It all comes together in GCentral
What does "Engineering Redefined" mean??
Message 2 of 7
(737 Views)

Re: Decimal to binary two's complement

Hi,

I have a dac714 which is designed to accept binary two’s complement input codes with the MSB first. The output voltage range I want to obtain is ±5 V. What I am doing is to convert voltage values (DBL control, so that the user can select the desired voltage) into decimal values from -32768 to 32767 (DBL). What i want to get is a 1D array of boolean that goes in a digital output of my  usb 6211 and then into the dac.

I hope I was clear.

(I don't attach my VI because this is a small part of a very crowded one, I try to simplify it and attach later a simpler version)

Thank you

Message 3 of 7
(713 Views)

Re: Decimal to binary two's complement

Here is a simpler version of what I did so far. The conversion here is from digital to binary, what I wish is from digital to binary two's complement.

Message 4 of 7
(703 Views)
Solution
Accepted by topic author Giulia30

Re: Decimal to binary two's complement

Your code makes absolutely no sense.

Maybe this can give you some ideas.

LabVIEW Champion. It all comes together in GCentral
What does "Engineering Redefined" mean??
Message 5 of 7
(690 Views)

Thank you.

Message 6 of 7
(679 Views)

Re: Decimal to binary two's complement

@Giulia30 wrote:

What i want to get is a 1D array of boolean that goes in a digital output of my  usb 6211 and then into the dac.

Stupid question: Why not just use an Analog Output on the USB-6211?  Or is the DAC714 the UUT?

There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 7 of 7
(601 Views)