Hello all,
I'm trying to get an output ON without stopping the robot.
Of course I'm using
to get it done, but there are some conditions before that must be observed, therefore, I have some IF clauses and a couple of function calls prior to activating the output itself...
In pseudocode the logic flow is the following one:
Code
; IN THE SAME SRC FILE THAN THE USER POINTS/PROGRAM
DEF UserFunction(iP1,iP2)
INT iP1
INT iP2
IF (iP1==0) THEN
HALT
ELSE
SWITCH iP1
CASE 2
IF(Global_bool_var)THEN
IF(MOD(Global_int_var,iP2)==(iP2-1))THEN
fxThatMakesThePulse(100)
ENDIF
ENDIF
DEFAULT
HALT
ENDSWITCH
ENDIF
END
;IN ANOTHER AND GLOBAL SRC FILE
GLOBAL DEF fxThatMakesThePulse(iT)
INT iT
IF (iT == 0)THEN
TRIGGER WHEN DISTANCE=0 DELAY=0 DO PULSE(ADO_bU21LiquidPApply,TRUE,0.5)
ELSE
TRIGGER WHEN DISTANCE=0 DELAY=0 DO PULSE(ADO_bU21LiquidPApply,TRUE,m_iT/1000)
ENDIF
; Something will be handled in the SPS after a while...
$TIMER[3]=0
$TIMER_STOP[3]=FALSE
END
Display More
Of course, if in the main program I'm using the TRIGGER... call directly the robot is not stopping.
I would like to be able to keep the different functions and so in my logics in order to separate the physical inputs and outputs from the logics.
I've tried placing a continue just before any of the IF clauses present in the code with the same result...
Any idea or hint?
as always thank you in advance.