15.4 Digital Logic, Numbering Systems, and Controller Programming
Key Takeaways
- Relay logic, ladder logic, truth tables, Boolean algebra, and logic gates are five notations for the same information, and the task list requires converting between them.
- A series contact pair is a logical AND; a parallel contact pair is a logical OR; a normally-closed contact used as an input is a NOT.
- Binary, octal, decimal, and hexadecimal are the four numbering systems named on the Competency and Task List; one hexadecimal digit represents exactly four binary bits.
- BAS data points are numeric (analog), Boolean (binary), enumerated (multi-state), or string, and choosing the wrong type makes a value unusable in logic.
- Analog communication transmits a continuously variable signal such as 0-10 VDC or 4-20 mA, while digital communication transmits discrete encoded values and is immune to signal-level drift.
15.4 Digital Logic, Numbering Systems, and Controller Programming
The Building Automation sheet contains a competency block titled Digital Logic and Programming. It requires:
- Comparing the following expressions of logic — relay logic, truth tables, ladder logic, Boolean algebra, logic gates
- Defining decimal, binary, octal, and hexadecimal numbering systems
- Contrasting analog and digital communications
- Defining microprocessor control systems
- Identifying data point types: numeric, Boolean, enumerated, string
- Converting between the different expressions of logic (e.g., relay logic to truth tables)
- Developing flow charts for simple programs
- Connecting a laptop/workstation to a field controller and using it to configure the controller
- Programming controllers using line programming, icon-based programming, or block programming
This is the block that connects the ladder diagrams of Chapter 3 to the DDC controller of Chapter 15. The relay logic a technician already reads on a furnace schematic and the Boolean expression inside a controller are the same statement written two ways.
1. Five Notations, One Statement
Consider a supply fan that must run when the schedule is occupied AND the smoke detector is normal. Here is that single requirement in all five notations the task list names.
Relay logic (physical contacts in series):
L1 ---[ Schedule Relay ]---[ Smoke Det. NC ]---( Fan Starter )--- L2
Ladder logic (the same, drawn as a controller rung):
Occupied Smoke_Normal Fan_Cmd
----] [------------] [--------------------( )----
Logic gate:
Occupied -----|\
| )AND >---- Fan_Cmd
Smoke_Normal -----|/
Boolean algebra:
Truth table:
| Occupied | Smoke_Normal | Fan_Cmd |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
All five say the same thing. The exam asks you to move between them, so learn the three translation rules:
| Circuit arrangement | Logic function | Boolean operator |
|---|---|---|
| Contacts in series | AND | $A \cdot B$ |
| Contacts in parallel | OR | $A + B$ |
| A normally-closed contact used as an input | NOT (inversion) | $\overline{A}$ |
2. The Gates and Their Truth Tables
| Gate | Symbol notation | Output is 1 when… | Boolean |
|---|---|---|---|
| AND | $\cdot$ | all inputs are 1 | $A \cdot B$ |
| OR | $+$ | any input is 1 | $A + B$ |
| NOT (inverter) | overbar | the input is 0 | $\overline{A}$ |
| NAND | not all inputs are 1 | $\overline{A \cdot B}$ | |
| NOR | no input is 1 | $\overline{A + B}$ | |
| XOR (exclusive OR) | $\oplus$ | inputs differ | $A \oplus B$ |
Two-input truth table for the common gates:
| A | B | AND | OR | NAND | NOR | XOR |
|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 1 | 1 | 0 |
| 0 | 1 | 0 | 1 | 1 | 0 | 1 |
| 1 | 0 | 0 | 1 | 1 | 0 | 1 |
| 1 | 1 | 1 | 1 | 0 | 0 | 0 |
Where XOR shows up in HVAC: an XOR of "heating valve open" and "cooling valve open" is a simultaneous heating and cooling alarm — the output is 1 whenever exactly one is open, so a 0 with both open flags the fault. It is also the core of a changeover-mode check.
A Boolean identity worth memorizing (De Morgan's theorem):
In plain language: "not (both)" is the same as "either one is not." This is why a safety chain can be drawn either as a series string of normally-closed safeties feeding an enable, or as a parallel string of alarm flags feeding a shutdown — and why the two drawings are equivalent.
3. Numbering Systems
The task list names four: decimal, binary, octal, hexadecimal. Each is defined by its base — the number of distinct digits it uses.
| System | Base | Digits | Where it appears in BAS |
|---|---|---|---|
| Decimal | 10 | 0–9 | Setpoints, engineering units, device instance numbers |
| Binary | 2 | 0, 1 | The controller's native form; binary points; DIP-switch addressing |
| Octal | 8 | 0–7 | Legacy addressing and some file permissions; rare in modern BAS |
| Hexadecimal | 16 | 0–9, A–F | MAC addresses, IP notation in some tools, memory addresses, protocol frames |
Place values. Each column is the base raised to its position, counting from zero on the right.
Binary $1011_2$:
Hexadecimal $2F_{16}$:
The conversion shortcut that matters most. One hexadecimal digit represents exactly four binary bits, because $16 = 2^4$. So converting between binary and hex requires no arithmetic — just group the bits in fours from the right:
The same trick works for octal in groups of three bits, because $8 = 2^3$.
| Decimal | Binary | Octal | Hex |
|---|---|---|---|
| 0 | 0000 | 0 | 0 |
| 5 | 0101 | 5 | 5 |
| 8 | 1000 | 10 | 8 |
| 10 | 1010 | 12 | A |
| 15 | 1111 | 17 | F |
| 16 | 10000 | 20 | 10 |
| 255 | 11111111 | 377 | FF |
Why a service technician cares: an 8-bit value tops out at $2^8 - 1 = 255$, which is why so many limits in networking are 255 and why a DIP-switch address block of eight switches addresses 0 through 255. When a tool reports a device address as 1A and the drawing says 26, they are the same device — $1A_{16} = 26_{10}$.
4. Analog Versus Digital Communication
| Analog | Digital | |
|---|---|---|
| Signal | Continuously variable | Discrete encoded states |
| HVAC examples | 0–10 VDC, 4–20 mA, 0–135 Ω, 3–15 psi pneumatic | BACnet MS/TP, Modbus RTU, Ethernet |
| Conductors per value | One pair per point | One pair carries hundreds of points |
| Effect of noise / voltage drop | Directly corrupts the value | Rejected until the error is large enough to break the frame |
| Diagnostics available | The value only | Value plus status, reliability flag, units, alarm state |
| Failure mode | Silent drift — a wrong number that looks right | Loud — the point goes offline or unreliable |
The 4–20 mA advantage is worth understanding: because it is a current loop, series resistance in the wire does not change the current, so long runs do not shift the reading the way a 0–10 VDC signal does. And because the live zero is 4 mA, a broken wire reads 0 mA — a value outside the valid range, which the controller can flag as a fault. A 0–10 VDC signal with a broken wire reads 0 V, which is indistinguishable from a legitimate 0% command. This is the classic exam contrast.
A microprocessor control system is any system in which a programmed processor reads inputs, executes stored logic on a repeating scan cycle, and writes outputs. The distinction from electromechanical control is that the behavior lives in software, so changing the sequence changes no wiring — and equally, a logic error changes nothing visible in the panel.
5. Data Point Types
The task list requires identifying numeric, Boolean, enumerated, and string data points. Choosing the wrong type is a common commissioning error because the point will display correctly and still be unusable in logic.
| Type | Holds | BACnet object | Example |
|---|---|---|---|
| Numeric (analog) | A continuous value with engineering units | Analog Input / Output / Value | 72.4 °F; 1.25 in. w.c.; 43% |
| Boolean (binary/digital) | Exactly two states | Binary Input / Output / Value | Fan status On/Off; alarm True/False |
| Enumerated (multi-state) | One of a defined list of named states | Multi-state Input / Output / Value | Mode = {Off, Heat, Cool, Auto}; Occupancy = {Occupied, Unoccupied, Standby} |
| String | Text | Character String Value | Equipment tag; alarm message; a technician's note |
Why the distinction bites. An operating mode with four states written as a numeric point stores 0, 1, 2, 3 with no labels — the graphic shows "2" and nobody remembers what 2 means. Written as an enumerated point it shows "Cool," and logic can test for the named state. Conversely, a value stored as a string cannot be compared numerically or trended: "72.4" as text will not drive a control loop, even though it looks identical on screen.
6. Flow Charts and Programming Methods
Flow charts are a named competency, used to document a sequence before writing it. The standard shapes: an oval terminator for start/stop, a rectangle for a process or action, a diamond for a decision with labeled Yes/No branches, and a parallelogram for input/output.
Drawing this before programming exposes the questions that matter — what happens if status never proves, what the dampers do in unoccupied mode — while they are still cheap to answer.
Three programming methods, all named on the task list:
| Method | What it looks like | Strengths |
|---|---|---|
| Line programming | Text statements, one per line, in a manufacturer's control language | Compact, powerful, easy to diff and archive; steepest learning curve |
| Block (function block) programming | Graphical blocks — PID, AND, timer, comparator — wired together | Data flow is visible; the standard for Niagara-style tools |
| Icon-based programming | Pre-built application icons dragged onto a canvas and parameterized | Fastest; least flexible; closest to a configurable controller |
Connecting to the controller. Field controllers expose a service port — USB, a serial jack, or an IP connection. The workflow does not change with the programming method: connect, upload and archive the running program, edit offline, download, then verify with live point values and a functional test. Never edit live on a running controller in an occupied building unless the change is trivial and reversible.
Documentation is part of programming. Comment the logic, keep the archived program with the address schema and the points list (Section 15.7), and label the controller with the file name of its program. A brilliant sequence nobody can find the source for is a controller that gets replaced instead of repaired.
A safety string consists of a high-limit switch and a low-limit switch, both normally closed, wired in series ahead of a burner relay. Which single statement expresses this arrangement?
A commissioning tool reports a field device's address as hexadecimal 2C, while the submittal drawing lists that device at address 44. What is the situation?
A rooftop unit's operating mode is stored as a numeric analog point holding 0, 1, 2, or 3. The graphic shows '2' and no one can tell what mode that is. What point type should have been used?