Loop Control Help!

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Post Reply
sabretooth4
Posts: 3
Joined: Fri May 16, 2014 4:04 pm
Has thanked: 1 time

Loop Control Help!

Post by sabretooth4 »

Hello All,

I need some help please :)

I have a complex programme running through a MIAC which controls an inverter via the outputs, so i have specific commands eg output 1 = on for 30 s and then output 2 on for 10s

The problem i have is controlling the relay, i want to have the relay on but once the input is activated turn the relay off and as soon as the input drops then the relay to come back on instantly without having to wait for the loop top start again.

Can any one help please??

Thanks :)

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times

Re: Loop Control Help!

Post by LeighM »

One way around this is to avoid long delays.
Rather than waiting in a delay, keep going round the loop.

So in the case of a 10 second delay, have say a 10mS delay in the loop, but count the number of times round the loop.
When the counter gets to 1000 the 10 seconds will have elapsed so activate the relay.

This does mean that in the meantime, whilst in the loop, you can check other inputs, change status variables, reduce or increase the delay time, etc

Leigh

Post Reply