Implementing a non blocking delay

For general Flowcode discussion that does not belong in the other sections.
mvictor
Posts: 28
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 »

Hi

Thanks Martin for the reply and I shall check this out. I came across an issue wherein supposed I give the same input port A4 two high pulse trigger before the first cycle gets complete. The second one’s input is not taken.

Is there any simple get around to this ?

medelec35
Valued Contributor
Posts: 2247
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 690 times
Been thanked: 761 times

Re: Implementing a non blocking delay

Post by medelec35 »

Chipfryer21 is doing a great job in helping, I do not want to step on his toes.
My sole intention is getting the equivalent to timer interrupt simulation working the same as on embedded hardware for anyone that requires that option.
If Chipfryer27 requires additional help then I will see what I can do to help.
Martin

mvictor
Posts: 28
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

Actually he too needed suggestion as previously posted. He wasn’t too sure whether CB is the best idea so he was waiting for better suggestions.

Regards

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

Re: Implementing a non blocking delay

Post by chipfryer27 »

Hi
I do not want to step on his toes.
Feet well hidden :lol:

Welcome any and all suggestions especially as the target chip has limited RAM and pins are aleady allocated. I seem to be in an endless loop regarding ideas, based around either CB or a shift register. I discounted DSP as I thought (possibly wrongly) that the chip would struggle?

Regards

medelec35
Valued Contributor
Posts: 2247
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 690 times
Been thanked: 761 times

Re: Implementing a non blocking delay

Post by medelec35 »

:lol:
mvictor
There are a lot of posts to catch up on.
Rather than doing that if there can be a full breakdown of what you want the hardware to then I will take a look into it.
Martin

medelec35
Valued Contributor
Posts: 2247
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 690 times
Been thanked: 761 times

Re: Implementing a non blocking delay

Post by medelec35 »

Hi Thank you for you breakdown:
mvictor wrote:
Mon Jan 26, 2026 12:57 pm
So here’s what I’m trying to do:

I have a camera which will grade objects. The camera is giving signal to a PLC which has mechanical relay outputs. I have to reject 3 grades.

My program will control 3 push pull solenoids of 12V. They are connected to 3 ports on B. It goes as follows as my PCB is that way.

A4 high trigger will pulse B5 after 3 sec (reject station 1)
A0 high trigger will pulse B6 after 4 sec (reject station 2)
A1 high trigger will pulse B7 after 5 sec (reject station 3)

(The seconds here is for example).

The reason I need this is, there is a conveyor belt which has pockets. Each pocket is 1s apart and the speed of the conveyor is fixed. So each reject station is 3, 4 and 5 second apart.

Chipfryer’s program did the above but the challenge I face is, supposed there are two objects in line of the same grade, say A4’s. Since the first case 3 second is not complete, the second one’s input is ignored. But it works well for different grades.

This is the challenge.
Hi Have quickly put something together that should simulate.
It can be tweaked where necessary.

I'm not sure how long you wanted the solenoids on for.
Just made up a number e.g.10 Seconds
Attachments
Thermaltimingjan_Example v3.fcfx
(27.42 KiB) Downloaded 2 times
Martin

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

Re: Implementing a non blocking delay

Post by chipfryer27 »

Hi Martin

I thought on using the DSP components.

Input switches populate an array, delay array, with the output used to control LEDs.

Tested using a single byte which didn't eat up much RAM but faced a bug with array (now fixed). Not had time to revisit yet. However if the DSP is to be used he would need to upgrade to latest release unless he has a DSP license pack for v9.

My thoughts about the DSP (might be wrong) was that if the switch was on for x-mS, the the output, after delay would be on for the same time, assuming sampling rate permitted.

Regards

Post Reply