Hi! This piece of code is driving me creazy. I fail incrementing the counter "J". The statement J=J+1 works but as son a there is the ENDFOR it increase the "J" to onother unit.
see the code and small images to show the problem:
FOR i=0 TO Ncolonne
FOR j=0 TO Nrighe
PlaceRingCalc(i,j)
SWITCH Num
CASE 1
LIN PC_PlaceRingPinza1_OvUp CONT Vel=2 m/s free Tool[3]:Grip_Ring1 Base[5]
LIN PC_PlaceRingPinza1_Up CONT Vel=2 m/s free Tool[3]:Grip_Ring1 Base[5]
PinzaUnPo(1,0.06,0.04) ; Apertura limitata Pinza 1
PULSE ( $OUT[57], true, 0.5) ; Soffio Pinza 1
WAIT SEC 0.07
PinzaChiudi(1,0.05)
LIN PC_PlaceRingPinza1_OvUp CONT Vel=2 m/s free Tool[3] Base[5]
CASE 2
LIN PC_PlaceRingPinza2_OvUp CONT Vel=2 m/s free Tool[4]:Grip_Ring2 Base[5]
LIN PC_PlaceRingPinza2_Up CONT Vel=2 m/s free Tool[4]:Grip_Ring2 Base[5]
PinzaUnPo(2,0.06,0.04) ; Apertura limitata Pinza 2
PULSE ( $OUT[58], true, 0.5) ; Soffio Pinza 2
WAIT SEC 0.07
PinzaChiudi(2,0.05)
LIN PC_PlaceRingPinza2_OvUp CONT Vel=2 m/s free Tool[4]:Grip_Ring2 Base[5]
ENDSWITCH
; incremento j (righe) e verifico il PEN
j = j+1
IF ((Num == 1) AND I59_PEN_GRP1) OR ((Num == 2) AND I60_PEN_GRP2) THEN
j = Nrighe
i = Ncolonne
ENDIF
ENDFOR
; incremento i (colonne) e verifico il PEN
i = i+1
IF ((Num == 1) AND I59_PEN_GRP1) OR ((Num == 2) AND I60_PEN_GRP2) THEN
j = Nrighe
i = Ncolonne
ENDIF
ENDFOR