LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

binary


aznw82 wrote:
reciever is taking, example "11111110" this kind of format.. i can convert it to hex from that.

 

On a fron panel drop a numeric control.

 

Right-click and choose representation >>> U8

 

Right-click it again and choose "Display format" and choose "Binary"

 

You number will now be DISPLAYED as binary.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 31 of 39
(1,624 Views)

aznw82 wrote:
reciever is taking, example "11111110" this kind of format.. i can convert it to hex from that.

I'm sorry to be so blunt, but you're still not getting what we're trying to say. That bit pattern is completely meaningless without a frame of reference. That bit pattern is 0xFE. What does that mean? Does it mean 23V? 2.3V? 230000V?  At the very least it's missing 1 byte since the page you posted indicates that 2 bytes are used for a voltage/current. 

0 Kudos
Message 32 of 39
(1,620 Views)

yes, i can do that part. what i can't convert right is the decimal point value.

convert "24.8" ----> "11111110".. i need to decimal point to be in..

0 Kudos
Message 33 of 39
(1,618 Views)

aznw82 wrote:

yes, i can do that part. what i can't convert right is the decimal point value.

convert "24.8" ----> "11111110".. i need to decimal point to be in..


 

I'll assume that was pointed at my post.

 

THe decimal place indicates this is a floating point value so how about using the type cast to cast it from floating point to a U32?

 

 

The spec for what you are talking to should help YOU figure out if you have to swap bytes etc.

 

Have fun!

 

Ben

Message Edited by Ben on 05-05-2009 12:17 PM
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 34 of 39
(1,608 Views)
can i change it to U16 instead for the constant & indicator? would my value be different?
0 Kudos
Message 35 of 39
(1,600 Views)

Yes*!

 

Please try it for yourself.

 

Everyone on this forum that has a yellow/gold under their name are voluteers that started out asking questions and experimenting doing stuff just like that.

 

Try it out, watch it execution highlighting and ask Q when you get stuck. Most of us are willing to help but can NOT develop code on demand (unless there is a purchase order in place Smiley Wink )

 

Again, have fun!

 

Ben

 

* you will probably want to use a SGL as well.

Message Edited by Ben on 05-05-2009 12:31 PM
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 36 of 39
(1,594 Views)

Just happened to run across this thread, I think I can help.  This is a common problem in the CAN world when you have incomplete documentation. We are missing the defined scaling and offset needed to calculate how to get from the Byte (or "Binary" as has been mentioned in this thread) to the floating point number.  In the CAN industry, we call this the "Frame" to "Signal" or "channel" conversion data.

 

Here's some more insight. The data sheet is from a CAN bus message found on a SAE J1939 network.  The use of the terms "PGN" are what tipped me off to this.  J1939 standardizes a lot of these conversion factors, which is why it's not detailed here, and this particular battery management system extends that format, assuming you already know how to scale data using the SAE Proprietary B Parameter Group.  This is detailed in the SAE J1939-21 specification. 

 

Unfortunately, it looks like you need the next page of the document you posted earlier to know the proper answer of what those "Signal Types" are it refers to since this is a proprietary message used for this particular battery controller.  Go back to whoever provided you that data sheet and request the "Resolution" and "Data Range" of the signals you're interested in, then you can perform a successful conversion.  If you have the device present, you may be able to reverse engineer this scaling by putting known values in and manually calculating and guessing the floating point values. 

 

What hardware are you using to communicate with the CAN network?  If it's a NI CAN interface, getting those bytes out is pretty straightfowrad using the Frame or Channel APIs (if you're using a Series 2 CAN card there). 

 

--Paul Mandeltort
Automotive and Industrial Communications Product Marketing
Message 37 of 39
(1,579 Views)

i'm using the Ni usb to can hardware. that will send out Can message to the receiver. all i know from the receiver side is they only accept "0101011" format.

 

0 Kudos
Message 38 of 39
(1,574 Views)

Hello,

 

Like I mentioned earlier, your receiver is a SAE J1939 compliant device  using a custom message defined in that document you sent us. While the techniques were clearly discussed in this thread already, you'll need to find out what the scaling, offset and range are to get the data into the binary format you need. There are only two ways to do this that unfortunately nobody in this forum can help you with: 

1) Locate the remainder of the incomplete documentation you posted

2) Experimentally reverse engineer the scaling, offset, and range of the data. 

 

Good luck!

--Paul Mandeltort
Automotive and Industrial Communications Product Marketing
Message 39 of 39
(1,550 Views)