Page 7 of 7
Re: Implementing a non blocking delay
Posted: Mon Jan 26, 2026 12:14 pm
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 ?
Re: Implementing a non blocking delay
Posted: Mon Jan 26, 2026 12:55 pm
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.
Re: Implementing a non blocking delay
Posted: Mon Jan 26, 2026 12:57 pm
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
Re: Implementing a non blocking delay
Posted: Mon Jan 26, 2026 3:34 pm
by chipfryer27
Hi
I do not want to step on his toes.
Feet well hidden
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
Re: Implementing a non blocking delay
Posted: Tue Jan 27, 2026 10:50 am
by medelec35
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.
Re: Implementing a non blocking delay
Posted: Wed Jan 28, 2026 12:55 am
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
Re: Implementing a non blocking delay
Posted: Wed Jan 28, 2026 3:20 am
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