Write protect, Reading and writing the potentiometer values – Rainbow Electronics DS1845 User Manual
Page 7
DS1845
7 of 13
The DS1845 may operate in the following two modes:
1. Slave receiver mode: Serial data and clock are received through SDA and SCL respectively. After
each byte is received, an acknowledge bit is transmitted. START and STOP conditions are
recognized as the beginning and end of a serial transfer. Address recognition is performed by
hardware after reception of the slave (device) address and direction bit.
2. Slave transmitter mode: The 1
st
byte is received and handled as in the slave receiver mode. However,
in this mode the direction bit will indicate that the transfer direction is reversed. Serial data is
transmitted on SDA by the DS1845 while the serial clock is input on SCL. START and STOP
conditions are recognized as the beginning and end of a serial transfer.
3. Slave Address: command/control byte is the 1
st
byte received following the START condition from
the master device. The command/control byte consists of a 4-bit control code. For the DS1845, this is
set as 1010 binary for read/write operations. The next 3 bits of the command/ control byte are the
device select bits or slave address (A2, A1, A0). They are used by the master device to select which
of eight devices is to be accessed. When reading or writing the DS1845, the device-select bits must
match the device-select pins (A2, A1, A0). The last bit of the command/control byte (R/W) defines
the operation to be performed. When set to a 1 a read operation is selected, and when set to a 0 a write
operation is selected.
Following the START condition, the DS1845 monitors the SDA bus checking the device type identifier
being transmitted. Upon receiving the 1010 control code, the appropriate device address bits, and the
read/write bit, the slave device outputs an acknowledge signal on the SDA line.
WRITE PROTECT
An external pin WP (write protect) protects EEPROM data and potentiometer position from alteration in
an application. This pin must be open or tied high to protect data from alteration.
READING AND WRITING THE POTENTIOMETER VALUES
Reading from and writing to the potentiometers consists of a standard read or write to EEPROM memory
at the addresses F8h and F9h. The 8-bit value at address F9h controls the wiper setting for potentiometer
0, which has 100 positions. The 8-bit value at address F8h controls the wiper setting of potentiometer 1,
which has 256 positions. Potentiometer 1 may be set to any value between 00h and FFh. 00h sets the
wiper of potentiometer 1 to its lowest value and FFh sets the wiper to its highest. Potentiometer 0 may be
set to any value between 00h and 63h. A value of 00h sets the wiper of potentiometer 0 to its lowest
position and 63h sets the wiper to its highest position. Any hexadecimal value is a valid address. Setting
a value greater than the upper limit of the potentiometer’s range, 64h or greater for potentiometer 0, will
result in setting the wiper to its highest position, but the MSB will be ignored.