Manufacturing Information Solutions Forum Index Manufacturing Information Solutions
Your Place for Support and Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Outputting Fixture Offset Settings

 
Post new topic   Reply to topic    Manufacturing Information Solutions Forum Index -> G-Code Programming
View previous topic :: View next topic  
Author Message
mistux
Site Admin


Joined: 25 Jun 2004
Posts: 1042
Location: South Bend, Indiana USA

PostPosted: Sun Aug 21, 2005 10:55 pm    Post subject: Outputting Fixture Offset Settings Reply with quote

G-code primer: Outputting Fixture Offset Settings

Programs provided by Steve Legg of Messier-Dowty
Two special commands are used in custom macro B to send data out through the communications port (RS-232c port). One called BPRNT allows the output of alpha-numeric text data and a few special characters, as well as macro variable values formatted as integer numbers with a variable number of significant digits. BPRNT outputs variable numeric data as a combination of 8-bit characters that yield 32-bit binary values. I've seen little use for BPRINT.

DPRNT also allows the the output of alpha-numeric text data and a few special characters, as well as macro variable values, formatted with a variable number of decimal places. DPRNT outputs variable numeric data as text characters. In most applications, DPRINT will be your command of choice for outputting data through the communications port.

If your machine has custom macro B, you can use the DPRNT command any time you want to output information. This command is used, for example, with touch probe-based post-process gauging systems to output the measurements taken by the probe.

In this article, we'll be demonstrating the use of DPRNT for the purpose of outputting fixture offset settings. You may know that Fanuc provides a standard way to output the current values of all tool offset registers (for tool length and cutter radius compensation values). But this action does not include fixture offset registers.

If you have qualified tooling and jobs are often repeated, the values of fixture offsets for those jobs are known, but must still be re-entered each time the job is run. Long proveouts or large batches of parts sometimes have to be interrupted too. Recording, then changing fixture offset values allows operators on a multi-pallet machining centre to readily switch between jobs, proving out new work during the day and afternoon shifts (for example), then running production on another pallet at night. Setup people commonly write these values down somewhere, a practice that leaves room for copying mistakes and information loss. One of the programs we'll be showing outputs a nicely formatted list of all current fixture offset settings instead, quickly eliminating the possibility of recording an incorrect value, or losing correct ones.

When the job is rerun, the setup person must re-enter the fixture offset values, which takes time, and again, opens the door to entry mistakes. If your machine/s allow G10 (data setting by program command), our second program will be very helpful. It actually outputs a program including the appropriately formatted G10 commands. When the job must be re-run, the setup person simply loads and runs this program.

Before we show the programs, you must understand a little about the DPRNT command. It is also important to know how fixture offsets are referenced within custom macro.

Opening and closing the communications port
Prior to giving the DPRNT command/s, you must open the communications port for transmission with POPEN. And when you're finished, you must close the port with PCLOS.

Understanding DPRNT
With DPRNT, you can output a series of alpha characters and numerical values, including any value stored in a variable. For numerical values, you must also specify the decimal format to be used when the value is printed. The best way to present the DPRNT command is to show an example:

