RobotStudio event

Counting Procedure

Hi Everyone,

I'm new to RAPID programming and in need of some advice which i hope you would be able to help.

I have a sensor which counts a number of box by incrementing a variable when the input is triggered, and when a certain count is reached, an output would stop the conveyor and send a signal to the robot to pickup the case. (And how do I count input triggers, interrupt?)

Is there any way to perform the counting while the TCP is moving, like running the count in the background?

I've read about multitasking option but is there any other way?

Any help on this would be highly appreciated.

Jayson
Manila

Comments

  • Hello jayson,
    it should work to do it as such:

    MODULE Module1
        PERS num CountSignals;
        VAR intnum sig1int;

        PROC main()
            IDelete sig1int;

            CONNECT sig1int WITH iroutine1;
            ISignalDI diInput,1,sig1int;

            WHILE TRUE DO

            
            ENDWHILE
        ENDPROC


        TRAP iroutine1
          
            CountSignals:=CountSignals+1;
                  
            IF CountSignals=10 THEN
                !stop conveyor
                !pick
                CountSignals:=0;
            ENDIF
            reset diInput;

        ENDTRAP

    ENDMODULE
  • Thank you so much Pavel!
    Such a great help. Cheers man!
  • soup
    soup ✭✭✭
    Unless I'm reading it wrong, the above counter would need to stop when the robot is in motion doing the pick and the place. Only after the place could the conveyor turn back on and start counting again. Probably not a big deal with low speed pick and place. Higher speed pick and place, when you want the cases to come in as soon as the infeed is clear, a separate task for counting would probably work better.