Use the WREG command to write the device register data. The register data are written one register at a time or as a block of register data. The starting register address is any register in the map.
The WREG opcode consists of two bytes. The first byte specifies the starting register address: 010r rrrr, where r rrrr is the starting register address The second opcode byte is the number of registers to write (minus one): 000n nnnn, where n nnnn is the number of registers to write minus one. The following byte (or bytes) is the register data, most significant bit first. If the byte count exceeds the last register address, the ADC ignores the data (the address pointer does not wrap). Writing new data to certain registers results in a reset of ADC1 or ADC2 conversions, as specified in the ADC restart column in the Section 9.6. The previous conversion data are cleared at restart; therefore, read the data before the register write operation. After the register write command has been started, further commands are disabled until one of these conditions occur:
1) The write operation is completed.
2) The write operation is terminated by taking CS high.
3) The write operation is terminated by a serial interface auto-reset
4) The ADC is reset by toggling the RESET/PWDN pin.
Figure 9-57 depicts a two-register write operation example. As shown, the required opcodes to write data to two registers starting at register MODE2 (address = 05h) are: OPCODE 1 = 45h and OPCODE 2 = 01h.
The MODE2 and INPMUX registers are modified. Typically, register changes take effect immediately after the data are written. However, if the registers are part of a group, then the data are written only after all data for the grouped registers in the write block have been sent. In this example, data for MODE2 and INPMUX are written only after the data for INPMUX are sent. See the Section 9.6 section for those registers that are grouped when writing register data.