News:

  • April 15, 2026, 10:26:53 PM

Login with username, password and session length

Author Topic: Do bit transition instructions require multiple scans?  (Read 4942 times)

RaymondC

  • Full Member
  • ***
  • Posts: 27
Do bit transition instructions require multiple scans?
« on: August 20, 2020, 02:41:51 PM »
There are quite a few instructions that are triggered by a change in state of a bit or input (leading edge one-shot contact, trailing edge one-shot contact, leading edge one-shot coil, trailing edge one-shot coil, etc.).

It seems that these types of instructions would require multiple scans since they need to compare the current state of a bit to a previously stored state in order to identity a transition. If so, does that mean that these transition-triggered instructions would not work in subroutines, tasks, or any other code block that runs for only a single scan?

franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3803
    • Host Engineering
Re: Do bit transition instructions require multiple scans?
« Reply #1 on: August 20, 2020, 02:58:13 PM »
They are not allowed in subroutines.

They CAN work in a TASK with an ENTASK that is power-flow enabled and run continuously (vs. edge triggered or power-flow enabled with a non-zero interval).

This is one of the types of checks done with the Program Check tool.  Don't just ignore the warnings, they are reported for very good reasons, e.g. the concept of "edge triggered" in code that does not run EVERY scan.  The Help system now gives details/how to fix on every Program Check rule.  If you still have questions, post them here on this forum.

But you figured it out!!   ;D


franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3803
    • Host Engineering
Re: Do bit transition instructions require multiple scans?
« Reply #2 on: August 20, 2020, 03:07:34 PM »
Attached is an example of 3 TASK types that all have edge contacts inside them (one of which does NOT cause a Program Check violation)

RaymondC

  • Full Member
  • ***
  • Posts: 27
Re: Do bit transition instructions require multiple scans?
« Reply #3 on: August 20, 2020, 05:11:43 PM »
Thank you. I appreciate the detailed explanations.