A precise output set duration from a subroutine?

P

Thread Starter

Penko Mitev

Hello everybody!

I have configured I0.4 on my Twido as a High-priority event pointed to Subroutine 10.

The purpose is:

Rung 1 of SR10 -> LD I0.1 -> OUT Q0.2(but for 10 ms).

If this was in the main program, I don't have troubles doing it. However, putting this in a subroutine does not make the trick.

The way I am trying is with TP(Pulse) Timer, configured at 10 ms.

So, the code inside the subroutine is like this.

LD I0.1, TM1(TP, 10 ms) -> OUT Q0.2.

Why do I need this? I have a machine vision sensor which is according to my mind very stupid. It does not have direct configuration of output duration. In my case, I need 8-10 ms and I need to control an air nozzle which orientates parts.

Because of this camera's firmware limitation, I have to get the signal to the PLC and control the nozzle from there. In order this to happen as quickly as possible, I would not like to put the camera processing logic in the main program where it will be affected by scanning time which will additionally affect performance and it's possible that the duration of this how cycle is much more than the one expected.

So, to summarize, the question is, is there a way to SET a coil from a Subroutine rung and this SET to have a specific duration.

It's important to note that this logic is event-triggered and it will execute every time camera's READY signal has a raising-edge and the PLC detects the change.

By default, the camera holds the output until the next trigger. This results in the parts being nozzled out before they actually reach the photosensor which triggers the camera. That's why I need to specify a certain output duration.

Thanks
 
Top