Bird
Raised Fist0
PLC Programmingscripting~5 mins

NOT logic with NC contact in PLC Programming - Time & Space Complexity

Choose your learning style10 modes available
Time Complexity: NOT logic with NC contact
O(n)
Understanding Time Complexity

We want to understand how the time it takes to run a PLC program changes when using NOT logic with a Normally Closed (NC) contact.

Specifically, we ask: How does the program's execution time grow as the number of contacts increases?

Scenario Under Consideration

Analyze the time complexity of the following PLC ladder logic snippet using NC contacts.

// Example PLC code using NOT logic with NC contact
IF NOT Input1 THEN
  Output1 := TRUE;
ELSE
  Output1 := FALSE;
END_IF;

IF NOT Input2 THEN
  Output2 := TRUE;
ELSE
  Output2 := FALSE;
END_IF;

// Repeat for n inputs

This code checks each input using NOT logic on NC contacts and sets outputs accordingly.

Identify Repeating Operations

Look for repeated checks or loops in the code.

  • Primary operation: Checking each input with NOT logic on NC contact.
  • How many times: Once per input, repeated for n inputs.
How Execution Grows With Input

Each input requires one NOT check and one output assignment.

Input Size (n)Approx. Operations
10About 10 NOT checks and 10 output sets
100About 100 NOT checks and 100 output sets
1000About 1000 NOT checks and 1000 output sets

Pattern observation: The number of operations grows directly with the number of inputs.

Final Time Complexity

Time Complexity: O(n)

This means the time to run the program grows in a straight line as the number of NC contacts increases.

Common Mistake

[X] Wrong: "Using NOT logic with NC contacts makes the program run instantly regardless of input count."

[OK] Correct: Each contact still needs to be checked one by one, so more contacts mean more checks and longer execution time.

Interview Connect

Understanding how simple logic like NOT with NC contacts scales helps you explain how PLC programs behave as they grow, a useful skill in real automation work.

Self-Check

What if we combined multiple NC contacts in series instead of checking them separately? How would the time complexity change?

Practice

(1/5)
1. What does a Normally Closed (NC) contact represent in PLC logic?
easy
A. The circuit is ON when the switch is NOT pressed
B. The circuit is ON only when the switch is pressed
C. The circuit is always OFF
D. The circuit toggles ON and OFF automatically

Solution

  1. Step 1: Understand NC contact behavior

    An NC contact means the circuit is closed (ON) when the switch is not pressed.
  2. Step 2: Compare options with NC contact logic

    Only The circuit is ON when the switch is NOT pressed correctly states the circuit is ON when the switch is NOT pressed.
  3. Final Answer:

    The circuit is ON when the switch is NOT pressed -> Option A
  4. Quick Check:

    NC contact = ON when NOT pressed [OK]
Hint: NC means circuit closed when switch is NOT pressed [OK]
Common Mistakes:
  • Confusing NC with Normally Open (NO) contact
  • Thinking circuit is ON when switch is pressed
  • Assuming NC contact toggles automatically
2. Which of the following is the correct PLC ladder logic symbol for a Normally Closed (NC) contact?
easy
A. --|&|--
B. --| |--
C. --|/|--
D. --|X|--

Solution

  1. Step 1: Recall PLC contact symbols

    Normally Open (NO) contact is --| |--, Normally Closed (NC) contact is --|/|--.
  2. Step 2: Match symbol to NC contact

    --|/|-- shows --|/|--, which is the correct NC contact symbol.
  3. Final Answer:

    --|/|-- -> Option C
  4. Quick Check:

    NC contact symbol = --|/|-- [OK]
Hint: NC contact symbol has a slash / inside brackets [OK]
Common Mistakes:
  • Choosing NO contact symbol instead of NC
  • Confusing symbols with AND/OR logic
  • Using invalid or made-up symbols
3. Given this PLC ladder logic snippet with an NC contact labeled Stop controlling output Motor:
--|/|--(Stop)----( )--(Motor)
What happens to Motor when the Stop button is pressed?
medium
A. Motor turns OFF
B. Motor toggles ON and OFF rapidly
C. Motor turns ON
D. Motor state does not change

Solution

  1. Step 1: Understand NC contact effect when pressed

    Pressing the NC contact opens the circuit, breaking the path.
  2. Step 2: Determine output state

    Since the circuit is open, the Motor output coil is not energized and turns OFF.
  3. Final Answer:

    Motor turns OFF -> Option A
  4. Quick Check:

    Pressing NC contact = circuit open = output OFF [OK]
Hint: Pressing NC opens circuit, output turns OFF [OK]
Common Mistakes:
  • Assuming pressing NC turns output ON
  • Thinking output toggles automatically
  • Ignoring NC contact behavior
4. A PLC program uses an NC contact named EmergencyStop to stop a conveyor motor. The motor never stops when the emergency button is pressed. What is the most likely error?
medium
A. The PLC is powered off
B. The NC contact is wired as Normally Open (NO)
C. The emergency button is not pressed long enough
D. The output coil is missing

Solution

  1. Step 1: Analyze symptom

    Motor never stops when emergency button pressed means circuit does not open.
  2. Step 2: Identify wiring error

    If NC contact is wired as NO, pressing button closes circuit instead of opening it, so motor stays ON.
  3. Final Answer:

    The NC contact is wired as Normally Open (NO) -> Option B
  4. Quick Check:

    Wrong contact type wiring = motor won't stop [OK]
Hint: Check contact type wiring if stop fails [OK]
Common Mistakes:
  • Blaming output coil without checking input wiring
  • Assuming button press duration causes issue
  • Ignoring PLC power status
5. You want to design a safety stop circuit using an NC contact SafetySwitch and an output coil MachineRun. Which ladder logic rung correctly implements the NOT logic with the NC contact to stop the machine when the switch is pressed?
hard
A. --| |--(SafetySwitch)----( )--(MachineRun)
B. --| |--(MachineRun)----( )--(SafetySwitch)
C. --|/|--(MachineRun)----( )--(SafetySwitch)
D. --|/|--(SafetySwitch)----( )--(MachineRun)

Solution

  1. Step 1: Identify correct NC contact usage

    Safety stop uses NC contact so circuit is closed (MachineRun ON) when switch NOT pressed.
  2. Step 2: Match ladder logic rung

    --|/|--(SafetySwitch)----( )--(MachineRun) uses NC contact --|/|-- controlling MachineRun output correctly.
  3. Final Answer:

    --|/|--(SafetySwitch)----( )--(MachineRun) -> Option D
  4. Quick Check:

    NC contact before output coil = safety stop logic [OK]
Hint: Use NC contact before output coil for safety stop [OK]
Common Mistakes:
  • Using NO contact instead of NC for safety stop
  • Reversing contact and coil positions
  • Confusing contact labels with output coil
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard