  Efficient operation of a submillimeter interferometer requires remote
(preferably automated) control of mechanically tuned local oscillators,
phase-lock loops, mixers, optics, calibration vanes and cryostats. The present
control system for these aspects of the Submillimeter Array (SMA) will be
described. Distributed processing forms the underlying architecture and the
software is split between hardware platforms in a leader/follower arrangement.
In each antenna cabin, a serial network of up to ten independent 80C196
microcontroller boards attaches to the real-time PowerPC computer (running
LynxOS). A multi-threaded, gcc-compiled leader program on the PowerPC accepts
top-level requests via remote procedure calls (RPC), subsequently dispatches
tuning commands to the relevant follower microcontrollers, and regularly
reports the system status to optical-fiber-based reflective memory for common
access by the telescope monitor and error reporting system. All serial
communication occurs asynchronously via encoded, variable-length packets. The
microcontrollers respond to the requested commands and queries by accessing
non-volatile, rewriteable lookup-tables (when appropriate) and executing
embedded software that operates additional electronic devices (DACs, ADCs,
etc.). Since various receiver hardware components require linear or rotary
motion, each microcontroller also implements a position servo via a
one-millisecond interrupt service routine which drives a DC-motor/encoder
combination that remains standard across each subsystem.
