I have the following program that reads serial data, and moves to the specified axis position when data is received (KRC1). I don't have the fancy tricks of KRXML or RSI available at this point.
Here is the code:
MW_T=#SYNC
MR_T=#ABS
HANDLE=0
OPENSERIAL()
SPEED=25
$VEL_AXIS[1]=SPEED
$VEL_AXIS[2]=SPEED
$VEL_AXIS[3]=SPEED
$VEL_AXIS[4]=SPEED
$VEL_AXIS[5]=SPEED
$VEL_AXIS[6]=SPEED
$ACC_AXIS[1]=100
$ACC_AXIS[2]=100
$ACC_AXIS[3]=100
$ACC_AXIS[4]=100
$ACC_AXIS[5]=100
$ACC_AXIS[6]=100
TARGET_POS=$AXIS_ACT
PTP TARGET_POS ; BCO
LOOP
IF ($DATA_SER1 <> 0) THEN
CREAD(HANDLE, SR_T, MR_T, TIMEOUT, OFFSET, "%r", STRIN[])
OFFSET=0
IF (STRIN[1]="A") THEN
PARSE_AXIS_POS(TARGET_POS,STRIN[]) ; subroutine I wrote that parses string into E6AXIS
PTP TARGET_POS ; <---- This line blocks program, as you would expect
ENDIF
ENDIF
IF ($DATA_SER1==0) THEN
WAIT Time= 0.2 sec
ENDIF
ENDLOOP
Display More
If another position is received, I want the robot to instantly change its path to move toward the new position. Problem is, the PTP TARGET_POS line in the program blocks the program so it won't attempt to read any more data until that movement has been completed, so the robot completely stops. Reading some of the other threads here about smooth movement, etc it seems that cell.src with triggers/interrupts might be key, however that feels a little too complex for this, and looking for a way to fire off the PTP just within this module if possible.
Is there a way to let the program move on without waiting on the current PTP movement to finish?