Skip to main content
25 events
when toggle format what by license comment
Apr 16, 2018 at 6:56 comment added Lundin What CAN protocol is this? What's the format? What does those bytes mean? Unless you state this, the question cannot simply be answered. It doesn't look like any common standard.
Apr 16, 2018 at 6:46 comment added Lundin "As far as I know, typically, data in CAN messages follow this format: one byte for the actual data, one byte for the number of overflows. " What on earth are you talking about? From a general CAN perspective, this is complete nonsense. From a standard 2's complement number perspective, this is also complete nonsense. And what's this obsession with overflows to begin with? What makes you think there are any overflows at all?
Apr 15, 2018 at 21:12 answer added gbarry timeline score: 0
Apr 15, 2018 at 6:06 answer added AaronD timeline score: 3
Apr 14, 2018 at 23:19 vote accept Shibalicious
Apr 14, 2018 at 22:00 answer added Henry Crun timeline score: 4
Apr 14, 2018 at 21:43 history tweeted twitter.com/StackElectronix/status/985272338190143488
Apr 14, 2018 at 21:25 comment added user57037 Overflow is what you get when the magnitude of the numerical result is too large for the data type of the variable where the result is supposed to be stored.
Apr 14, 2018 at 20:58 comment added Davislor @hypomania Overflows are what you get when you add two numbers and get a carry.
Apr 14, 2018 at 19:06 answer added Adam Haun timeline score: 16
Apr 14, 2018 at 18:55 answer added user57037 timeline score: 4
Apr 14, 2018 at 18:51 answer added brhans timeline score: 5
Apr 14, 2018 at 18:46 comment added Shibalicious @IgnacioVazquez-Abrams, thank you for that, that actually makes a lot of sense. I don't know where I got the idea of overflows from, must have confused it with something else!
Apr 14, 2018 at 18:45 comment added Shibalicious @mkeith sure, they are in binary. Everything in the physical layer is done in binary.. The data I have is in an Excel file, which was pulled from a script which represented the data in hex. My question more about interpreting the bytes in the message representing the physical value. As Ignacio has mentioned, it could be two bytes representing higher and lower halves on a 16 bit value, my initial guess was that one byte is used for overflow count whereas the other byte is used for lower half. Also, sorry for misinterpreting your question.
Apr 14, 2018 at 18:44 comment added Ignacio Vazquez-Abrams It is never done with overflows. It is a single number.
Apr 14, 2018 at 18:37 comment added user57037 No offense, but the whole question does not inspire confidence in me that you know what you are talking about. My suspicion continues to be that the values passed to you are actually binary and not hex. You are displaying them in hex because they can't be displayed in binary format since the binary is not printable. Your question is about how to manipulate single byte binary data into a correct signed integer two bytes wide.
Apr 14, 2018 at 18:37 comment added Shibalicious @IgnacioVazquez-Abrams, I am aware of that. It's a little-endian system by the way. So that would be byte 2 is LH, byte 3 is UH? Is it not typically done with overflows instead? For example, byte 3 is your data, and when it overflows the value in byte 2 would be incremented?
Apr 14, 2018 at 18:32 comment added Ignacio Vazquez-Abrams "Lower" and "higher" depends on the endianness of the data, but you (for instance) don't have 0x12 0x34, you have 0x1234.
Apr 14, 2018 at 18:29 comment added Shibalicious @IgnacioVazquez-Abrams, not 100% sure what you are trying to say.. Do you mean that instead of overflows we have byte 3 which is the higher 8 bits of the 16 bit value, whereas byte 2 is the lower 8 bits?
Apr 14, 2018 at 18:27 comment added Shibalicious @mkeith, if you look at my short example segment, it's clearly in hex. Bytes 2 and 3 together represent a single 16 bit int value. I just want to know how to do that correctly.
Apr 14, 2018 at 18:25 history edited Shibalicious CC BY-SA 3.0
edited body
Apr 14, 2018 at 18:21 comment added Ignacio Vazquez-Abrams "Overflows" are only considered over the entire value range for the word size. Higher bytes within the same word are just that, higher bytes.
Apr 14, 2018 at 18:20 comment added user57037 Are they in binary or hex? Hex is a technique for representing binary data using printable characters. Are you receiving a text message that needs to be converted from hex to binary, or are you receiving the raw binary data?
Apr 14, 2018 at 17:56 history edited Shibalicious CC BY-SA 3.0
Added one more point
Apr 14, 2018 at 17:50 history asked Shibalicious CC BY-SA 3.0