Jump to content

Recommended Posts

  • MVP 2014

The first step is to create a counter to keep track of your cycles. There is no built-in loop counter like the FOR loop.

Then decide whether you want to complete all cycles in a single scan, or perform one cycle per scan.

I would also consider putting the sequence in a subroutine of its own. Programmers vary in their preference on when to use subroutines. The main goals are to make the code function correctly, and also be easy to understand for someone new.

1. All cycles in one Scan - add a label before the call of the subroutine containing your sequence and place a Jump to Label instruction after the subroutine call. Keep calling the Jump to Label until your loop counter has reached its target.

This structure will generate a compiler warning, as it is possible to create a very long scan time with loops that use Jump instructions. The PLC has a watchdog that will stop the PLC if the scan time is too long.

2. One Cycle per scan - call your routine once per PLC scan, until it has executed the required number of times. This is more in line with traditional PLC function, where the scan time is relatively constant.

You can monitor the actual scan time from SI 0.

Link to comment
Share on other sites

Thank you.

I am using the OPLC V1040-T20B.

I have a unit with some solenoid valves and a ballast tank. I need to open and close the valves to pressurize the system and get to a certain pressure, when the unit reaches that pressure we do a blow down and we need to start the whole process again, all this I must repeat N times.

Link to comment
Share on other sites

  • MVP 2023

Your sequence does not need the speed described by Simon's post. Take a look at the state machine example I posted here:

http://forum.unitronics.com/index.php?/topic/1993-concrete-batching-project/

If you understand this programming concept, it would be easy to add a state that counts to N as part of the sequence and then finishes when your counts are done.

Joe T.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

This site uses cookies. By clicking I accept, you agree to their use.