Rainbow Electronics DS1957 User Manual
Page 6
DS1957
6 of 25
WRITE INTERMEDIATE PRODUCT REGISTER (IPR) [0FH]
The intermediate product register is used to transfer firmware command codes and data to the
microcomputer inside the DS1957 and to read back the results of computations. After the command byte,
the bus master transmits the length byte indicating the number of data bytes to be written to the IPR. The
length byte may be in the range of 01H to 80H (1 to 128 decimal). The length byte is followed by the
data bytes to be written. After as many data bytes as specified by the length byte have been transmitted
by the bus master, the DS1957 responds with an inverted CRC16 of the command code, length byte and
all data bytes in their original sequence. This ends the Write IPR command and the DS1957 waits for a
reset pulse to be sent by the bus master. The CRC allows the bus master to easily check the correctness
of the communication without the need for reading back all the data for verification. Writing to the IPR
erases as many bytes of the old data as are newly written. Reading back 128 bytes with the READ IPR
command sequence will reproduce the new bytes first followed by the remainder of the previous contents.
READ INTERMEDIATE PRODUCT REGISTER (IPR) [AAH]
The intermediate product register is typically read to receive the results of a computation after the
microcomputer inside the DS1957 has processed the input data. However, it is also possible to read back
the data before it has been processed. The flow chart in both cases is the same, but the data is received in
different order.
After the microcomputer inside the DS1957 has placed the results of a computation into the IPR, the bus
master first reads the I/O buffer (see Read I/O Buffer command) to learn the length of the resulting data
in the IPR. In the next step the bus master accesses the DS1957 again, transmits the Read IPR command
byte followed by the length byte indicating the number of data bytes to be read from the IPR. Now the
bus master reads as many data bytes as specified by the length byte. After this, the DS1957 responds
with an inverted CRC16 of the command code, length byte and all data bytes in their original sequence.
If the CRC calculated by the bus master does not match the value transmitted by the DS1957, the data
transfer was not successful. Due to the hardware design of the IPR (circular buffer) the best way to
recover the data is to repeat the computation. If the CRC value matches and the master wants to restore
the status of the IPR for a second read of the same data, it has to access the DS1957 again and issue
another READ IPR command sequence. If now the length byte is 128 minus the previously used length
value, and the master reads as many bytes as the new length byte specifies plus the CRC16, the original
status of the IPR is restored. If this second access cycle is omitted or a transmission error occurs before
the bus master sends the reset pulse to finish the command, the data placed into the IPR by the
microcomputer is lost and the computation needs to be repeated. The second access cycle can be avoided
if one always reads all 128 bytes of the IPR.