Array of identical PCBs

20110107

This to remind me the how and why of the mechanism implemented for running an array of multiple PCB's


It is a common CNC process to machine identical parts in a single run.  My interpretation of how the GCode process for this is for each parts origin to be a unique offset from the workpiece origin and then the same routine is run for each unique 'work' offset.  i.e. put the pick place gcode for each identical PCB into a subroutine and then offset the PCB coordinates using the G52 command.

To translate this into a usable mechanism for my puposes, where the PCB array unique origin changes between rotations, I need to to then set an origin for each PCB in the array relative to the common PCB Array holder origin (always the PCB design origin of the bottom left PCB in the array when at rotation 0)

The challenge:

Be able to generate GCode that will set each PCB's origin in an array as an offset relative to the common PCB Array holder origins offset when the PCB Array holder origins offset is unknown at the time the GCode is created.

We have predefined for each PCB an X & Y increment to move up or across to the next PCB from the first when we are at rotation 0, ie X = 51mm, Y = 30mm

Our common PCB Array holder origin is G55.   The Mach 3 Mill manual tells me I can access the offset from the absolute origin by accessing predefined parameters (variables).  For G55 (Work offset 2) these are  #5242-#5244 (X Y & Z respectively) .. so we will use these in our code..

Note that in the Mach3Millmanual Rev 1.84 that I have there is a in error in the Parameters for Work offset 2..

Const PCBArrayOffset = "G55"
Const PCBArrayXParameter = "#5241"
Const PCBArrayYParameter = "#5242"

We will define each PCB in the array a unique offset using the G10 command starting at P101, so if there is a 2 x 2 array of PCB's we will assign offsets P101-P104

To use the created offsets after they are defined, we assign the current offset identifier ie 101 to var #100, and then call the pick place subroutine for that rotation. For each place operation the subroutine first sets the current offset to that identifed by #100

Sample generated output for a  2 x 2 array:

G0
G90
G55 (Setup PCB array offsets rot:90)
(PNP-TACT4 rot:90 pcb: 1 pcbx:1 pcby:1)
G10 L2 P101 X[#5242 + 0] Y[#5243 + 0] Z[#5263]
(PNP-TACT4 rot:90 pcb: 2 pcbx:1 pcby:2)
G10 L2 P102 X[#5242 + -30] Y[#5243 + 0] Z[#5263]
(PNP-TACT4 rot:90 pcb: 3 pcbx:2 pcby:1)
G10 L2 P103 X[#5242 + 0] Y[#5243 + -51] Z[#5263]
(PNP-TACT4 rot:90 pcb: 4 pcbx:2 pcby:2)
G10 L2 P104 X[#5242 + -30] Y[#5243 + -51] Z[#5263]
#100 = 101
M98 P90
#100 = 102
M98 P90
#100 = 103
M98 P90
#100 = 104
M98 P90
M1 (MAIN END Rot:90)
G55 (Setup PCB array offsets rot:180)
(PNP-TACT4 rot:180 pcb: 1 pcbx:1 pcby:1)
G10 L2 P101 X[#5242 + 0] Y[#5243 + 0] Z[#5263]
(PNP-TACT4 rot:180 pcb: 2 pcbx:1 pcby:2)
G10 L2 P102 X[#5242 + 0] Y[#5243 + 30] Z[#5263]
(PNP-TACT4 rot:180 pcb: 3 pcbx:2 pcby:1)
G10 L2 P103 X[#5242 + -51] Y[#5243 + 0] Z[#5263]
(PNP-TACT4 rot:180 pcb: 4 pcbx:2 pcby:2)
G10 L2 P104 X[#5242 + -51] Y[#5243 + 30] Z[#5263]
#100 = 101
M98 P180
#100 = 102
M98 P180
#100 = 103
M98 P180
#100 = 104
M98 P180
M1 (MAIN END Rot:180)
M30

 

 

 

 

 

 

G0
G90
G55 (Setup PCB array offsets rot:90)
(PNP-TACT4 rot:90 pcb: 1 pcbx:1 pcby:1)
G10 L2 P101 X[#5242 + 0] Y[#5243 + 0] Z[#5263]
(PNP-TACT4 rot:90 pcb: 2 pcbx:1 pcby:2)
G10 L2 P102 X[#5242 + -30] Y[#5243 + 0] Z[#5263]
(PNP-TACT4 rot:90 pcb: 3 pcbx:2 pcby:1)
G10 L2 P103 X[#5242 + 0] Y[#5243 + -51] Z[#5263]
(PNP-TACT4 rot:90 pcb: 4 pcbx:2 pcby:2)
G10 L2 P104 X[#5242 + -30] Y[#5243 + -51] Z[#5263]
#100 = 101
M98 P90
#100 = 102
M98 P90
#100 = 103
M98 P90
#100 = 104
M98 P90
M1 (MAIN END Rot:90)
G55 (Setup PCB array offsets rot:180)
(PNP-TACT4 rot:180 pcb: 1 pcbx:1 pcby:1)
G10 L2 P101 X[#5242 + 0] Y[#5243 + 0] Z[#5263]
(PNP-TACT4 rot:180 pcb: 2 pcbx:1 pcby:2)
G10 L2 P102 X[#5242 + 0] Y[#5243 + 30] Z[#5263]
(PNP-TACT4 rot:180 pcb: 3 pcbx:2 pcby:1)
G10 L2 P103 X[#5242 + -51] Y[#5243 + 0] Z[#5263]
(PNP-TACT4 rot:180 pcb: 4 pcbx:2 pcby:2)
G10 L2 P104 X[#5242 + -51] Y[#5243 + 30] Z[#5263]
#100 = 101
M98 P180
#100 = 102
M98 P180
#100 = 103
M98 P180
#100 = 104
M98 P180
M1 (MAIN END Rot:180)
M30