LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Digital to Binary conversion!

Solved!
Go to solution
Highlighted

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.

0 Kudos
Message 1 of 14
(1,888 Views)
Highlighted

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?


GCentral
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
0 Kudos
Message 2 of 14
(1,884 Views)
Highlighted
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?
0 Kudos
Message 3 of 14
(1,883 Views)
Highlighted
Stupid auto-correct. Embassy should be What.
0 Kudos
Message 4 of 14
(1,882 Views)
Highlighted

@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. 

0 Kudos
Message 5 of 14
(1,859 Views)
Highlighted

Hello,

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

Thank you.

0 Kudos
Message 6 of 14
(1,858 Views)
Highlighted

Hello,

Sorry for the wrong board.

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

Thank you.

0 Kudos
Message 7 of 14
(1,857 Views)
Highlighted
Solution
Accepted by topic author Mohit1991

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.


GCentral
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,855 Views)
Highlighted

Hello,

Yes I am using LabVIEW. I will try this. 

Thank you.

0 Kudos
Message 9 of 14
(1,852 Views)
Highlighted

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.

 

 

 

 

0 Kudos
Message 10 of 14
(1,846 Views)