One-Time PLC Tag Output Pulse

I’m trying to “pulse” a PLC tag one time. For my project, if a correct barcode is received, a Serial Number display string is populated. When that happens, I would like to turn on a tag for a period of time, once.

I’ve been searching through the forum and I found some time.sleep() code - thinking I could do the following: system.tag.writeToTag('tag',1) time.sleep(2) system.tag.writeToTag('tag',0) I have also been tossing around the idea of enabling a timer once the Serial Number.value != ‘’ and when the timer.value > 2 system.tag.writeToTag and then disable the timer using the if event.propertyName == 'value' and event.newValue == 0: event.source.running = 0Any ideas?

Thank you!

We have a timer button for this purpose under the Buttons tab of the component palette. You can set the on and off value with a delay. So if you just press the button it will write a 1 and some delay later it will wirte a 0. If you don’t want to use that button I recommend using the time.sleep function. A timer will be more confusing to look at later.

I don’t see a “Timer Button” - did you mean “Momentary Button”? If so, I’m trying to do this w/o pushing a button. I would like to have this function occur with only a barcode scan.

Ah, ok I see. In that case it is best to use the sleep function.

In this kind of case we would tend to set the trigger point high in Ignition and then make the PLC responsible for resetting the point once it has carried out the required action. I think this approach is more robust. It also gives you feedback that the PLC has seen the change.

Oooo - I like that AlThePal… thanks!