# What Is the Digital Autopilot (DAP) in the Apollo 11 Software?

> Explore the Digital Autopilot DAP a key component of Apollo 11 software. Learn how this AGC module uses IMU data and dead-bands to automatically control spacecraft attitude via RCS thrusters.

- Repository: [Chris Garry/Apollo-11](https://github.com/chrislgarry/Apollo-11)
- Tags: deep-dive
- Published: 2026-03-04

---

**The Digital Autopilot (DAP) is the interrupt-driven software module in the Apollo Guidance Computer (AGC) that automatically controls spacecraft attitude by commanding Reaction Control System (RCS) thrusters based on IMU data and crew-selectable dead-band settings.**

The Digital Autopilot (DAP) is a critical flight software subsystem found in the Apollo 11 AGC source code, specifically within the `chrislgarry/Apollo-11` repository's Luminary 099 (Lunar Module) and Comanche 055 (Command Module) programs. This real-time control system executes at high frequency to maintain spacecraft orientation, filter sensor noise, and fire RCS jets to counteract drift or execute commanded rotations.

## Core Functions of the Apollo 11 Digital Autopilot

The DAP bridges sensor input, guidance calculations, and actuator output under deterministic timing guarantees provided by the AGC’s interrupt system.

### Attitude Control and RCS Thruster Commanding

At its core, the DAP converts desired attitude (gimbal angles) into RCS torque commands. It applies **dead-band** limits to prevent thruster jitter when the spacecraft is within an acceptable error tolerance. When errors exceed the dead-band, the DAP invokes **Jet Selection Logic** to fire the appropriate thrusters.

### Interrupt-Driven Execution Architecture

The DAP operates on high-frequency periodic interrupts to ensure real-time response. In the Lunar Module, the `DAPIDLER_PROGRAM` runs on the **T5 RUPT** (100 Hz), though the main DAP cycle executes at 10 Hz. In the Command Module, the **T4 RUPT** (50 Hz) drives the DAP logic via `RCS-CSM_DIGITAL_AUTOPILOT.agc`.

## Lunar Module DAP Implementation (Luminary 099)

The Lunar Module Digital Autopilot is implemented across several assembly files in the `Luminary099/` directory, handling initialization, mode selection, and rate filtering.

### DAPIDLER_PROGRAM.agc: The LM DAP Heartbeat

The `DAPIDLER_PROGRAM` serves as the entry point for LM attitude control, running 10 times per second after a fresh start or restart. It zeros error registers, sets dead-band parameters, loads Kalman filter gains, and enables the IMU.

When the AGC undergoes a fresh start, the `STARTDAP` routine initializes the DAP state:

```assembly
; Called by the fresh-start entry point
STARTDAP  TC   IBNKCALL          ; Jump to the error-display routine
          FCADR ZATTEROR
          CAF   ZERO            ; Zero all error registers
          TS    TJP
          TS    TJU
          TS    TJV
          ; … zero rate registers, acceleration estimates, etc.
          TC    RESUME          ; Continue normal DAP processing

```

*Source: Lines 91-107 of `Luminary099/DAPIDLER_PROGRAM.agc`*

### DAP_INTERFACE_SUBROUTINES.agc: Dead-Band Management

Crew-selectable dead-band settings allow astronauts to choose between wide (5°), narrow (0.3°), and power-saving modes. The `DAP_INTERFACE_SUBROUTINES` file contains routines like `SETMAXDB`, `SETMINDB`, `RESTORDB`, and `PFLITEDB` that reconfigure the DAP on demand.

When mission control requests a dead-band change, the `RESTORDB` routine checks the `DBSELECT` flag and schedules a `NOVAC` job to reposition the TJETLAW switch curves:

```assembly
; Mission control sends a DAP interface request:
RESTORDB   ; Called to restore the crew-selected dead-band
; Inside RESTORDB:
          CAE   DAPBOOLS
          MASK  DBSELECT
          EXTEND
          BZF   SETMINDB   ; If DBSELECT=0 → use narrow dead-band
          ; otherwise fall through to SETMAXDB

SETMAXDB   CAF   WIDEDB      ; 5° dead-band constant
          TS    DB
          ; Schedule a NOVAC job to reposition the TJETLAW switch curves
          QXCH  RUPTREG1
CALLACCS  CAF   PRIO27
          TC    NOVAC
          EBANK= AOSQ
          2CADR 1/ACCJOB
          TC    RUPTREG1

```

*Source: `Luminary099/DAP_INTERFACE_SUBROUTINES.agc`*

## Command Module DAP Implementation (Comanche 055)

The Command Module Digital Autopilot follows a similar architecture but executes on different interrupt channels and utilizes distinct file organization within `Comanche055/`.

### RCS-CSM_DIGITAL_AUTOPILOT.agc: T5 Interrupt Handler

The CM DAP boots from the T5 interrupt routine defined in `RCS-CSM_DIGITAL_AUTOPILOT.agc`. This file checks the mode-select switch (bits 13-14 of Channel 31) and initializes the DAP state machine. If the mode switch is OFF, the DAP disables itself and suppresses displays via `CHEKBITS` → `MOREIDLE`.

### RCS-CSM_DAP_EXECUTIVE_PROGRAMS.agc: Enabling and Disabling the DAP

Executive control routines in this file manage the DAP's operational state by manipulating the `RCSFLAGS` register. Setting bit 13 of `RCSFLAGS` activates the DAP, while clearing it disables control.

```assembly
; CM executive program enables the DAP (pages 1037-1038)
RCS-CSM_DAP_EXECUTIVE_PROGRAMS.agc
          CS    RCSFLAGS        ; Set bit13 to turn DAP on
          MASK  BIT13
          ADS   RCSFLAGS
          TC    STARTDAP        ; Jump to DAP start routine

```

*Source: `Comanche055/RCS-CSM_DAP_EXECUTIVE_PROGRAMS.agc`*

### TVCDAPS.agc: Torque Command Generation

The `TVCDAPS.agc` file implements the "Digital Autopilot Sub-program" for the Command Module. It computes commanded torques, applies dead-band limits, and invokes jet-selection logic to translate software commands into physical thruster firings. The related `TVCROLLDAP.agc` handles specific roll-axis control logic.

## Rate Filtering and Kalman Estimation

Both LM and CM DAP implementations rely on Kalman-filter-based rate estimators to smooth IMU data and compute true body rates. The LM routines `KALUPDT` and `RATEFILT` update angular rate estimates every T5 interrupt cycle.

Filter constants such as `GAIN1` and `GAIN2` are defined in `DAPIDLER_PROGRAM.agc` (e.g., `GAIN1` at line 555), allowing the DAP to weight new sensor data against historical estimates for optimal noise rejection.

## FDAI Error Display and NEEDLER Logic

The DAP provides visual feedback to the crew via the Flight Director Attitude Indicator (FDAI) needles. Computed attitude errors are copied into registers `AK`, `AK1`, and `AK2`, then converted to analog signals.

### ALTDSPLY.agc and the Alternating Display

The `ALTDSPLY` routine in `Luminary099/ALTDSPLY.agc` (also referenced in `DAPIDLER_PROGRAM.agc`) implements an alternating display logic that updates the FDAI needles at 10 Hz. It toggles the `DSPLYALT` bit in `RCSFLAGS` to determine whether to call the `NEEDLER` subroutine.

```assembly
; Called each 100 ms from ALTDSPLY (LM)
ALTDSPLY  CA    RCSFLAGS
          TS    L
          CA    DSPLYALT
          EXTEND
          RXOR  LCHAN
          TS    RCSFLAGS
          MASK  DSPLYALT
          CCS   A
          TCF   NEEDLER   ; If alternation bit set → update needles

```

*Source: Lines 47-55 of `Luminary099/DAPIDLER_PROGRAM.agc` (subroutine `ALTDSPLY`)*

### NEEDLER.agc

The `NEEDLER` subroutine in `Luminary099/NEEDLER.agc` drives the digital-to-analog converters that physically position the FDAI needles, providing the crew with immediate visual feedback on attitude errors computed by the DAP.

## Summary

- The **Digital Autopilot (DAP)** is the real-time attitude control system in the Apollo 11 AGC software, executing on the Lunar Module (Luminary 099) and Command Module (Comanche 055).
- It operates via high-frequency interrupts (**T5 RUPT** for LM, **T4 RUPT** for CM) to command RCS thrusters and maintain spacecraft orientation.
- The LM DAP centers on **`DAPIDLER_PROGRAM.agc`** for initialization and cycling, while **`DAP_INTERFACE_SUBROUTINES.agc`** handles crew-selectable dead-band modes.
- The CM DAP uses **`RCS-CSM_DIGITAL_AUTOPILOT.agc`** for interrupt handling and **`TVCDAPS.agc`** for torque computation and jet selection.
- Both implementations utilize **Kalman filtering** (`KALUPDT`, `RATEFILT`) to smooth IMU data and the **`NEEDLER`** subroutine to drive FDAI attitude error displays.

## Frequently Asked Questions

### How does the Apollo 11 Digital Autopilot differ between the Lunar Module and Command Module?

While both modules share the fundamental architecture of interrupt-driven RCS control, the Lunar Module DAP in `Luminary099/DAPIDLER_PROGRAM.agc` executes on the T5 interrupt and includes specialized logic for the LM's unique mass properties and descent/ascent phases. The Command Module DAP in `Comanche055/RCS-CSM_DIGITAL_AUTOPILOT.agc` and `TVCDAPS.agc` operates on the T4 interrupt and integrates with the CM's different RCS configuration and entry/landing requirements.

### What is the purpose of the dead-band settings in the Apollo 11 DAP?

The dead-band settings define the attitude error tolerance before the DAP commands RCS thruster firings. The crew could select **wide** (5°), **narrow** (0.3°), or power-saving modes via the `DAP_INTERFACE_SUBROUTINES` routines (`SETMAXDB`, `SETMINDB`, `RESTORDB`). These settings prevent thruster chatter by allowing small attitude drifts without correction, conserving fuel and reducing mechanical wear.

### How does the Digital Autopilot display attitude errors to the crew?

The DAP writes computed attitude error values to registers `AK`, `AK1`, and `AK2`, then invokes the `NEEDLER` subroutine from `Luminary099/NEEDLER.agc` (shared with the CM). The `ALTDSPLY` routine in `Luminary099/ALTDSPLY.agc` alternates display updates at 10 Hz, driving the Flight Director Attitude Indicator (FDAI) needles to provide real-time visual feedback on spacecraft orientation relative to the desired attitude.

### What happens when the Apollo 11 DAP is set to "Free" mode?

In "Free" mode, the DAP disables RCS thruster commands and stops active attitude control. The software only zeros the rate filters and sets the `DRIFTBIT` flag to indicate the DAP is idle. This allows the spacecraft to drift freely without thruster interference, useful for fuel conservation or when manual control is preferred. The mode is handled by `FREECHK` and `FREEFUNC` routines in the LM DAP and similar logic in the CM implementation.