Save Renishaw measurements to a text file (.CSV)

Save Renishaw measurements - linear holes

There are situations in which we want to repeat a program sequence several times. In the photo above, you can see a series of holes whose positions are to be checked and the positions of the centers and their diameters are to be recorded in a measurement sheet.

This can be done automatically and very easily using the Renishaw Probe control device and by calling a program that uses subroutines (subprograms).

Here is an example of a complex program that helps us to automatically record the measured values during the automatic cycle in a text file (* .CSV).

We present the working method for OKUMA CNC milling centers. Other parameters and other measurement subprograms will be used for the lathe.

First of all, let’s remember the five types of ISO program files on the OSP numeric control:

  • Main programs .MIN
  • Subprogram files .SUB
  • Subprogram files of the system .SSB
  • Organization program files .SDF
  • Library program files .LIB
  • Program files constructor .MSB

We do not go into details, we are interested in the main programs and subprograms in this case application.

The main programs always start with the program number, the name starts with O and is followed by four digits, and ends with M02 or M30. Subprogram files have the extension SUB.

They start with the name of the program and end with RTS. To call a subprogram, during the execution of a main program, we write the command CALL followed by the name / number of the desired subprogram.

How does it work? NC code analysis

Main program

We consider that the measurement program starts from the coordinates Z20 X0 Y0. For work safety we will approach this position manually. We have to measure by points a circle with a radius of 50mm at a measuring depth of -15 mm on the Z axis.

Note that the probe reading subroutine automatically creates a file where all the measured data is saved, in our case the A.MDF file

Save Renishaw measurements - dump data

Subroutine writing table header and file name

From the main program, a subprogram O1000 (HEADER) is called with CALL, which writes the header X, Y (table head), and the file in which the data is written is on the D: folder MD1, respectively the file E40-RESULT.CSV.

VPRT=15 (Writing results in D:\MD1\A.MDF)
CALL O1000 (HEADER)

O1000 (header)
FWRITC MD1:E40-REZULT.CSV;A
PUT 'X,Y'
WRITE C
CLOSE C
RTS

Remember that READ/WRITE and GET/PUT functions are read and write functions in an external variable file.

Probe loading and initialisation

Then the main program selects the test tool T100 and M6 rotates the main shaft counterclockwise when looking from the part, G15 H1 selects the coordinate system (modal in this case) and code G56 HA Z20 compensates the length of the measuring tool on the axis Z.

T100 M6
G15 H1
G56 HA Z20

The main measurement program follows, which starts the Renishaw probe (if VNCOM [3] = 0) with a half-second pause in the program G4 F0.5. to have a guaranteed time to activate the probe.

The M19 control is used on machines equipped with a main shaft orientation mechanism. The orientation function stops the main shaft at a specified angular position.

IF [VNCOM[3] EQ 0] GOTO N11
M127 (Pornire RENISHAW)
G4 F0.5
N11
M19

Travel to the points on the innercircle

The next 2 groups of commands (- + - Y PLUS) respectively (- + - X MINUS) move the probe on the Y axis minus respectively on the X axis in addition, starting from the initial values declared in the global variables XXI = -3 and YYI = -3 values then transported in common variables VC11 = XXI and VC12 = YYI. The main program calls the measuring subprograms with CALL OY and CALL OX, 7 times each (Q7) which has the effect of palpating the surfaces on the circle with the probe and then recording the values in the file point by point.

As can be seen in the graph below, we move the probe in a circle inside the measuring part with an offset of +/- 3 mm from the position X = 0 and Y = 0 (XXI = -3, YYI = -3) and we measure in 7 consecutive points at a distance of 1 mm between them (the explanatory drawing does not represent the proportional distances between points).

orange = coord. probe movement, red = reading points

The orange dots represent the travel coordinates given by the main program, and dialing the internal measurement subroutine automatically takes the sensor to the landmark until it is reached and the coordinate data is recorded.

(-+- Y MINUS)
VC11=XXI
X=VC11
Y=-PDE-2
Z=ZZ
CALL OY Q7 PP=-PDE
Z20

(-+- X PLUS)
VC12=YYI
Y=VC12
X=PDE+2
Z=ZZ
CALL OX Q7 PP=PDE
Z20

Point measurement subroutine

CALL OO10 is the call to an internal measuring subroutine and PMOD = 2 PEI = PP are the parameters that are transmitted to the measuring subprogram for the different working modes with probe (Point Face, see details in the OKUMA / Gauging function manual).

OX (-+- SUB Masurare X)
CALL OO10 PMOD=1 PEI=PP (POINT FACE)
VC13=VS29
CALL O1001 PSX=VC13 PSY=VC12
VC12=VC12+1
G0 Y=VC12
RTS

PMOD=1 for Point Face measurement on the X axis
PMOD=2 for Point Face measurement on the Y axis
and PEI=PP measurement quota.

Subroutine for writing values to the table

CALL O1001 is the subroutine that writes the values read in the coordinate point. X, Y transmitted by the parameters PSX, PSY. After returning from the write subroutine, the variable VC12 (VC12 = VC12 + 1) is incremented and the next point is measured, an action repeated 7 times with Q7 (CALL OX Q7 PP = PDE).

O1001 (scriitor)
FWRITC MD1:E40-REZULT.CSV;A
PUT PSX
PUT ','
PUT PSY
WRITE C
CLOSE C
RTS

After performing the measurement cycles, the main program calls M127 which stops the Renishaw probe and the final program M2.

This image has an empty alt attribute; its file name is Okuma_LogoWEB.png