# Binary and Hex Tables and Illustrations

Dmitriy Analyst Ontario Posted   Latest   Edited

Powers of 2 and 16:

Conversion Table:

Notation:

Convert hex, binary, decimal; signed and unsigned, Online:

onlinetoolz​.​net/computers

Example of Binary to Decimal conversion:

Example of Hex to Decimal conversion:

Example of Byte-by-Byte Hex to Decimal conversion (for two-byte, big endian number):

Signed Integers: 2's complement for 16-bit data:

Standard OBD-II PIDs:

en​.​wikipedia​.​org/wiki/OBD-II_PI…

Note on the first byte of OBD request and response:

Request: mode \$01 to \$0A

Response: to indicate valid response, replace the first ‘0’ in the mode with ‘4’, or, equivalently, set to \$40 + mode.

Example: for mode \$01, calculate \$40+\$01 = 64 (decimal) + 1 (decimal) = 65 (decimal) = \$41

J1979 DA Apr 2021:

sae​.​org/standards/cont…

J1979 DA Apr2002 public reference:

law​.​resource​.​org/pub/us/cfr/ibr…​.​pdf

Standard ASCII:

Extended ASCII:

Most/Least Significant Bits:

Byte Endianness:

Example of Canonical Hex + ASCII Display:

Online Canonical Hex + ASCII Display: hex-works​.​com/eng

Raw Mode 1 and 6 data, ELM327 interface for Subaru EJ25:

>atz

ELM327 v1.3a

>atrv 12.4V

>atsp0 OK

>0100 SEARCHING... 41 00 BE 3F E8 13

>010c 41 0C 00 00

>010c 41 0C 0E 96

>0600 46 00 C0 00 00 01

>063d 00A  0: 46 3D 98 FE 00 69  1: 80 00 0D 8A 00 00 00

>0641 00A  0: 46 41 9B 14 00 1F  1: …

>0671 052  0: 46 71 9E 17 27 12  1: 00 00 29 AD 71 9F 0B  2: …  3: A1 0B …  4: 32 71 B0 17 06 9A 00  5: 5D FF FF 71 B5 0B 01  6: 27 00 31 FF FF 71 B6  7: 0B … FF FF  8: 71 B8 0B 03 7E 00 00  9: 32 C8 71 B9 31 0A 62  A: … BA 31  B: 0B A…

Mode \$06 response format in ELM 327 (received over CAN bus):

46 [ 1-byte MID, 1-byte TID, 1-byte SID, 2-byte Measurement, 2-byte Minimum, 2-byte Maximum]

• MID – look up in SI
• TID – look up in SI
• SID – look up in J1979 DA, Appendix E (pp. 78-94, see link above)
• determine signed or unsigned
• determine scale
• determine offset

Practice questions for Module 1:

1. In one episode of animated science fiction sitcom Futurama, robot Bender runs away when binary number … is shown reflected in a mirror of a haunted castle. Why is that?
2. If PCM replied 41 00 BE 3F E8 13 to ELM327 command 0100, is Coolant Temperature PID available?
3. What is ELM327 command to show Coolant Temperature PID?
4. If the actual coolant temperature is 76 deg Celsius, what do you expect PCM's reply to the previous command be?

Notes for M…

Practice questions for Module 2:

1. Interpret the following hex numbers as 16-bit signed (2's complement) integers:
1. FFFFh
2. 8000h
3. 7FFFh
4. F000h
2. Which 16-bit hex number, if interpreted as 2's complement, corresponds to -10 (decimal)?
3. Which 8-bit hex number, if interpreted as 2's complement, corresponds to -10 (decimal)?
4. For commands discussed during the presentation, reproduce values seen on the scantool (31 Ohm for command 0641, and 0.11 inH20 for command 063d).
5. For response to command 0671 (see above), determine TIDs, SIDs, Measurements, Minimums, Maximums. Are all measurements within valid ranges?

Notes for M…

+4
Thanks
Interesting
Bob Technician
Massachusetts
Bob

Dmitriy, Thanks for the class tonight. The only way I will retain this stuff is to practice it so here's my answers to your questions. I'll put them here for discussion and to see if I got them right. - Bender saw the number … in a mirror so the mirror image would be … Putting that number in the binary converter returns a value of 666. Sign of the devil - Yes coolant pid…

0
Ð Awarded
Dmitriy Analyst
Ontario
Dmitriy

Good job, Bob, you are ready for Module 2! For question 4, what would be the full reply from the PCM? (Bob, I am sure you can answer this one, so why don't someone else gives it a try?)

0
Ð Awarded
Bob Technician
Massachusetts
Bob

Also, in your rpm example isn't the formula 256*A+B/4 or 3584+150=3734 divided by 4 = 933.5 rpm?

0
Ð Awarded
Dmitriy Analyst
Ontario
Dmitriy

This is the formula: diag​.​net/file/f6a9w33bo… ​ The order of calculations matters, you have to compute 256*A+B first, so in the calculator you have to punch in (256*A+B) / 4 I should have mentioned that in the presentation. Thanks for making it better! The final answer is 3734 / 4 = 933.5 rpm, correct.

0
Ð Awarded
Erwin Owner/Technician
Erwin

Is it 41 05 74

0
Ð Awarded
Dmitriy Analyst
Ontario
Dmitriy

This is correct! I have also received a Module 1 question about why the integer value is scaled by 4 to get rpms, and am working on a short video explaining that.

0
Ð Awarded
Dmitriy Analyst
Ontario
Dmitriy

Engine RPM formula video: youtu​.​be/H1EQ0sJKSSY

+1
Ð Awarded
Erwin Owner/Technician
Erwin

Thanks for that explanation. Keep up the good work.

0
Ð Awarded
Bob Technician
Massachusetts
Bob

I have some answers to Module 2 questions. Here goes, - (FFFFh = -1) (8000h = -32768) (7FFFh = 32767) (F000h = -4096) - FFF6 - F6 - 31 ohm = 1F .11 H2O = 6D It's going to take me a little longer for the last question. How are my answers so far? Bob

0
Ð Awarded
Dmitriy Analyst
Ontario
Dmitriy

Looks good so far!

0
Ð Awarded
Richard Technician
New York
Richard

Is there any material or videos explaining this further? I have played with IDE in the past and am now trying my hand at some python i am more interested in the car side of things can bus and eeproms have me interested to say the least

0
Ð Awarded
Dmitriy Analyst
Ontario
Dmitriy

Hi Richard, I’ve prepared a course on these topics, which I keep working on and adding new material; please see links in this post for more details: diag​.​net/msg/m2wgporelz…

0
Ð Awarded