05-04-2009 12:30 PM
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.
05-04-2009 12:47 PM
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
05-04-2009 01:10 PM
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? 😉
05-04-2009 01:49 PM
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.
05-04-2009 02:30 PM
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"!
05-04-2009 02:35 PM
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???
05-04-2009 02:55 PM - edited 05-04-2009 02:56 PM
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:
Can you show us the specification of the device that is supposed to receive the data?
05-04-2009 03:00 PM
@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.
05-04-2009 03:28 PM
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
05-04-2009 04:30 PM
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?