Custom project urgent

Hi, we have a small
Project based around a Mega2560 chip using this PLC- FA-DUINO-24RA - Industrial Arduino PLC - 16 Inputs, 8 Relays, 8 Analogue - www.audon.co.uk

Below is what we require:

What I need to do is get the digital inputs to activate the output relays, but in specific ways. Basically:

D-IN 01- Runs program (momentary trigger)

D-IN 02- Stops program (momentary trigger)

D-IN 03- Selects Relay 01

D-IN 04- Selects Relay 02

D-IN 05- Selects Relay 03

And so on… up to D-IN 10- Selects Relay 8

In the. Program ‘RUN state, either one of the Digital inputs 3-10 enable their respective relay as I have showed above. However, these are selected by momentary ‘high’ on the input. The relay should then stay energised until:

D-IN 02- STOP Program is triggered

OR

One of the inputs between 3-10 are selected, which will in turn activate their respective relay and de-energise the previous one.

OR

‘High’ on D-IN 11. whilst this remains ‘HIGH', it should stop the program and not allow the program to be restarted, until it goes ‘LOW’

Think of this basically as a ‘output selector’ where only one relay can be energised at anyone time.

I need this doing this week if someone can come to me with a quote

Alex

Hi Alex

The logic is very well explained. It will be a pleasure to put it into code. However i need some clarification- by D-IN-01 to D-IN-11 do you mean the pins available -- as in 30 - 45 as per datasheet?

Some programmers , like me, might think that it actually means D1 to D11 GPIO pins... and start raising concerns about using D1 which is also serial Tx0