#5=1
#30=-32.8616
POPEN
DPRNT[AXIS*#5[10]***#30[34]]
PCLOS
Notice how the commands POPEN and PCLOS commands surround the DPRNT statement/s. Again, they open and close the communications port.

Everything within the expression to the right of the DPRNT word is enclosed in brackets. This is part of the syntax for DPRNT. Alpha characters (like the word AXIS) are printed exactly as they appear. Each asterisk character will be printed as a space character.

Notice the bracketed numbers to the right of local variables #5 and #30. They specify the decimal format to be used for printing the current values of #5 and #30. For #5, which is currently set to a value of one (1), the value will be printed with one place to the left of the decimal point and zero places to the right of the decimal point. In essence, this value will print a whole number.

For #30, the value (-32.8616) will be printed with three significant digits to the left of the decimal point and four digits to the right of the decimal point. Since our current value (-32.8616) has only two significant values to the left of the decimal point (32) only two values will be printed to the left of the decimal point.

The result of this command, when printed, will be the text:

AXIS 1 - 32.8616

Accessing the values of fixture offsets
A series of system variables gives you access to fixture offsets. Unfortunately, the system variable numbering varies from one Fanuc control model to another, so you'll have to find those that are used on your particular control model. For a 10, 11, and 15 series control, among others, they happen to range in the 5200 series. Here is the list of system variables for these control models:

#5201: is the X value of fixture offset number one
#5202: is the Y value of fixture offset number one
#5203: is the Y value of fixture offset number one
#5204: is the B value of fixture offset number one
#5221: is the X value of fixture offset number two
#5222: is the Y value of fixture offset number two
#5223: is the Y value of fixture offset number two
#5224: is the B value of fixture offset number two
#5241: is the X value of fixture offset number three
#5242: is the Y value of fixture offset number three
#5243: is the Y value of fixture offset number three
#5244: is the B value of fixture offset number three
#5261: is the X value of fixture offset number four
#5262: is the Y value of fixture offset number four
#5263: is the Y value of fixture offset number four
#5264: is the B value of fixture offset number four
#5281: is the X value of fixture offset number five
#5282: is the Y value of fixture offset number five
#5283: is the Y value of fixture offset number five
#5284: is the B value of fixture offset number five
#5301: is the X value of fixture offset number six
#5302: is the Y value of fixture offset number six
#5303: is the Y value of fixture offset number six
#5304: is the B value of fixture offset number six
Notice how each fixture offset system variable is twenty greater than the previous one. That is, the X system variable for fixture offset number two is twenty greater than the X system variable for fixture offset number one. This trend repeats for every axis of every fixture offset. This will be important to know as you study the programs below.

Printing the current list of fixture offset settings
Here is an example of the text that will be sent out through the communications port when our first program (O5555) is run:

G 54

AXIS 1 - 32.8616
AXIS 2 - 34.2843
AXIS 3 - 49.9746
AXIS 4 269.917
G 55

AXIS 1 - 31.5296
AXIS 2 - 34.2843
AXIS 3 - 51.3859
AXIS 4 359.917
G 56

AXIS 1 - 30.1183
AXIS 2 - 34.2843
AXIS 3 - 50.0539
AXIS 4 89.917
G57

AXIS 1 - 31.4503
AXIS 2 - 34.2843
AXIS 3 - 48.6426
AXIS 4 179.917
G58

AXIS 1 - 32.8466
AXIS 2 - 34.2843
AXIS 3 - 50.2202
AXIS 4 280.206
G59

AXIS 1 - 30.1333
AXIS 2 - 34.2843
AXIS 3 - 49.8083
AXIS 4 100.206
Again, the output of this program will be a simple text file that can be printed and included with the setup documentation for the job. The next time the job is run, the setup person will enter the values into the control from this sheet.

Here is the program that outputs the current fixture offset settings:

O5555 (OUTPUT FIXTURE OFFSET DATA)
#9=6. (SET NO. OF FIXTURE OFFSETS -- MAX VALUE=6)
#18=4. (SET NO. OF AXIS REGISTERS -- MAX VALUE=15)
#4=1. (INITIALIZE FIXTURE OFFSET COUNTER)
POPEN (OPEN THE OUTPUT PORT)
WHILE [#4 LE #9] DO 1 (SAVE ALL FIXTURE OFFSET DATA)
#33=5200. + [#4 * 20.] (SET FIXTURE OFFSET POINTER #)
#32=53. + #4 (SET FIXTURE OFFSET NAME)
#5=1. (INITIALIZE FIXTURE OFFSET REGISTER NO.)
DPRNT[]
DPRNT[]
DPRNT[G#32[20]] (OUTPUT THE FIXTURE OFFSET NAME) DPRNT[]
WHILE [#5 LE #18] DO 2 (SAVE ALL REGISTERS IN A FIXTURE OFFSET)
#31=#33 + #5 (SET REGISTER POINTER #)
#30=#[#31] (GET THE REGISTER VALUE)
IF [#5 GE 4.] GOTO 200 (IF WE WILL OUTPUT A ROTARY AXIS)
N100 (OUTPUT A LINEAR AXIS REGISTER VALUE)
DPRNT[AXIS*#5[10]***#30[34]]
GOTO 300
N200 (OUTPUT A ROTARY AXIS REGISTER VALUE)
DPRNT[AXIS*#5[10]***#30[43]]
GOTO 300
N300 #5=#5 + 1. (INCREMENT REGISTER COUNTER)
END 2 #4=#4 + 1. (INCREMENT FIXTURE OFFSET COUNTER)
END 1
PCLOS (CLOSE THE OUTPUT PORT)
M30
Outputting a G10 program
Again, the previous program does require the setup person to manually enter the fixture offset values each time the job is run. If your machine allows the G10 command (data setting by programmed command), as most current machines do, you can actually eliminate the need for manual fixture offset entry. Here is an example of a program that will be created:

O0001
M00
G 54
G90 G10 L2 P 1 X- 32.8616 Y- 34.2843 Z- 49.9746 B 269.917
G 55
G90 G10 L2 P 2 X- 31.5296 Y- 34.2843 Z- 51.3859 B 359.917
G 56
G90 G10 L2 P 3 X- 30.1183 Y- 34.2843 Z- 50.0539 B 89.917
G 57
G90 G10 L2 P 4 X- 31.4503 Y- 34.2843 Z- 48.6426 B 179.917
G 58
G90 G10 L2 P 5 X- 32.8466 Y- 34.2843 Z- 50.2202 B 280.206
G 59
G90 G10 L2 P 6 X- 30.1333 Y- 34.2843 Z- 49.8083 B 100.206
M30
Note that this program does leave the control in fixture offset number six (G59), so be sure to include the initial fixture offset instating command at the beginning of your machining program/s. Also, notice the M00 at the beginning of the program. Since this program will overwrite the current settings of all fixture offset registers, this command gives the operator one chance to abort the program if they've run it by mistake.

Here is the custom macro that outputs the G10 program.

O5555 (OUTPUT FIXTURE OFFSET PROGRAM)
#9=6. (SET NO. OF FIXTURE OFFSETS -- MAX VALUE=6)
#18=4. (SET NO. OF AXIS REGISTERS -- MAX VALUE=15)
#4=1. (INITIALIZE FIXTURE OFFSET COUNTER)
POPEN (OPEN THE OUTPUT PORT)
DPRNT[]
DPRNT[O0001]
DPRNT[]
DPRNT[M00]
WHILE [#4 LE #9] DO 1 (WRITE A FIXTURE OFFSET PROGRAM)
#33=5200. + [#4 * 20.] (SET FIXTURE OFFSET POINTER #)
#32=53. + #4 (SET FIXTURE OFFSET NAME)
DPRNT[]
DPRNT[G#32[20]] (OUTPUT THE FIXTURE OFFSET NAME)
#24=#[#33 + 1.] (GET THE X-AXIS REGISTER DATA)
#25=#[#33 + 2.] (GET THE Y-AXIS REGISTER DATA)
#26=#[#33 + 3.] (GET THE Z-AXIS REGISTER DATA)
#2=#[#33 + 4.] (GET THE B-AXIS REGISTER DATA)
DPRNT[G90*G10*L2*P#4[10]*X#24[34]*Y#25[34]*Z#26[34]*B#2[43]]
#4=#4 + 1. (INCREMENT FIXTURE OFFSET COUNTER)
END 1
DPRNT[]
DPRNT[M30]
PCLOS (CLOSE THE OUTPUT PORT)
M30
A limitation of DPRNT
You may be wondering why, if the control has custom macro, we use G10 for the purpose of getting fixture offsets re-entered. The commands:

#5201=#24
#5202=#25
#5203=#26
for example, can be used to set the X, Y, and Z registers of fixture offset number one to the current values of #24, #25, and #26 respectively. These commands can be used instead of the G10 command. However, we've run into a limitation of the DPRNT command when trying to output the text "#5201=#24".

There seems to be no way (we know of) to print certain characters like the pound sign (#) and the equal sign (=). This eliminates the possibility of using the commands shown above to re-enter the fixture offset setting commands. This means the machine must have the G10 option enabled in order for this program to work.

Source: http://www.cncci.com/products/optional%20stop/spr05.htm
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Manufacturing Information Solutions Forum Index -> G-Code Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group