How to interface MAXIM’s DS1868 digital potentiometer with a PIC microcontroller

digital potentiometer
Potentiometers find applications in many electrical devices. For example, a light dimmer uses a potentiometer to control the brightness of lamps. In amplifiers, they are used to control the output volume of the music, or change the bass level. In an adjustable power supply we see potentiometers to vary the output voltage and current. In a frequency generator, they are used to control the duty cycle and frequency of the output signal. These potentiometers are electro-mechanical transducers that convert the rotary or linear displacement into a change in resistance. This change in resistance can be used to control anything from the brightness of a lamp to the direction of a rocket.
digital potentiometer

But things have been changed lately. You can now vary the brightness of the lamp with touch switches. The volume of an amplifier can be controlled through a remote, and the frequency of an oscillator can be varied with tact switches. There are still potentiometers in these devices but in the form of silicon chips and not in the conventional electro-mechanical form. These are called digital potentiometers and today we will discuss about MAXIM’s DS1868 chip, which has two digitally controlled potentiometers. We will interface it to a PIC16F1827 microcontroller and vary the position of the wiper terminals from one end to the other.

Theory

An analog potentiometer has three terminals, two of them are connected to the end-points of a resistive element of fixed resistance. The third terminal (known as wiper) can be slided to any point in between the two ends of the resistive element, thus varying the resistance between the wiper and any other end. A digital potentiometer mimics the same functionality except there are only finite wiper positions, which is is digitally controlled.

digital potentiometer

The DS1868 is a dual digital potentiometer chip from MAXIM, where each potentiometer is composed of 256 resistive sections. Between each resistive section and both ends of the potentiometer are tap points which are accessible to the wiper. The position of the wiper on the resistor array is set by an 8-bit value that controls which tap point is connected to the wiper output. Both potentiometers can also be connected in series (or stacked) for an increased total resistance with the same resolution, or multiple of DS1868 chips can also be cascaded. The DS1868 is offered in three standard resistance values which include 10, 50, and 100 K? versions.

The DS1868 has got an internal 17-bit shift register which is used to store the two 8-bit wiper positions and the stack select bit (useful in stacked configuration, read the datasheet for more info). Communication with the device is accomplished via a 3-wire serial port interface that consists of three signal lines: RST (reset), CLK (clock), and DQ (data). The data transfer is enabled by pulling the RST line high. The CLK signal provides the timing synchronization for data input and output. The DQ signal line is used to transmit potentiometer wiper settings and the stack select bit configuration to the 17-bit I/O shift register of the DS1868. Transmission of data always begins with the stack select bit followed by the potentiometer-1 wiper position value (8 bits, MSB first) and lastly the potentiometer-0 wiper position value (8 bits, MSB first). When wiper position data is to be written to the DS1868, all 17 bits (or some integer multiple) of data should always be transmitted. After a communication transaction has been completed the RST signal input should be taken to a low state to prevent any inadvertent changes to the device shift register.  Once RST has reached a low state, the contents of the I/O shift register are loaded into the respective multiplexers for setting wiper position.

Leave a Comment

Your email address will not be published. Required fields are marked *