How do I detect the positive flank of a signal going from 0 to 1?
There are at least two ways to do this on IRC5
-
Use the Interrupt/TRAP mechanism in RAPID to take some action in response to the transition of your signal from 0 to 1.
-
Create a FlexPendant SDK application that “subscribes” to the IO changed event for your signal, then take some action when the signal changes AND its value is 1.
Method 1 is simpler and likely faster than method 2 because you can configure the interrupt to happen based upon your desired state change, i.e. 0 to 1, and also the change event does not need to be broadcast to a client device (the FlexPEndant).
Thanks Russ.
I went with the first alternative (trap routine), but of course im having probs also with this.
My problem is the trap routine is never carried out. I connect the intvariable with the traproutine in Mainroutine and i deactivate it immediately. then i want to activate it in my Grip Routine and again deactivate in release routine. Can you see something wrong?
Here is the code:
In Datamodule:
VAR intnum DetailMissingCylFwd;
VAR intnum DetailMissingCylBack;
In Mainmodule:
PROC Main()
CONNECT DetailMissingCylBack WITH DetailLost;
IsignalDI iGripperCylBack,1,DetailMissingCylBack;
CONNECT DetailMissingCylFwd WITH DetailLost;
IsignalDI iGripperCylForward,1,DetailMissingCylFwd;
isleep DetailMissingCylBack;
isleep DetailMissingCylFwd;
ENDPROC
PROC Grip()
(code for gripping)
iwatch DetailMissingCylFwd;
iwatch DetailMissingCylback;
ENDPROC
PROC Release()
(code for releasing)
isleep DetailMissingCylBack;
isleep DetailMissingCylFwd;
ENDPROC
Found it… ![]()
The signal to trigg my interrupt was already 1 when the interrupt was activated. :stuck_out_tongue:
Thanks.