
VV5404 & VV6404
CD5404-6404F-A
38/54
5.6
This section gives guidelines on the basic operations to read data from and write data to the serial interface.
The serial interface supports variable length messages. A message may contain no data bytes, one data byte or many
data bytes. This data can be written to or read from common or different locations within the sensor. The range of
instructions available are detailed below.
Write no data byte, only sets the index for a subsequent read message.
Single location multiple data write or read for monitoring (real time control)
Multiple location, multiple data read or write for fast information transfers.
Examples of these operations are given below. A full description of the internal registers is given in the previous
section. For all examples the slave address used is 32
10
for writing and 33
10
for reading. The write address includes
the read/write bit (the lsb) set to zero while this bit is set in the read address.
Types of messages
5.6.1 Single location, single data write.
When a random value is written to the sensor, the message will look like this:
In this example, the fineH exposure register (index = 32
10
) is set to 85
10
. The r/w bit is set to zero for writing and the
incbit (msbit of the index byte) is set to zero to disable automatic increment of the index after writing the value. The
address index is preserved and may be used by a subsequent read. The write message is terminated with a stop
condition from the master.
5.6.2
A read message always contains the index used to get the first byte.
Single location, single data read.
This example assumes that a write message has already taken place and the residual index value is 32
10
. A value of
85
10
is read from the fineH exposure register. Note that the read message is terminated with a negative acknowledge
(A) from the master: it is not guaranteed that the master will be able to issue a stop condition at any other time during
a read message. This is because if the data sent by the slave is all zeros, the sdaline cannot rise, which is part of the
stop condition.
5.6.3
When a location is to be read, but the value of the stored index is not known, a write message with no data byte must
be written first, specifying the index. The read message then completes the message sequence. To avoid
relinquishing the serial to bus to another master a repeated start condition is asserted between the write and read
messages. In this example, the gain value (index = 36
10
) is read as 15
10
:
No data write followed by same location read.
Figure 19 : Single location, single write.
S
32
10
A 0
32
10
A
85
10
A
P
Start
Device
address
Ack
Index
Data
Stop
Figure 20 : Single location, single read.
S
33
10
A 0
32
10
A
85
10
A
P
Start
Device
address
Ack
Index
Data
Stop