Jump to content

Recommended Posts

Posted

Greeting all,

There is a "default return" placed by the VisiLogic software in every subroutine that cannot be deleted. This return then only allows the sub to run for 1 scan before returning. I need to stay in the sub and wait for an input before returning. I have tried placing a loop ahead of this return but that results in a watchdog error.

I am sure that there is a common method of dealing with this or my thinking is not in line with the way the software is supposed to work. Any advise is greatly appreciated. A screenshot is attached.

Thank you

  • MVP 2023
Posted

A PLC scan can not be stopped by design. That's the reason for the watchdog, and the main difference between a PLC program and a computer program.

Here's how the scan works:

1. Read inputs

2. Solve logic, read/write internal memory as needed

3. Write outputs

4. Service COM port and do general housekeeping

5. Repeat

As you can see, if the input wasn't on when the logic started and you try to use an input to hold the return, the inputs won't be scanned again and your program will barf. Not having seen the program, I don't know what you're trying to do. You may want to put the logic that depends on this input into a subroutine and call that subroutine from the main on a positive transition of the input.

Joe T.

Posted

Thank you for the response Joe,

I was not anticipating stopping the scan but simply only scanning that subroutine until the inputs directed the return out of it. I see that my fundemental thinking is not correct so I need to hit the drawing board with this new knowledge!!

Thank you again Joe for the help

Rich Honchen

A PLC scan can not be stopped by design. That's the reason for the watchdog, and the main difference between a PLC program and a computer program.

Here's how the scan works:

1. Read inputs

2. Solve logic, read/write internal memory as needed

3. Write outputs

4. Service COM port and do general housekeeping

5. Repeat

As you can see, if the input wasn't on when the logic started and you try to use an input to hold the return, the inputs won't be scanned again and your program will barf. Not having seen the program, I don't know what you're trying to do. You may want to put the logic that depends on this input into a subroutine and call that subroutine from the main on a positive transition of the input.

Joe T.

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.