2003 Microchip Technology Inc.
DS11195C-page 17
MCP41XXX/42XXX
5.0
SERIAL INTERFACE
Communications
from
the
controller
to
the
MCP41XXX/42XXX digital potentiometers is accom-
plished using the SPI serial interface. This interface
allows three commands:
1.
Write a new value to the potentiometer data
register(s).
2.
Cause a channel to enter low power shutdown
mode.
3.
NOP
(No Operation) command.
Executing any command is accomplished by setting
CS low and then clocking-in a command byte followed
by a data byte into the 16-bit shift register. The com-
mand is executed when CS is raised. Data is clocked-
in on the rising edge of clock and out the SO pin on the
will track the number of clocks (rising edges) while CS
is low and will abort all commands if the number of
clocks is not a multiple of 16.
5.1
Command Byte
The first byte sent is always the command byte, fol-
lowed by the data byte. The command byte contains
two command select bits and two potentiometer select
bits. Unused bits are ‘don’t care’ bits. The command
mand select bits C1 and C0 (bits 4:5) of the command
byte determine which command will be executed. If the
command bits are both 0’s or 1’s, then a NOP com-
mand will be executed once all 16 bits have been
loaded. This command is useful when using the daisy-
chain configuration. When the command bits are 0,1, a
write command will be executed with the 8 bits sent in
the data byte. The data will be written to the potentiom-
eter(s) determined by the potentiometer select bits. If
the command bits are 1,0, then a shutdown command
will be executed on the potentiometers determined by
the potentiometer select bits.
For the MCP42XXX devices, the potentiometer select
bits P1 and P0 (bits 0:1) determine which potentiome-
ters are to be acted upon by the command. A corre-
sponding ‘1’ in the position signifies that the command
for that potentiometer will get executed, while a ‘0’ sig-
nifies that the command will not effect that
5.2
Writing Data Into Data Registers
When new data is written into one or more of the poten-
tiometer data registers, the write command is followed
by the data byte for the new value. The command
select bits C1, C0 are set to 0,1. The potentiometer
selection bits P1 and P0 allow new values to be written
to potentiometer 0, potentiometer 1 (or both) with a sin-
gle command. A ‘1’ for either P1 or P0 will cause the
data to be written to the respective data register and a
‘0’ for P1 or P0 will cause no change. See
Figure 5-2for the command format summary.
5.3
Using The Shutdown Command
The shutdown command allows the user to put the
application circuit into a power-saving mode. In this
mode, the A terminal is open-circuited and the B and W
terminals are shorted together. The command select
bits C1, C0 are set to 1,0. The potentiometer selection
bits P1 and P0 allow each potentiometer to be shut-
down independently. If either P1 or P0 are high, the
respective potentiometer will enter shutdown mode. A
‘0’ for P1 or P0 will have no effect. The eight data bits
following the command byte still need to be transmitted
for the shutdown command, but they are ‘don’t care’
Once a particular potentiometer has entered the shut-
down mode, it will remain in this mode until:
A new value is written to the potentiometer data
register, provided that the SHDN pin is high. The
device will remain in the shutdown mode until the
rising edge of the CS is detected, at which time
the device will come out of shutdown mode and
the new value will be written to the data regis-
ter(s). If the SHDN pin is low when the new value
is received, the registers will still be set to the new
value, but the device will remain in shutdown
mode. This scenario assumes that a valid com-
mand was received. If an invalid command was
received, the command will be ignored and the
device will remain in the shutdown mode.
It is also possible to use the hardware shutdown pin
and reset pin to remove a device from software shut-
down. To do this, a low pulse on the chip select line
must first be sent. For multiple devices, sharing a single
SHDN or RESET line allows you to pick an individual
device on that chain to remove from software shutdown
mode. See
Figure 1-3 for timing. With a preceding chip
select pulse, either of these situations will also remove
a device from software shutdown:
A falling edge is seen on the RS pin and held low
for at least 150 ns, provided that the SHDN pin is
high. If the SHDN pin is low, the registers will still
be set to mid-scale, but the device will remain in
shutdown mode. This condition assumes that CS
is high, as bringing the RS pin low while CS is low
is an invalid state and results are indeterminate.
A rising edge on the SHDN pin is seen after being
low for at least 100 ns, provided that the CS pin is
high. Toggling the SHDN pin low while CS is low
is an invalid state and results are indeterminate.
The device is powered-down and back up.
Note:
The hardware SHDN pin will always put
the device in shutdown regardless of
whether a potentiometer has already been
put in the shutdown mode using the
software command.