B9X Ladder Editor Language Reference
Version 1.50 – B9X Basic and Arduino Exports
B9X Ladder Editor is a graphical control-programming environment based on relay ladder logic. Use this reference to design, document, save, and export complete ladder programs.
Overview and Quick Start
What B9X Ladder Editor is
B9X Ladder Editor is a graphical control-programming environment based on relay ladder logic. A program is built from horizontal rungs. Contacts and comparison elements form a condition on the left; coils, timers, counters, assignments, calls, and other actions appear toward the right. The completed project can be saved, reopened, reviewed, and exported as B9X Basic or Arduino source.
How to use this reference
Begin with the quick-start workflow, then use the element reference while building rungs. The operators and expressions chapter explains how series and parallel paths combine. The design and troubleshooting chapters cover reliable program structure. Examples are intentionally small so each rule is visible.
Language scope
The ladder language is graphical. Terms such as operator, statement, clause, and expression describe the behavior of rungs and elements; users do not type a separate textual ladder syntax. Function calls and include elements connect ladder conditions to customer-supplied B9X Basic or Arduino routines.
Create a project
Add a rung, place the required contacts from left to right, add an output or action, select each element, enter its Label, GPIO, Value, and Debounce settings as applicable, and choose Apply. Add a clear rung comment. Repeat for each operation.
Test the logic on paper
Read every rung from left to right and the project from top to bottom. Verify what happens when every input is 0, when each input changes, when timers finish, and when resets occur. Confirm that mutually exclusive outputs cannot be true together.
Save and export
Use Save App to preserve the editable ladder project. Use Load App to reopen it. Export B9X Basic .bas for B9X Basic or Export Arduino .ino for Arduino. A compressed Arduino option is available when a compact sketch is preferred. The configured rung limit is checked before export.
Ladder Language Fundamentals
Program scan
A ladder program is evaluated repeatedly from the first rung to the last. Within each rung, contact groups form the condition and actions operate from that condition. Rung order therefore affects behavior.
Rung anatomy
- Contacts and comparisons form the condition.
- Series groups produce AND logic.
- Parallel branch contacts produce OR logic.
- Coils and control blocks perform actions.
- A rung comment records intent and assumptions.
Fields and Data Types
Element fields
| Field | Meaning | Rules |
|---|---|---|
| Label | Symbolic name, message, or function/block name. | Use descriptive names. Cross-references must match exactly. |
| GPIO | Physical digital pin for an input or output. | Leave blank for internal elements. Do not use GPIO as a general value field. |
| Value / Comment | Shared field for presets, thresholds, assignments, paths, sequence steps, and rung comments. | Its meaning depends on the selected element. |
| Debounce | Input stabilization time from 0 to 5000 milliseconds. | Used for physical GPIO contacts and edge contacts; use 0 when not needed. |
| Coil mode | OUT, SET, or RST. | OUT follows the rung; SET latches on; RST clears. |
| Rung comment | Plain-language purpose and assumptions for the selected rung. | Comments are saved and carried into exports. |
Data types
| Type | Representation | Typical uses |
|---|---|---|
| Boolean/state | 0 or 1 | Digital inputs, OUT/SET/RST coils, internal permissives, one-shot states. |
| Numeric | Numeric value | ADC and temperature readings, comparison values, SET DBL variables, timer/counter support values. |
| String | Text | SET STR and PRINT. B9X Basic string names use a trailing $, such as message$. |
| Digital input | Physical logic level | NO, NC, rising-edge, and falling-edge contacts with a GPIO. |
| Digital output | Physical logic level | A coil with an assigned GPIO. |
| Timer state | Running, elapsed/done concept | TON, TOF, TP, RTO and timer-done contacts. |
| Counter state | Count and done concept | CTU, CTD, counter-done contacts, and reset. |
| Sequencer state | Current step and done concept | SEQ, SEQ STEP, SEQ DONE, and SEQ RST. |
Naming rules
- Begin names with a letter and use descriptive letters, digits, and underscores.
- Use the same spelling and capitalization for every reference.
- Use a trailing dollar sign for B9X Basic strings, such as message$.
- Leave GPIO blank for internal states and non-I/O elements.
Operators, Statements, Clauses, and Expressions
| Graphical/operator form | Meaning | Evaluation | Example |
|---|---|---|---|
| Series connection | AND | Every series group must be true. | Start AND StopHealthy AND NoAlarm |
| Parallel branch group | OR | At least one contact in the group must be true. | StartA OR StartB |
| Normally-closed contact | NOT / inverse test | True when the tested state is 0. | NOT alarmActive |
| > | Greater than | Left numeric tag is greater than Value. | temperature > 80 |
| < | Less than | Left numeric tag is less than Value. | level < 20 |
| = | Equal | Numeric tag equals Value. | mode = 2 |
| >= | Greater than or equal | Numeric tag is at least Value. | pressure >= 100 |
| <= | Less than or equal | Numeric tag is no greater than Value. | speed <= 500 |
| <> | Not equal | Numeric tag differs from Value. | errorCode <> 0 |
| Rising edge | 0 to 1 transition | True for one scan on an off-to-on change. | partSensor rises |
| Falling edge | 1 to 0 transition | True for one scan on an on-to-off change. | doorSwitch falls |
Statements
A statement is an action controlled by a rung expression: a coil, timer, counter, reset, sequencer, assignment, print, call, or include action.
Clauses
A rung is equivalent to a conditional clause: when the combined contact expression is true, perform the action. Inverse behavior is formed with NC contacts or complementary comparisons.
Expressions
- Boolean series/parallel expressions
- Numeric comparisons
- Rising and falling edge expressions
- Timer/counter/sequencer done expressions
- Coil and internal-state expressions
Complete Element Reference
Each example appears before the resulting value or state.
Contacts
NO – Normally-open contact
Purpose. Tests a digital input or Boolean tag for an ON state.
Fields. Label: tag name. GPIO: physical input pin or blank for an internal tag. Debounce: 0 to 5000 ms.
Behavior. The contact is true when its tag value is 1. In series it participates in AND logic; in a branch group it participates in OR logic.
Use NO startButton on GPIO 13 ahead of an OUT coil named motorRelay.
Resulting value or state. The rung path through this contact is true while startButton is 1.
NC – Normally-closed contact
Purpose. Tests a digital input or Boolean tag for an OFF state.
Fields. Label: tag name. GPIO: physical input pin or blank. Debounce: 0 to 5000 ms.
Behavior. The contact is true when its tag value is 0. It is the logical inverse of a normally-open test.
Use NC stopButton on GPIO 14 in series with the motor start path.
Resulting value or state. The path remains true while stopButton is 0 and becomes false when it is 1.
↑ – Rising-edge contact
Purpose. Creates a one-scan condition when an input changes from OFF to ON.
Fields. Label: tag name. GPIO: physical input pin. Debounce: 0 to 5000 ms.
Behavior. The contact is true only during the scan that detects a 0-to-1 transition.
Place ↑ partSensor on GPIO 12 ahead of a CTU counter.
Resulting value or state. One count request is produced for each detected rising transition.
↓ – Falling-edge contact
Purpose. Creates a one-scan condition when an input changes from ON to OFF.
Fields. Label: tag name. GPIO: physical input pin. Debounce: 0 to 5000 ms.
Behavior. The contact is true only during the scan that detects a 1-to-0 transition.
Place ↓ doorSwitch ahead of a SET coil named doorWasClosed.
Resulting value or state. doorWasClosed is set once when doorSwitch changes from 1 to 0.
Coil NO – Coil-state normally-open contact
Purpose. Tests the state of a coil or internal Boolean tag.
Fields. Label: the exact coil or internal state name. GPIO is not used.
Behavior. The contact is true while the named state equals 1.
Use Coil NO motorRelay in parallel with the Start contact to make a seal-in path.
Resulting value or state. The parallel path remains true after Start is released while motorRelay remains on.
Coil NC – Coil-state normally-closed contact
Purpose. Tests the inverse state of a coil or internal Boolean tag.
Fields. Label: the exact coil or internal state name. GPIO is not used.
Behavior. The contact is true while the named state equals 0.
Use Coil NC alarmActive in series with a normal-operation output.
Resulting value or state. The path is enabled only while alarmActive is off.
Branches
Branch NO – Parallel normally-open contact
Purpose. Adds a normally-open alternative path at the selected series position.
Fields. Select an existing contact first; then assign Label, GPIO, and Debounce as needed.
Behavior. All contacts in the same branch group are ORed.
Place Start A and Start B in the same branch group ahead of one motor coil.
Resulting value or state. The group is true when Start A OR Start B is true.
Branch NC – Parallel normally-closed contact
Purpose. Adds a normally-closed alternative path at the selected series position.
Fields. Select a contact, choose Branch NC, then set its label, GPIO, and debounce.
Behavior. The branch is true when the new contact value is 0.
Branch NC manualMode in parallel with NO automaticPermit.
Resulting value or state. The group is true when manualMode is 0 OR automaticPermit is 1.
B Coil NO / B Coil NC – Parallel coil-state contact
Purpose. Adds an internal-state alternative path without assigning a GPIO.
Fields. Label: exact coil or state name.
Behavior. B Coil NO is true for state 1; B Coil NC is true for state 0.
Add B Coil NO motorRelay beside NO startButton.
Resulting value or state. The branch group stays true through motorRelay after the Start button is released.
Branch ↑ / Branch ↓ – Parallel edge contact
Purpose. Adds a transition-sensitive alternative path.
Fields. Label, GPIO, and debounce identify the physical event input.
Behavior. The branch contributes a one-scan true state on the selected transition.
Place rising events from sensorA and sensorB in one branch group.
Resulting value or state. The group pulses when either sensor produces the selected edge.
Outputs
OUT – Output coil
Purpose. Makes an output or Boolean state follow the complete rung condition.
Fields. Label: output/state name. GPIO: physical output pin or blank for an internal state. Mode: OUT.
Behavior. The output is set to 1 when the rung is true and 0 when the rung is false.
NO enableSwitch followed by OUT fanRelay on GPIO 18.
Resulting value or state. fanRelay and GPIO 18 follow enableSwitch.
SET – Set coil
Purpose. Latches an output or internal state on.
Fields. Label: output/state name. GPIO: output pin or blank. Mode: SET.
Behavior. When the rung becomes true, the state is assigned 1 and remains 1 after the rung becomes false.
Rising-edge faultSensor followed by SET alarmLatched.
Resulting value or state. alarmLatched remains 1 until a RESET coil clears it.
RST – Reset coil
Purpose. Clears a latched output or internal state.
Fields. Label and GPIO must identify the same state used by SET. Mode: RESET.
Behavior. When the rung is true, the state is assigned 0.
NO resetButton followed by RST alarmLatched.
Resulting value or state. alarmLatched becomes 0 while the reset condition is true.
Timers
TON – On-delay timer
Purpose. Delays the timer-done state after the rung condition turns on.
Fields. Label: timer name. Value: preset time in milliseconds.
Behavior. Timing begins when the rung becomes true. Done becomes true after the condition stays true for the preset. A false rung clears normal TON timing.
NO startRequest followed by TON startDelay with Value 5000.
Resulting value or state. startDelay done becomes 1 after startRequest remains true for 5 seconds.
TOF – Off-delay timer
Purpose. Delays the timer-done state from turning off after the rung condition turns off.
Fields. Label: timer name. Value: off-delay in milliseconds.
Behavior. Done is true while the rung is true and remains true for the preset interval after the rung becomes false.
NO occupancy followed by TOF lightDelay with Value 30000.
Resulting value or state. lightDelay done remains true for 30 seconds after occupancy turns off.
TP – Pulse timer
Purpose. Produces a timed pulse from a triggering condition.
Fields. Label: timer name. Value: pulse width in milliseconds.
Behavior. A trigger starts a pulse whose done state remains true for the preset duration.
↑ triggerButton followed by TP hornPulse with Value 1000.
Resulting value or state. hornPulse done stays true for approximately 1 second per accepted trigger.
RTO – Retentive on-delay timer
Purpose. Accumulates enabled time across interruptions.
Fields. Label: timer name. Value: accumulated-time preset in milliseconds.
Behavior. Elapsed enabled time is retained when the rung becomes false. Done becomes true when accumulated time reaches the preset.
NO pumpRunning followed by RTO serviceTimer with Value 3600000.
Resulting value or state. serviceTimer done becomes true after one accumulated hour of pump operation.
T DN NO – Timer-done normally-open contact
Purpose. Tests whether a named timer is done.
Fields. Label: exact TON, TOF, TP, or RTO name. GPIO is not used.
Behavior. The contact is true when the timer done state equals 1.
T DN NO startDelay followed by OUT motorRelay.
Resulting value or state. motorRelay turns on after startDelay becomes done.
T DN NC – Timer-done normally-closed contact
Purpose. Tests whether a named timer is not done.
Fields. Label: exact timer name. GPIO is not used.
Behavior. The contact is true while the timer done state equals 0.
T DN NC warmup followed by OUT warmingLamp.
Resulting value or state. warmingLamp remains on until warmup is done.
T RST – Timer restart/reset
Purpose. Restarts or clears the named timer state.
Fields. Label: exact timer name.
Behavior. When its rung condition is true, the timer is returned to its restart state.
NO resetButton followed by T RST serviceTimer.
Resulting value or state. serviceTimer timing and done state are cleared/restarted.
Counters
CTU – Count-up counter
Purpose. Counts false-to-true transitions of its rung condition.
Fields. Label: counter name. Value: positive preset count.
Behavior. The count increases once per condition transition. Done becomes true when count reaches the preset.
↑ partSensor followed by CTU batchCount with Value 10.
Resulting value or state. batchCount done becomes 1 when ten accepted part events have occurred.
CTD – Count-down counter
Purpose. Counts downward from a preset on condition transitions.
Fields. Label: counter name. Value: starting count.
Behavior. Each accepted transition decreases the count. Done becomes true when the count reaches zero.
↑ dispenseEvent followed by CTD itemsRemaining with Value 25.
Resulting value or state. itemsRemaining done becomes 1 after 25 accepted events.
C DN NO – Counter-done normally-open contact
Purpose. Tests whether a named counter is done.
Fields. Label: exact CTU or CTD name.
Behavior. The contact is true when the counter done state equals 1.
C DN NO batchCount followed by SET batchComplete.
Resulting value or state. batchComplete is latched when the counter reaches its preset.
C DN NC – Counter-done normally-closed contact
Purpose. Tests whether a named counter is not done.
Fields. Label: exact CTU or CTD name.
Behavior. The contact is true while the counter done state equals 0.
C DN NC batchCount followed by OUT conveyorEnable.
Resulting value or state. conveyorEnable remains on until the batch count is complete.
C RST – Counter reset
Purpose. Clears the named counter.
Fields. Label: exact counter name.
Behavior. When the rung is true, count, done, and event-history state are reset.
NO newBatchButton followed by C RST batchCount.
Resulting value or state. batchCount returns to its reset state for a new batch.
Analog and temperature
ADC – Analog input
Purpose. Reads a calibrated analog channel into a numeric tag.
Fields. Label: numeric tag. Value/ADC channel: 0, 1, 2, or 3.
Behavior. The tag is refreshed during program scanning and can be tested by comparison contacts.
ADC tankLevel using channel 0, followed elsewhere by > tankLevel with Value 2500.
Resulting value or state. tankLevel contains the current calibrated reading; the comparison is true above 2500.
TEMP – Temperature input
Purpose. Reads a supported temperature sensor into a numeric tag.
Fields. Label: temperature tag. Value: sensor data GPIO required by the target hardware configuration.
Behavior. The numeric reading is refreshed and can be used by comparison contacts.
TEMP roomTemperature with Value 4, then < roomTemperature with Value 68.
Resulting value or state. The comparison becomes true when roomTemperature is below 68.
Comparisons
> – Greater-than comparison
Purpose. Tests whether a numeric tag is greater than a value.
Fields. Label: numeric tag. Value: threshold or valid numeric expression.
Behavior. Acts as a contact and may be placed in series or parallel.
> tankLevel with Value 2500 followed by OUT highLevelAlarm.
Resulting value or state. The path is true when tankLevel > 2500.
< – Less-than comparison
Purpose. Tests whether a numeric tag is less than a value.
Fields. Label: numeric tag. Value: threshold.
Behavior. Acts as a contact.
< roomTemperature with Value 68 followed by OUT heater.
Resulting value or state. The path is true when roomTemperature < 68.
= – Equal comparison
Purpose. Tests whether a numeric tag equals a value.
Fields. Label: numeric tag. Value: comparison value.
Behavior. Acts as a contact using numeric equality.
= operatingMode with Value 2 followed by OUT automaticModeLamp.
Resulting value or state. The path is true when operatingMode equals 2.
>= – Greater-than-or-equal comparison
Purpose. Tests whether a numeric tag is at least a value.
Fields. Label: numeric tag. Value: threshold.
Behavior. Acts as a contact.
>= pressure with Value 100 followed by SET pressureAlarm.
Resulting value or state. The path is true when pressure is 100 or greater.
<= – Less-than-or-equal comparison
Purpose. Tests whether a numeric tag is no greater than a value.
Fields. Label: numeric tag. Value: threshold.
Behavior. Acts as a contact.
<= speed with Value 500 followed by OUT lowSpeedPermit.
Resulting value or state. The path is true when speed is 500 or less.
<> – Not-equal comparison
Purpose. Tests whether a numeric tag differs from a value.
Fields. Label: numeric tag. Value: comparison value.
Behavior. Acts as a contact.
<> errorCode with Value 0 followed by SET alarmActive.
Resulting value or state. The path is true whenever errorCode is not zero.
Control
ONE SHOT – One-shot output
Purpose. Creates an internal pulse that is true for one scan on a false-to-true rung transition.
Fields. Label: pulse tag. GPIO is not used.
Behavior. The pulse tag is set for one scan, then automatically returns to 0.
NO cycleStart followed by ONE SHOT startPulse; use Coil NO startPulse in another rung.
Resulting value or state. startPulse is 1 for one scan per new cycleStart activation.
SEQ – Sequencer
Purpose. Maintains an integer step and advances it on accepted rung transitions.
Fields. Label: sequencer name. Value: number of steps supported by the selected export target.
Behavior. A new triggering transition advances the current step. Step and done contacts coordinate staged operation.
TP cyclePulse followed by SEQ trafficSequence with Value 4.
Resulting value or state. trafficSequence advances through its configured step states.
SEQ STEP – Sequencer step contact
Purpose. Tests whether a sequencer is at a specified step.
Fields. Label: exact sequencer name. Value: requested step number. GPIO is not used.
Behavior. The contact is true only while the current step equals the selected value.
SEQ STEP trafficSequence with Value 1 followed by OUT yellowLight.
Resulting value or state. yellowLight is enabled while trafficSequence is at step 1.
SEQ DONE – Sequencer done contact
Purpose. Tests the completion state of a sequencer.
Fields. Label: exact sequencer name.
Behavior. The contact becomes true at the sequencer completion state.
SEQ DONE washCycle followed by SET cycleComplete.
Resulting value or state. cycleComplete is latched when washCycle reports done.
SEQ RST – Sequencer reset
Purpose. Returns a sequencer to its initial step.
Fields. Label: exact sequencer name.
Behavior. When the rung is true, step, done, and edge-history state are reset.
NO resetButton followed by SEQ RST washCycle.
Resulting value or state. washCycle returns to its initial state.
Functions and inclusion
CALL – Conditional function call
Purpose. Calls a named B9X Basic or Arduino function when the rung is true.
Fields. Label: function name. The function must exist in the destination project.
Behavior. The function is invoked during each scan in which the rung condition is true.
C DN NO batchCount followed by CALL reportBatchComplete.
Resulting value or state. Control returns to the ladder scan after reportBatchComplete finishes.
CALL INITIALIZATION – Initialization function call
Purpose. Calls a named function once during startup before repeated ladder scanning begins.
Fields. Label: function name. Put this element on its own rung.
Behavior. The function is placed in the initialization portion of the export.
CALL INITIALIZATION initializeDisplay on a dedicated rung.
Resulting value or state. Control returns after initializeDisplay finishes, then normal scanning begins.
INCLUDE FILE – Conditional include file
Purpose. Includes the contents of a customer-supplied text/source file under a rung condition.
Fields. Label: descriptive block name. Value: exact existing file path selected through the editor.
Behavior. The included text is exported verbatim at the conditional location.
NO alarmActive followed by INCLUDE FILE named customAlarm using an existing alarm source file.
Resulting value or state. The supplied file contents execute under the alarmActive condition.
INCLUDE INIT – Initialization include file
Purpose. Includes customer-supplied text/source verbatim in the startup area.
Fields. Label: descriptive block name. Value: exact existing file path.
Behavior. The contents are placed before repeated ladder scanning.
INCLUDE INIT named startupDefinitions using an existing initialization file.
Resulting value or state. The supplied initialization content is included once in the exported program.
Data and diagnostics
PRINT – Print text or string
Purpose. Prints quoted text or a string variable when the rung is true.
Fields. Label: quoted text such as "Ready" or a B9X Basic string variable such as message$.
Behavior. Printing occurs during every scan for which the rung remains true.
↑ startButton followed by PRINT with Label "Cycle started".
Resulting value or state. The message is printed once for the rising-edge event.
PRINT DBL – Print numeric value
Purpose. Prints a numeric variable when the rung is true.
Fields. Label: numeric variable name.
Behavior. The current numeric value is printed each time the action executes.
↑ sampleButton followed by PRINT DBL temperature.
Resulting value or state. The current value of temperature is printed once per button transition.
SET DBL – Set numeric variable
Purpose. Assigns a numeric value or expression to a numeric variable.
Fields. Label: numeric variable name. Value: number or supported numeric expression.
Behavior. The assignment is performed whenever the rung condition is true.
NO recipe2Selected followed by SET DBL targetTemperature with Value 72.5.
Resulting value or state. targetTemperature becomes 72.5.
SET STR – Set string variable
Purpose. Assigns text to a string variable.
Fields. Label: string variable. For B9X Basic use a trailing dollar sign, for example message$. Value: text to assign.
Behavior. The string assignment occurs whenever the rung is true.
C DN NO batchCount followed by SET STR message$ with Value Batch complete.
Resulting value or state. message$ contains "Batch complete".
Editor and Project Commands
| Command | Purpose |
|---|---|
| Apply | Stores edits made to the selected element. |
| Delete | Removes the selected element. |
| Clear | Clears the current editable rung. |
| Add Rung | Adds a new rung to the project. |
| Delete Rung | Removes the selected rung. |
| Move Up / Move Down | Moves the selected rung by one position. |
| Move To Top / Move To Bottom | Moves the selected rung to the first or last position. |
| Delete Branch | Removes the selected branch contact from its parallel group. |
| Apply Rung Comment | Stores the text in the rung comment field. |
| Variables | Shows the variables and state names used by the current project. |
| Rungs Preview | Shows a read-only overview of all rungs. |
| Save App | Saves the editable ladder project. |
| Load App | Loads a previously saved ladder project. |
| Export B9X Basic .bas | Creates B9X Basic source from the ladder project. |
| Export Arduino .ino | Creates a readable Arduino sketch. |
| Export Compressed Arduino .ino | Creates a compact Arduino sketch. |
Export Reference
B9X Basic
Export B9X Basic .bas creates a B9X Basic program. String names use a trailing dollar sign. PRINT accepts quoted text or a string variable; PRINT DBL prints a numeric variable.
Arduino
Export Arduino .ino creates a readable sketch. Export Compressed Arduino .ino creates a compact sketch. Include content must be valid for the selected target.
Rung limit
Export is cancelled if the project exceeds the configured rung limit.
Programming Patterns and Examples
Start/stop seal-in motor
- Rung 1: Branch NO startButton and B Coil NO motorRelay in the same parallel group; place the StopHealthy condition in series; finish with OUT motorRelay.
- Operation: pressing Start turns on motorRelay. Its state contact holds the path after Start is released. Removing StopHealthy breaks the series path and turns the motor off.
- Review: confirm the actual stop circuit produces the intended logical level and use suitable hardware for safety functions.
Five-second delayed output
- Rung 1: NO enableSwitch followed by TON readyDelay, Value 5000.
- Rung 2: T DN NO readyDelay followed by OUT readyLamp.
- Operation: readyLamp turns on after enableSwitch remains true for five seconds and turns off when normal TON timing is cleared.
Ten-part batch counter
- Rung 1: ↑ partSensor followed by CTU partCount, Value 10.
- Rung 2: C DN NO partCount followed by SET batchComplete.
- Rung 3: NO resetButton followed by C RST partCount.
- Rung 4: NO resetButton followed by RST batchComplete.
- Operation: each accepted part edge counts once. The completion state latches at ten and the reset button clears both counter and latch.
Temperature-controlled heater with hysteresis
- Rung 1: TEMP roomTemperature; use < roomTemperature with Value 68 followed by SET heaterDemand.
- Rung 2: > roomTemperature with Value 72 followed by RST heaterDemand.
- Rung 3: Coil NO heaterDemand followed by OUT heaterRelay.
- Operation: the heater turns on below 68 and stays on until temperature rises above 72. The four-degree separation prevents rapid switching near one threshold.
Mutually exclusive outputs
- Use separate step/state conditions for each OUT coil.
- Add Coil NC contacts for every conflicting output when an additional interlock is needed.
- Verify each possible state, including startup and reset, and confirm that no two output conditions can be true during the same scan.
Design Rules and Safety
- Write a clear comment for every rung.
- Use GPIO only for actual physical I/O.
- Use edges or ONE SHOT for actions that must occur once.
- Avoid duplicate OUT writers.
- Give every SET state a reset path.
- Use hysteresis for analog switching.
- Define startup and reset behavior.
- Review rung order and mutually exclusive outputs.
- Use appropriate electrical drivers and protection.
- Do not use ordinary software logic as the only personnel-safety system.
Troubleshooting
| Symptom | Checks |
|---|---|
| Output never turns on | Trace every series group; verify active levels, labels, thresholds, GPIO, and duplicate writers. |
| Output stays on | Check for SET without RST, a seal-in branch, TOF delay, or an unconditional rung. |
| Counter counts too quickly | Use a rising edge or ONE SHOT and appropriate debounce. |
| Print repeats | Trigger PRINT with an edge or ONE SHOT. |
| Timer does not complete | Verify the condition remains true, the preset is milliseconds, and reset is not continuously active. |
| Wrong branch behavior | Same-group contacts are ORed; separate groups are ANDed. |
| Export is blocked | Reduce rung count or use a configuration that permits the project size. |
Glossary
| Term | Definition |
|---|---|
| Action | An element that changes or uses program state. |
| Branch | A parallel OR path. |
| Coil | An output or internal Boolean state. |
| Contact | A true/false condition. |
| Debounce | A time filter for an input transition. |
| Done | A completion state. |
| GPIO | A physical input/output pin. |
| Preset | A configured duration, count, threshold, or size. |
| Rung | One horizontal ladder condition and action. |
| Scan | One top-to-bottom program evaluation. |
| Tag | A symbolic program name. |

