Implementing a non blocking delay

For general Flowcode discussion that does not belong in the other sections.
mvictor
Posts: 24
http://meble-kuchenne.info.pl
Joined: Thu Aug 25, 2022 7:46 am
Has thanked: 3 times
Been thanked: 1 time

Re: Implementing a non blocking delay

Post by mvictor »

Hey

Really sorry for this as it’s something that I realised when putting this in practice. So it goes like this:

I managed to make count variable numbers like when I press button A, the LED lights after 3 seconds and shuts off at about 3.3seconds since the button is pressed. Like a 300ms pulse is given.

But if I press the button A again before this 3.3 seconds, then there is no second output since the first on is not completed. What made me realise this is, there could be two signals of the same category (consider it as button A being pressed again 1 second apart) from the PLC, depending on the reading picked from the camera.

Regards

chipfryer27
Valued Contributor
Posts: 1861
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 407 times
Been thanked: 632 times

Re: Implementing a non blocking delay

Post by chipfryer27 »

Hi

If you press and hold the button for one-second before releasing will the Led come on for one-second after a delay? If it was the pressed and held for two-seconds would the on-time then be two seconds?

If you could describe a possible sequence of events over a given period it would help.

e.g

Time Action
00:00
00:01
00:02
00:03 Button A pressed#1
00:04 Button A released
00:05
00:06 Button A pressed#2
00:07 Button A released
00:08 Led A On (#1)
00:09
00:10 Led A Off (#1)
00:11 Led A On (#2)
00:12
00:13 led A Off (#2)

When the button is pressed, how long is it actually pressed for? You said it is under MCU control so I appreciate "button press" isn't an actual button, but how long is the signal high / active for?

Regards

mvictor
Posts: 24
Joined: Thu Aug 25, 2022 7:46 am
Has thanked: 3 times
Been thanked: 1 time

Re: Implementing a non blocking delay

Post by mvictor »

Hello,

The signal would be high for approx 300ms. It is a pulse trigger which controls a 12v push pull solenoid, so when a pulse is give the solenoid would go forward and when its low the solenoid goes back to its place.

Regards

chipfryer27
Valued Contributor
Posts: 1861
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 407 times
Been thanked: 632 times

Re: Implementing a non blocking delay

Post by chipfryer27 »

HI

So in other words you are looking for a digital delay? What happens on input A is reflected on output A after x-seconds?

What sort of delay periods are you lo0king at? Variable or fixed and how many triggers could arrive before the first trigger has completed it's delay?

Regards

Post Reply