05-05-2009 12:04 PM
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
05-05-2009 12:06 PM
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.
05-05-2009 12:07 PM
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..
05-05-2009 12:17 PM - edited 05-05-2009 12:17 PM
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
05-05-2009 12:26 PM
05-05-2009 12:30 PM - edited 05-05-2009 12:31 PM
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
)
Again, have fun!
Ben
* you will probably want to use a SGL as well.
05-05-2009 12:37 PM
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).
05-05-2009 12:40 PM
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.
05-05-2009 02:03 PM
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!