Can I open,read and close the Serial Port (RS232) in SPS file?
OR , Do I have to define variables in the CONFIG.dat file?
PLZ Help me. everyone if can.
Can I open,read and close the Serial Port (RS232) in SPS file?
OR , Do I have to define variables in the CONFIG.dat file?
PLZ Help me. everyone if can.
Thank You Panic,
This way you said it will solve my problem. Now I have to read about how to add a serial port to a SPS.SUB file. I can do this more easily if I have more accurate information.
Ok, I will test what you said and tell you the result. Thanks all.
Dat FIle
DEFDAT SEND5
;FOLD EXTERNAL DECLARATIONS;%{PE}%V3.2.0,%MKUKATPBASIS,%CEXT,%VCOMMON,%P
;FOLD BAS EXT;%{PE}%V3.2.0,%MKUKATPBASIS,%CEXT,%VEXT,%P
EXT BAS (BAS_COMMAND :IN,REAL :IN )
DECL INT SUCCESS
;ENDFOLD
;FOLD A10 EXT;%{E}%V3.2.0,%MKUKATPARC,%CEXT,%VEXT,%P
EXT A10 (A_CMD_T :IN,A_STRT_T :IN,A_WELD_T :IN,A_END_T :IN,INT :IN )
;ENDFOLD
;FOLD A20 EXT;%{E}%V3.2.0,%MKUKATPA20,%CEXT,%VEXT,%P
EXT A20 (INT :IN,WELD_ST :IN,WELD_FI :IN,INT :IN )
;ENDFOLD
;FOLD GRIPPER EXT;%{E}%V3.2.0,%MKUKATPGRIPPER,%CEXT,%VEXT,%P
EXT H50 (INT :IN,INT :IN,INT :IN,GRP_TYP :IN )
;ENDFOLD
;FOLD SPOT EXT;%{E}%V3.2.0,%MKUKATPSPOT,%CEXT,%VEXT,%P
EXT USERSPOT (S_COMMAND :IN,SPOT_TYPE :IN )
;ENDFOLD
;FOLD TOUCHSENSE EXT;%{E}%V3.2.0,%MKUKATPTS,%CEXT,%VEXT,%P
EXT H70 (INT :IN,SRCH_TYP_2 :OUT,E6POS :IN,SRCH_TYP_3 :IN,SRCH_TYP_2 :IN,SRCH_TYP_2 :IN,SRCH_TYP_2 :IN,SRCH_TYP_2 :IN,SRCH_TYP_2 :IN,INT :IN )
;ENDFOLD
;FOLD USER EXT;%{E}%V3.2.0,%MKUKATPUSER,%CEXT,%VEXT,%P
;Make here your modifications
;ENDFOLD
;ENDFOLD
INT HANDLE,OFFSET,M,L
DECL CHAR ch[2]
DECL BOOL F
DECL E6AXIS POS1
REAL TIMEOUT
DECL STATE_T SR_T,SW_T,SC_T
DECL MODUS_T MR_T,MW_T
DECL BASIS_SUGG_T LAST_BASIS={POINT1[] "HOME ",POINT2[] "HOME ",CP_PARAMS[] "CPDAT0 ",PTP_PARAMS[] "DEFAULT ",CONT[] " ",CP_VEL[] "2.0 ",PTP_VEL[] "20 "}
DECL E6POS XA1={x 1299.10706,y 2.63543391,z 1483.771,a 0.0,b 90.0,c -1.61718399E-11,s 2,t 10,e1 0.0,e2 0.0,e3 0.0,e4 0.0,e5 0.0,e6 0.0}
DECL FDAT FA1={TOOL_NO 1,BASE_NO 0,IPO_FRAME #BASE}
DECL PDAT PPDAT1={VEL 100.0,ACC 20.0,APO_DIST 100.0}
ENDDAT
Display More
SRC File
DEF Send5( )
;FOLD INI;%{PE}%V3.2.0,%MKUKATPBASIS,%CINIT,%VCOMMON,%P
;FOLD BAS INI;%{E}%V3.2.0,%MKUKATPBASIS,%CINIT,%VINIT,%P
GLOBAL INTERRUPT DECL 3 WHEN $STOPMESS==TRUE DO IR_STOPM ( )
INTERRUPT ON 3
BAS (#INITMOV,0 )
;ENDFOLD (BAS INI)
;FOLD A20 INI;%{E}%V3.2.0,%MKUKATPA20,%CINIT,%VINIT,%P
IF ARC20==TRUE THEN
A20 (ARC_INI)
INTERRUPT DECL 6 WHEN $CYCFLAG[3]==FALSE DO A20(TECH_STOP2)
ENDIF
;ENDFOLD (A20 INI)
;FOLD A10 INI;%{E}%V3.2.0,%MKUKATPARC,%CINIT,%VINIT,%P
IF A10_OPTION==#ACTIVE THEN
INTERRUPT DECL 4 WHEN $CYCFLAG[2]==FALSE DO A10 (#APPL_ERROR)
INTERRUPT DECL 7 WHEN A_ARC_SWI==#ACTIVE DO A10 (#ARC_SEAM)
INTERRUPT DECL 5 WHEN A_FLY_ARC==TRUE DO A10 (#HPU_ARC)
INTERRUPT ON 5
A10_INI ( )
ENDIF
;ENDFOLD (A10 INI)
;FOLD GRIPPER INI;%{E}%V3.2.0,%MKUKATPGRIPPER,%CINIT,%VINIT,%P
USER_GRP(0,DUMMY,DUMMY,GDEFAULT)
;ENDFOLD (GRIPPER INI)
;FOLD SPOT INI;%{E}%V3.2.0,%MKUKATPSPOT,%CINIT,%VINIT,%P
USERSPOT(#INIT)
;ENDFOLD (SPOT INI)
;FOLD TOUCHSENSE INI;%{E}%V3.2.0,%MKUKATPTS,%CINIT,%VINIT,%P
IF H70_OPTION THEN
INTERRUPT DECL 15 WHEN $MEAS_PULSE[TOUCH_I[TOUCH_ACTIVE].IN_NR] DO H70 (6,CD0 )
INTERRUPT DECL 16 WHEN $ZERO_MOVE DO H70 (7,CD0 )
INTERRUPT DECL 17 WHEN $TECHPAR_C[FG_TOUCH,8]>0.5 DO H70 (8,CD0)
H70 (1,CD0 )
ENDIF
;ENDFOLD (TOUCHSENSE INI)
;FOLD USER INI;%{E}%V3.2.0,%MKUKATPUSER,%CINIT,%VINIT,%P
;Make your modifications here
;ENDFOLD (USER INI)
;ENDFOLD (INI)
F=FALSE
ch[1]="0"
GLOBAL INTERRUPT DECL 20 WHEN ch[1]=="1" DO SUB1()
POS1.A1=0
POS1.A2=-74
POS1.A3=100
POS1.A4=0
POS1.A5=-27
POS1.A6=0
;FOLD PTP HOME Vel= 2 % DEFAULT;%{PE}%R 4.1.16,%MKUKATPBASIS,%CMOVE,%VPTP,%P 1:PTP, 2:HOME, 3:, 5:2, 7:DEFAULT
$BWDSTART = FALSE
PDAT_ACT=PDEFAULT
BAS(#PTP_DAT)
FDAT_ACT=FHOME
BAS(#FRAMES)
BAS(#VEL_PTP,2)
$H_POS=XHOME
PTP XHOME
;ENDFOLD
HANDLE=3
MR_T=#ABS
MW_T=#ABS
OPEN_P()
INTERRUPT ON 20
READ_p()
ptp POS1
CLOSE_P()
;FOLD PTP HOME Vel= 20 % DEFAULT;%{PE}%R 4.1.16,%MKUKATPBASIS,%CMOVE,%VPTP,%P 1:PTP, 2:HOME, 3:, 5:20, 7:DEFAULT
$BWDSTART = FALSE
PDAT_ACT=PDEFAULT
BAS(#PTP_DAT)
FDAT_ACT=FHOME
BAS(#FRAMES)
BAS(#VEL_PTP,20)
$H_POS=XHOME
PTP XHOME
;ENDFOLD
END
;------------------------------------------------------------------------------------------
DEF OPEN_P()
COPEN(:SER_3, HANDLE)
IF (HANDLE==0) THEN
HALT
ENDIF
END
;-----------------------------------------------------------------------
DEF READ_P()
INTERRUPT ON 20
CWRITE(HANDLE,SW_T,MW_T,"%c","y")
TIMEOUT=3
OFFSET=0
WAIT FOR ($DATA_SER3<>0)
CREAD(HANDLE,SR_T,MR_T,TIMEOUT,OFFSET,"%s",ch[])
OFFSET=0
END
;-----------------------------------------------------------
DEF SUB1()
CWRITE(HANDLE,SW_T,MW_T,"%c","A")
INTERRUPT OFF 20
HALT
BRAKE
END
;-----------------------------------------------------------------------
DEF CLOSE_P()
CCLOSE(HANDLE,SC_T)
IF (SC_T.RET1<>#CMD_OK) THEN
HALT
ENDIF
END
Display More
SO Hermann what am i doing now?
I'm Sorry for last post because I'm beginner in post messaging. I promise to post better from now on.
is it temporary only? Yes. I want to test it. Start moving robot from p1 to p2 and stop that when sensor sens. just that. if you tell it stop and continue why this command not execute (LINE 72):
This command turns on the hazard light.
If you say that the interrupt is executed, then the movement continues again, then why this command is not executed like the command I[1]=I[1]+1.
I run the program and the program does not check the interrupt until it reaches the second point and I have to go down step by step and check the sensor every time and this is a problem.
In addition, The interrupt condition does not have to be true or false. Variables can also be used: ch[1]=="1"
HI Panic Mode
My code is:
INT HANDLE,OFFSET,M,L
DECL CHAR ch[2]
DECL E6AXIS POS1
REAL TIMEOUT
DECL STATE_T SR_T,SW_T,SC_T
DECL MODUS_T MR_T,MW_T
INI
F=FALSE
ch[1]="0"
GLOBAL INTERRUPT DECL 20 WHEN ch[1]=="1" DO SUB1()
POS1.A1=0
POS1.A2=-74
POS1.A3=100
POS1.A4=0
POS1.A5=-27
POS1.A6=0
;FOLD PTP HOME Vel= 2 % DEFAULT;%{PE}%R 4.1.16,%MKUKATPBASIS,%CMOVE,%VPTP,%P 1:PTP, 2:HOME, 3:, 5:2, 7:DEFAULT
$BWDSTART = FALSE
PDAT_ACT=PDEFAULT
BAS(#PTP_DAT)
FDAT_ACT=FHOME
BAS(#FRAMES)
BAS(#VEL_PTP,2)
$H_POS=XHOME
PTP XHOME
;ENDFOLD
HANDLE=3
MR_T=#ABS
MW_T=#ABS
OPEN_P()
INTERRUPT ON 20
READ_p()
ptp POS1
CLOSE_P()
;FOLD PTP HOME Vel= 20 % DEFAULT;%{PE}%R 4.1.16,%MKUKATPBASIS,%CMOVE,%VPTP,%P 1:PTP, 2:HOME, 3:, 5:20, 7:DEFAULT
$BWDSTART = FALSE
PDAT_ACT=PDEFAULT
BAS(#PTP_DAT)
FDAT_ACT=FHOME
BAS(#FRAMES)
BAS(#VEL_PTP,20)
$H_POS=XHOME
PTP XHOME
;ENDFOLD
END
;------------------------------------------------------------------------------------------
DEF OPEN_P()
COPEN(:SER_3, HANDLE)
IF (HANDLE==0) THEN
HALT
ENDIF
END
;-----------------------------------------------------------------------
DEF READ_P()
INTERRUPT ON 20
CWRITE(HANDLE,SW_T,MW_T,"%c","y")
TIMEOUT=3
OFFSET=0
WAIT FOR ($DATA_SER3<>0)
CREAD(HANDLE,SR_T,MR_T,TIMEOUT,OFFSET,"%s",ch[])
OFFSET=0
END
;-----------------------------------------------------------
DEF SUB1()
CWRITE(HANDLE,SW_T,MW_T,"%c","A")
INTERRUPT OFF 20
HALT
BRAKE
END
;-----------------------------------------------------------------------
DEF CLOSE_P()
CCLOSE(HANDLE,SC_T)
IF (SC_T.RET1<>#CMD_OK) THEN
HALT
ENDIF
END
Ok Panic thanks, But I tell to Fubini my interrupt is software interrupt not Hardware
i want to stop movement when interrupted.
my program interrupt checking value of variable from serial port in COM3 . My problem is that it does not stop until it reaches the target and the sensor is seen.
The PTP {a3 130} command is executed to the end then the Interrupt executed. do you Understand what i want? (maybe sensor seen in 120) But it goes up to 130 and does not stop at 120.
Sorry, In and Out is broken and i can't use them . so i had to use com port to control sensor.
I want to go from point 1 to point 2. and want Stop on the track if the sensor is seen. Point 1 to point 2 is done with the ptp command.
Sensors data read with CREAD Command.
ptp{1----------------------2}
It doesn't stop dynamic move, i want stop moving in path
Hi Fubini,
I want stop the robot when the interrupt is triggered
check variable in CREAD.
I want to stop the path that is in a command.
It stands like the water we want to take from the water bowl when we reach the beginning of the water.
Hello
I want to move axis to a fixed point, but on the way, if the sensor is activated, it will stop moving. I used Arduino and serial port for the sensor. Now I want to use interrupt. when i read sensor status ptp moving stop move.
flag=true
Global Interrupt Decl 3 when ch[1]="1" do sub1()
interrupt on 3
loop
CRead(...,...,"%s",ch[])
if flag=false then endloop
ptp(a3 130)
endloop
DEF sub1()
Interrupt off 3
flag=false
End
Stop A3 Moving when It see position 1 in the sensor path