Converting Hexadecimal Numbers to Decimal Numbers (Base 16 to Base 10)
Occaisioally, CNC repairs or related work will require that you convert numbers from one format (or base) to another. This may required to set parameter data on a Fanuc CNC control. I had a machine tool repair job a few weeks ago, where I was trying to see the signal strength of an analog sensor in the PMC ladder display. The analog signal was input to an A/D (analog to digital) converter, and displayed in hexadecimal on the ladder display screen.
If you need to do these operations, you can use a number of different resources available online. For example, you could do a Google search for “hexadecimal to decimal conversion” and you will find sites that have converters that allow you to plug in the numbers and the calculations are done automatically. I also have a calculator that can perform these operations.
The thing is, that sometimes you don’t have a calculator or internet access (as was the case with the analog sensor a few weeks back) and these sites are not available to you. Or maybe you would just prefer to know how the calculations are being done. In these circumstances, the following information can help you.
Let’s start with the basics.
In decimal format (or base 10), there are 10 numbers available. These are: 0-1-2-3-4-5-6-7-8-9.
In hexadecimal (or base 16) format, there are no 2 digit numbers (i.e. 10,11,12, etc.). Therefore, these 2 digit numbers are represented by letters.
The 16 available numbers are: 0-1-2-3-4-5-6-7-8-9-A-B-C-D-E-F.
Side by side, it looks like this:
Decimal Hexadecimal
0 0
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 A
11 B
12 C
13 D
14 E
15 F
Hexadecimal to Decimal Conversion Example:
In this example, our base 16 number is: F3A
In order to convert to decimal, we break down the hex number as follows:
Starting with the right-hand digit: A
A in hex = 10 in decimal.
To calculate the value of A, you multiply 10 x (16 to the power of 0). Any number to the 0 power = 1. So,…
A in hex (in the 0 bit) = 10 x 1, or 10 in decimal
Next, we calculate the value for 3.
3 in hex = 3 in decimal.
To calculate the value of 3, you multiply 3 x (16 to the power of 1). Any number multiplied by the power of 1 = the number.
3 in hex (in the 1 bit= 3 x (16 x 1), or 48 in decimal
Next we calculate the value for F.
F in hex = 15 in decimal.
To calculate the value of F, you multiply 15 x (16 to the power of 2, or 16 squared), or 15 x (16 x 16, or 256).
F in hex (in the 2 bit) = 15 x (16 x 16, or 256) = 3840 in decimal
Next you add the values together to find the decimal equivilant.
F3A = 10 + 48 + 3840 = 3898
F3A = 3898
If there were another digit in the 3 bit, (let’s say it’s B), you would wait for the addition until you were done calculating the value of a B in the 3 bit. You would continue multiplying the decimal equivilant of B (11) by 16 to the power of 3, or 11 x (16 x 16 x 16). As you continue moving down the line from the right to the left, you increase the exponent of 16 by 1. After each number in it’s corresponding bit position had been calculated, you would add the totals to get the final decimal answer.
This was a tricky one to try to explain in a blog post. I hope it is understandable.
Check out www.pinpointcnc.com for machine repair information, procedures and other products
Go to www.cncalarm.com for machine alarms and details
Go to www.toyookivalve.blogspot.com for information on Toyooki products
Go to Fanuc Control Central for all Fanuc related posts
Filed Under CNC Repair Tips, Fanuc Control, Pinpoint CNC Repair Home | Leave a Comment
Tagged With convert hex, fanuc, fanuc controls, fanuccontrol, hexadecimal
