[ Home ] [ Products ] [ Data Sheets ] [ Support ] [ FAQ ] [ Sales Offices ] [ Request Catalog ] [ Contact duTec ]

The data field of instructions and their responses are in hexadecimal.

 Decimal 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Hexadecimal 0 1 2 3 4 5 6 7 8 9 A B C D E F

The two examples demonstrate the calculations that convert base 16 hexadecimal numbers to decimal and vice versa.

Example 1: Hex-to-Decimal
Decimal = (1st hex digit * 4096) + (2nd hex digit * 256) + (3rd hex digit * 16) + (4th hex digit)

Where each hex digit is the actual decimal equivalent of the hex digit.

Hex in =

0

F

E

D

Decimal Equivalent
| | | |_____ ______

13 * 1 =

13

| | |_____ ______ ______

14 * 16 =

224

| |_____ ______ _____ ______

15 * 256 =

2840

|_____ ______ ______ ______ ______

0 * 4096 =

0

____

4077D

Therefore, 0FEDH = 4077D

Example 2: Decimal-to-Hex

This method works by calculating the most signifcant hex digit first and working down to the least significant hex digit. The formula shown only works for a maximum of four hex digits. Any whole number results are converted to hex and the remainder is carried over to determine the next hex digit.

Decimal in = 4077D

Most significant hex digit:

4077/4096 < 1 therefore the most signifcant hex digit is 0.
0???
and the remainder carried over is: 4077 - (0) * 4096 = 4077

2nd hex digit:

4077/256 = 15+ therefore the 2nd hex digit is F.
0F??
and the remainder carried over is: 4077 - (15) * 256 = 237

3rd hex digit:

237 / 16 = 14+ therefore the 3rd hex digit is E.
0FE?
and the remainder carried over is: 237 - (14) * 16 = 13

4th hex digit:

therefore the least significant digit is 13 = D.

OFEDH is the hex equivalent

[ Home ] [ Products ] [ Data Sheets ] [ Support ] [ FAQ ] [ Sales Offices ] [ Request Catalog ] [ Contact duTec ] 