LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

binary

i need to convert battery power voltage to binary. does anyone know how to convert it??

for example, i'll be entering 28.08v... trying to convert that number to binary.

not sure about the process fo converting it. 

thanks. 

0 Kudos
Message 1 of 39
(4,395 Views)

aznw82,

 

For what purpose are you trying to convert a number to binary?  For example, do you need to write the value to a digital port(s), or do you need to save it to a binary file?  Please explain more about what you are trying to do, and it will be much easier for people on the forum to help you.

 

Chris M 

0 Kudos
Message 2 of 39
(4,388 Views)

Everything is "binary" internally. Entering your value into a numeric control will do the rest.

 

If you are talking about binary formatted ASCII ouput, that only works for integers directly, but you have a floating point number. Are you possibly looking for FXP?

 

We clearly need much more detail. Can you attach a small example VI showing the desired input and output as default values? 😉

Message 3 of 39
(4,379 Views)

need to convert decimal number to binary and send out the Canbus.

but i dont know how to convert 28.08 to binary and be able to send out to the Canbus.

 

0 Kudos
Message 4 of 39
(4,364 Views)

You still haven't told us the important details.

 

If you want a binary string, you could typecast to the right datatype (SGL or DBL). You might also have to worry about byte order.

 

Why can't you tell us exactly what you mean by "binary"!

0 Kudos
Message 5 of 39
(4,357 Views)

altenbach ,

what kind of detail are you looking for??? i'm not sure what you're asking.

 this is suppose to be just a simple question.

i have put downt all the details.

its a pretty simple format, simulate battery power and trying to convert decimal 28.8v input to binary out then send off to canbus connection.

thats it.. how detail do you want???

0 Kudos
Message 6 of 39
(4,352 Views)

aznw82 wrote: .

 this is suppose to be just a simple question.


 

 

No, it is not, because as I already said, everything in a computer is binary one way or another. We absolutely need an answer to the following questions:

  1. Most likely, the canbus interface want a string. Can you confirm that?
  2. Does the device want little-endian or big-endian?
  3. How many bytes of binary data does it want? Is it SGL, DBL, or FXP?

Can you show us the specification of the device that is supposed to receive the data?

Message Edited by altenbach on 05-04-2009 12:56 PM
Message 7 of 39
(4,337 Views)

@aznw82,

 

Perhaps you are not asking the right question.

 

LabVIEW will display an integer value as decimal, hexadecimal, octal or binary. But your number is not an integer value, it is a floating point. You will have to convert it to an integer first.

 

Robot Happy 

0 Kudos
Message 8 of 39
(4,330 Views)

i wasn't given a lot of the info. all i know is to simulate battery power and send out messages to the canbus.

so, i guess the voltage value is 28.8v which will be DBL.then need to be convert to binary MSB & LSB.

not sure about it accept string value or number value. but, all i know is to convert DBL to MSB & LSB binary

 

0 Kudos
Message 9 of 39
(4,314 Views)

aznw82 wrote:

but, all i know is to convert DBL to MSB & LSB binary


You are throwing around technical terms that have no meaning in this context. You cannot convert a DLB to two bits.

 

A DBL has 64 bits, so if you only want to retain the MSB and LSB, you are irreversibly throwing away most of the data. Please be more specific!

 

I assume you have a VI to communicate with the CAN bus. What is the datatype of the data input?

Message 10 of 39
(4,302 Views)