# LabVIEW

cancel
Showing results for
Did you mean:

Solved!
Go to solution

## Digital to Binary conversion!

Hello,

I want to input 22 byte array string to VISA write to control one instrument. I want every byte in not more than 8 bits and some of the bytes in array are the binary 8 bits of some decimal to binary conversion. eg. Machining time is 180,000 milliseconds which converts to Binary in 3 sets of 8 bytes. I want to make 3 seperate bits (high, middle and low) out of it. Maximum value conversion I am getting is 8 bit which is 255. How to divide numbers greater than 255 to seperate 8 bit bytes for one single decimal value?

Thank you.

Message 1 of 14
(1,981 Views)

## Re: Digital to Binary conversion!

First of all, you seem really confused about some basic terminology.  A bit is a binary value (0 or 1).  8 bits make up a byte.

So what exactly is the protocol you are trying to implement?  What are the 22 bytes that you have to send?

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 2 of 14
(1,977 Views)

## Re: Digital to Binary conversion!

You posted to the wrong board. Please click on Options and request the moderator to move this from the Digital I/O board to the appropriate language board (LabVIEW?)

Please provide some additional details. Embassy is the significance of the time. Do you mean bytes instead of bits? Where are these decimal numbers coming from?
Message 3 of 14
(1,976 Views)

## Re: Digital to Binary conversion!

Stupid auto-correct. Embassy should be What.
Message 4 of 14
(1,975 Views)

## Re: Digital to Binary conversion!

@crossrulz wrote:

First of all, you seem really confused about some basic terminology.  A bit is a binary value (0 or 1).  8 bits make up a byte.

So what exactly is the protocol you are trying to implement?  What are the 22 bytes that you have to send?

Hello,

Sorry for the confusion.

I have one power supply which has to supplied by 22 byte array as an input. Those 22 bytes have their own significance. eg. Frequency, pulse on time, temperature limit. etc. Some of the bytes are high, medium and low bytes of a single 24 bit binary value. Now suppose I have a decimal number to convert into binary, I know that logic. But if I get a binary value which is say 24 bits, how can I seperate that into 3 individual sets of 8 bits?

Thank you.

Message 5 of 14
(1,952 Views)

## Re: Digital to Binary conversion!

Hello,

Those decimal numbers are user inputs. Voltage, Temperature Limit, Pulse frequency etc.

Thank you.

Message 6 of 14
(1,951 Views)

## Re: Digital to Binary conversion!

Hello,

Sorry for the wrong board.

I have asked the moderator to take me to appropriate location.

Thank you.

Message 7 of 14
(1,950 Views)
Solution
Accepted by Mohit1991

## Re: Digital to Binary conversion!

Well, if you have 24 bits, you have to go up to the next largest data type.  In this case, that would be an U32.  You can use the Slit Number and then Build Array to make sure the bytes go where you want them to.  This is assuming you are using LabVIEW.

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 8 of 14
(1,948 Views)

## Re: Digital to Binary conversion!

Hello,

Yes I am using LabVIEW. I will try this.

Thank you.

Message 9 of 14
(1,945 Views)

## Re: Digital to Binary conversion!

Hello,

Thank you. That works. I have one more question.

Is there a way in LabVIEW to read the value from Indicator and use it as an input for other functions or controls?

Thank you.

Message 10 of 14
(1,939 Views)