Hey,
I am working on a project that is a bit more involved than past ones I have done. It will be using a CompactLogix PLC, and I'm using Studio 5000 v30.
Some parts of my code are going to be very repetitive, for example I will have to control 12 gates, all 12 gates will require the exact same logic, the only thing that will change is the I/O's that they use. In the past I would just brute force this, as I was never dealing with so many repeat instances, but I'm looking to simplify my code.
Essentially I'm wanting two subroutines, one to Open the gate, and one to close the gate. All 12 gates will be controlled independently from one another, but their logic will be the exact same. Each gate has an Open Limit Switch, Closed Limit Switch, Full Bin Sensor (don't open gate if bin is already full), and an output to Open, one to Close, then just some status indicators (Opened, Closed, Transit).
Now my big question, can I write a subroutine, with the generic logic that would control all gates, and when my main routine calls that subroutine, have it pass all the appropriate I/O's to the subroutine so it opens whatever gate the user is requesting? This would be in place of have potentially 24 different subroutines (Open and Close subroutine for each gate).
Thanks for any help you may be able to provide. And I'm sorry if this is a basic question, I haven't been able to find information on how to do exactly what I'm wanting yet. Thanks,
I am working on a project that is a bit more involved than past ones I have done. It will be using a CompactLogix PLC, and I'm using Studio 5000 v30.
Some parts of my code are going to be very repetitive, for example I will have to control 12 gates, all 12 gates will require the exact same logic, the only thing that will change is the I/O's that they use. In the past I would just brute force this, as I was never dealing with so many repeat instances, but I'm looking to simplify my code.
Essentially I'm wanting two subroutines, one to Open the gate, and one to close the gate. All 12 gates will be controlled independently from one another, but their logic will be the exact same. Each gate has an Open Limit Switch, Closed Limit Switch, Full Bin Sensor (don't open gate if bin is already full), and an output to Open, one to Close, then just some status indicators (Opened, Closed, Transit).
Now my big question, can I write a subroutine, with the generic logic that would control all gates, and when my main routine calls that subroutine, have it pass all the appropriate I/O's to the subroutine so it opens whatever gate the user is requesting? This would be in place of have potentially 24 different subroutines (Open and Close subroutine for each gate).
Thanks for any help you may be able to provide. And I'm sorry if this is a basic question, I haven't been able to find information on how to do exactly what I'm wanting yet. Thanks,