{
  "version": 2,
  "name": "PLC System Bits: First Scan and Clock Pulses (Control Panel)",
  "exported": "2026-11-23T00:00:00.000Z",
  "notes": "Control Panel scene example for the system bits tutorial. X1 = Start (N.O.), X2 = Stop (N.C., ON when not pressed), X3 = Jog (N.O.), used here as Acknowledge. Y1 = motor run pilot light. C1 = motor run (seal-in), C2 = power-up flag, C3 = run time done. D1 = run seconds, D2 = run time preset. SB3 (first scan) latches C2 and loads D1 and D2 on every STOP to RUN. SB5 (0.5 s clock) flashes the light fast while C2 is on; SB6 (1 s clock) flashes it slowly when the run time is done. A P contact on SB6 gives one pulse per second for the run-seconds count. No timers are used.",
  "program": [
    {
      "id": 1,
      "rn": 0,
      "comment": "FIRST SCAN — SB3 is ON for one scan after STOP to RUN. Latch the power-up flag: the light flashes fast until someone acknowledges",
      "elements": [
        {
          "id": 101,
          "kind": "contact",
          "type": "XIC",
          "addr": "SB3"
        },
        {
          "id": 102,
          "kind": "output",
          "type": "OTL",
          "addr": "C2"
        }
      ]
    },
    {
      "id": 2,
      "rn": 1,
      "comment": "FIRST SCAN — load the default run time (10 s). D registers survive STOP, so the first scan puts them back to known values",
      "elements": [
        {
          "id": 103,
          "kind": "contact",
          "type": "XIC",
          "addr": "SB3"
        },
        {
          "id": 104,
          "kind": "block",
          "type": "MOV",
          "addr": "D2",
          "src": "10",
          "dt": "INT",
          "pre": 0
        }
      ]
    },
    {
      "id": 3,
      "rn": 2,
      "comment": "FIRST SCAN — clear the run-seconds register so a new RUN starts from zero",
      "elements": [
        {
          "id": 105,
          "kind": "contact",
          "type": "XIC",
          "addr": "SB3"
        },
        {
          "id": 106,
          "kind": "block",
          "type": "MOV",
          "addr": "D1",
          "src": "0",
          "dt": "INT",
          "pre": 0
        }
      ]
    },
    {
      "id": 4,
      "rn": 3,
      "comment": "ACKNOWLEDGE — Jog (X3) clears the power-up flag. Start is blocked until it is cleared",
      "elements": [
        {
          "id": 107,
          "kind": "contact",
          "type": "XIC",
          "addr": "X3"
        },
        {
          "id": 108,
          "kind": "output",
          "type": "OTU",
          "addr": "C2"
        }
      ]
    },
    {
      "id": 5,
      "rn": 4,
      "comment": "NEW RUN — each Start press zeroes the run seconds",
      "elements": [
        {
          "id": 109,
          "kind": "contact",
          "type": "P",
          "addr": "X1"
        },
        {
          "id": 110,
          "kind": "contact",
          "type": "XIO",
          "addr": "C2"
        },
        {
          "id": 111,
          "kind": "block",
          "type": "MOV",
          "addr": "D1",
          "src": "0",
          "dt": "INT",
          "pre": 0
        }
      ]
    },
    {
      "id": 6,
      "rn": 5,
      "comment": "RUN TIME DONE — C3 is ON once the run seconds reach the preset",
      "elements": [
        {
          "id": 112,
          "kind": "compare",
          "type": "GEQ",
          "addr": "D1",
          "cmp": "D2",
          "dt": "INT"
        },
        {
          "id": 113,
          "kind": "output",
          "type": "OTE",
          "addr": "C3"
        }
      ]
    },
    {
      "id": 7,
      "rn": 6,
      "comment": "MOTOR RUN — seal-in on C1. Stop (X2, N.C.), the power-up flag and run time done all drop it",
      "elements": [
        {
          "id": 116,
          "kind": "parallel",
          "branches": [
            [
              {
                "id": 114,
                "kind": "contact",
                "type": "XIC",
                "addr": "X1"
              }
            ],
            [
              {
                "id": 115,
                "kind": "contact",
                "type": "XIC",
                "addr": "C1"
              }
            ]
          ]
        },
        {
          "id": 117,
          "kind": "contact",
          "type": "XIC",
          "addr": "X2"
        },
        {
          "id": 118,
          "kind": "contact",
          "type": "XIO",
          "addr": "C2"
        },
        {
          "id": 119,
          "kind": "contact",
          "type": "XIO",
          "addr": "C3"
        },
        {
          "id": 120,
          "kind": "output",
          "type": "OTE",
          "addr": "C1"
        }
      ]
    },
    {
      "id": 8,
      "rn": 7,
      "comment": "RUN SECONDS — the RISING EDGE of the 1 s clock (SB6) is one pulse per second. A plain SB6 contact would add 5 per second",
      "elements": [
        {
          "id": 121,
          "kind": "contact",
          "type": "P",
          "addr": "SB6"
        },
        {
          "id": 122,
          "kind": "contact",
          "type": "XIC",
          "addr": "C1"
        },
        {
          "id": 123,
          "kind": "block",
          "type": "INC",
          "addr": "D1",
          "pre": 0,
          "dt": "INT"
        }
      ]
    },
    {
      "id": 9,
      "rn": 8,
      "comment": "PILOT LIGHT — steady = running · fast flash (0.5 s clock) = acknowledge needed · slow flash (1 s clock) = run time done",
      "elements": [
        {
          "id": 129,
          "kind": "parallel",
          "branches": [
            [
              {
                "id": 124,
                "kind": "contact",
                "type": "XIC",
                "addr": "C1"
              }
            ],
            [
              {
                "id": 125,
                "kind": "contact",
                "type": "XIC",
                "addr": "C2"
              },
              {
                "id": 126,
                "kind": "contact",
                "type": "XIC",
                "addr": "SB5"
              }
            ],
            [
              {
                "id": 127,
                "kind": "contact",
                "type": "XIC",
                "addr": "C3"
              },
              {
                "id": 128,
                "kind": "contact",
                "type": "XIC",
                "addr": "SB6"
              }
            ]
          ]
        },
        {
          "id": 130,
          "kind": "output",
          "type": "OTE",
          "addr": "Y1"
        }
      ]
    }
  ],
  "comments": {
    "X1": "Start PB",
    "X2": "Stop PB (N.C.)",
    "X3": "Acknowledge (Jog)",
    "Y1": "Motor Run Light",
    "C1": "Motor Run",
    "C2": "Power-Up Flag",
    "C3": "Run Time Done",
    "D1": "Run Seconds",
    "D2": "Run Time Preset"
  }
}