Sense switch

A sense switch, or program switch, is a switch on the front panel of a computer whose state can be tested by conditional branch instructions in software. Most early computers had several sense switches. They were typically used by the operator to set program options.

IBM's first commercial computer, the IBM 701 Defense Calculator, announced on May 21, 1952, had four lights and six switches on the upper right of its front panel marked Sense (see photo). The switches could be tested and the lights turned on or off under program control. The same number of sense switches and lights were on the front panels of all first and second generation machines in the IBM scientific computer line, the IBM 701, IBM 704, IBM 709, IBM 7090 and the IBM 7094. IBM's Fortran language, first released for the 704, included statements to test the switches and set or reset the lights.


 * IF (SENSE SWITCH i) n1, n2
 * SENSE LIGHT i
 * IF (SENSE LIGHT i) n1, n2

where n1 and n2 are statement numbers. SENSE LIGHT 0 reset all four lights.

On the IBM 1620 there are four switches, and their state can be tested via special forms of the IF-statement offered by the FORTRAN compiler for the IBM 1620. For the IBM 1130 there are sixteen switches matching the sixteen-bit word size of the computer, plus a toggle switch adjacent to the power on/off switch. These bit-switches are more normally used with the computer stopped to specify some memory address to be viewed (via the indicator lights on the front panel), or set. The state of these switches can be determined by a program, and so a running program might modify its behavior depending on the switches, such as change the amount of progress information printed, alter the tactics of a multi-variable optimization attempt, and so on. The IBM 1130 also has an "Interrupt Request" key associated with the console printer, whose pressing might cause a suitably programmed long-running program to type a progress report on the console printer. In the more usual batch job environment, it was pressed by the computer operator to signal the operating system to terminate a running program that had perhaps overrun its allowed time, or commenced misbehavior such as repeatedly printing blank lines.

The front panel of the Data General Eclipse computer has 5 sense switches, 16 address switches, and 5 control switches, as shown (left to right) in the figure at right.

Personal computers replace the function of fixed sense switches with the keyboard and screen user interface.

A typical running application has two modes: either it has nothing to do and awaits some user action,  or, some action is in progress that will take a long time to complete. If a program does not regularly test the state of sense switches during a long calculation, they are ineffective at changing the program's operation.