Although microfluidic chips have demonstrated basic functionality for single applications, performing varied and complex experiments on a single device is still technically challenging. While many groups have implemented control software to drive the pumps, valves, and electrodes used to manipulate fluids in microfluidic devices, a new level of programmability is needed for end users to orchestrate their own unique experiments on a given device. This paper presents an approach for programmable and scalable control of discrete fluid samples in a polydimethylsiloxane (PDMS) microfluidic system using multiphase flows. An immiscible fluid phase is utilized to separate aqueous samples from one another, and a novel ''microfluidic latch'' is used to precisely align a sample after it has been transported a long distance through the flow channels. To demonstrate the scalability of the approach, this paper introduces a ''generalpurpose'' microfluidic chip containing a rotary mixer and addressable storage cells. The system is general purpose in that all operations on the chip operate in terms of unit-sized aqueous samples; using the underlying mechanisms for sample transport and storage, additional sensors and actuators can be integrated in a scalable manner. A novel high-level software library allows users to specify experiments in terms of variables (i.e., fluids) and operations (i.e., mixes) without the need for detailed knowledge about the underlying device architecture. This research represents a first step to provide a programmable interface to the microfluidic realm, with the aim of enabling a new level of scalability and flexibility for lab-on-a-chip experiments.