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
Brother CNC to PC: RS-232 Communication Using Windows Hyperterminal
Attention: Please read the Terms of Use for this site before proceeding.
The following procedure outlines setting up and using Windows Hyper-terminal to communicate with a Brother CNC Tapping Center. The procedure was written for machines with the Brother A-00 control like the TC-S2A or TC-32A. Window Hyper-terminal can be used as a communication program with brother machines as well as a machine with a Fanuc control. The nice thing about it is that it is available on most any PC with a Windows operating system (although I have not seen it on Windows 7). It can be found under Programs/Accessories/ Communications/ Hyperterminal. So even if you don’t have Procomm or other software, you can still get programs in and out using Hyperterminal.
Brother CNC (A-00 Control) to PC: RS-232 Communication Settings and Procedure
Set the following parameters at the Brother machine control:
1. DATA BANK
2. USER PARAMETER
3. COMMUNICATION
1. SELECT PORT = 0
2. CONNECTION OBJECT =0
3. COMP COM PROTOCOL =0
4. BAUD RATE =5
5. PARITY= 2
6. STOP BIT =0
7. CHARACTER =0
8. RESPONSE MONITORING TIME =60
9. COMMUNICATION TYPE =0
10. DC1 CODE =17
11. DC2 CODE =18
12. DC3 CODE =147
13. DC4 CODE =20
14. DR SIGNAL CHECK= 0
15. ENDING DC3 CODE= 0
16. INVALID DATA= 0
17. TRANS DATA CODE= 0
18. END OF BLOCK =0
19. TV CHECK= 0
20. HEADING OUTPUT= 0
21. RESET IN SLAVE COM= 0
22. RECOVERY TIME OF RESET =0
23. DATA OVERWRITE =1
24. REMOTE OPERATION =0
25. CHECKSUM =0
26. EIA CHARACTER CODE (#) =173
27. EIA CHARACTER CODE (*) =186
28. EIA CHARACTER CODE (=) =194
29. EIA CHARACTER CODE (]) =161
30. EIA CHARACTER CODE (]) =162
To prepare Windows Hyper-Terminal:
At the PC:
Click “START”
Click “PROGRAMS”
Click ACCESSORIES”
Click “COMMUNICATION”
Click “HYPERTERMINAL”
Under “Connection Description”
Name (enter “Brother Communication” for example)
Click OK
Under “Connect To or Phone Number”
“Connect using : COM1″ (or select appropriate)
Click OK
Under “Com Properties”
Select “Port Settings”
Click on “Settings” tab
Bits per second =9600
data bits= 7
Parity =None
Stop bits =1
Flow control =XON/XOFF
Click OK
Hyper-terminal window
Click on “Properties” icon
Click on “Settings” tab
Emulation- select ANSI
Click ASCII setup button
Check all boxes EXCEPT “Append line feeds to incoming line ends”
Click OK
Click OK for Properties window
To send a program from the PC to Brother CNC using Hyper-terminal:
At the PC:
Click Transfer”
Click Send Text File from the drop-down menu
Browse to find the program to send
Click only once on the program file you want to send. Do not click “Open” yet
At the Brother CNC:
EDIT mode
Program Edit Menu
Select “External Program I/O”
Select “Input from PTR”
Type the 4-digit program number
Press “E.STA” button
Back at the PC:
Click “Open” on the selected program file
To send a program from the Brother CNC to PC using Windows Hyper-terminal:
At the PC:
Click “Transfer”
Click “Capture Text”
Type the path name and the file to receive- use a “.TXT” extension
At the Brother CNC:
EDIT mode
“Program Edit” Menu
Select “External Program I/O”
Select “OUTPUT TO PTR”
Select “Program”
Enter the program number to send
Click “Start” on the PC
Press “E.STA” button
After the file has transferred, click “Transfer”, “Capture Text”, and then “Stop”.
End
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 Brother CNC, Communications | Leave a Comment
keep looking »
