The cyclic angular dependence of the output of gravitational inclinometers and magnetometers is used to communicate from the well surface to a microprocessor downhole. The microprocessor controls an arbitrary downhole function. Information is communicated to the microprocessor via the inclinometer and magnetometer by selectively rotating the drill string during a data time interval through a predetermined magnitude of angular displacement or angular velocity. Each additional multiple of angular displacement or angular velocity is interpreted as a distinguishable unit of information. A command word is assembled from a sequential plurality of units of information in the microprocessor and a downhole function is executed according to the command word.