Datasheet

AD7731
–36–
REV. 0
CONFIGURING THE AD7731
The AD7731 contains twelve on-chip registers which can be accessed via the serial interface. Figure 5 and Figure 6 have outlined a
flowchart for the reading and writing of these registers. Table XIX and Table XX outline sample pseudo-code for some commonly
used routines. The required operating conditions will dictate the values loaded to the Mode and Filter Registers. The values given
here are for example purposes only.
Table XIX. Pseudo-Code for Initiating a Self-Calibration after Power-On/Reset
Write 03 Hex to Serial Port
1
/* Writes to Communications Register Setting Next Operation as Write to
Filter Register*/
Write 1332 Hex to Serial Port
1
/* Writes to Filter Register Setting a 1 kHz Output Rate in nonCHOP
Mode*/
Write 02 Hex to Serial Port /* Writes to Communications Register Setting Next Operation as Write to
Mode Register*/
Write B174 Hex to Serial Port /* Writes to Mode Register Initiating Internal Full-Scale Calibration for
0 V to +1.28 V Input Range on Channel Pair AIN1/AIN2*/
Wait for RDY Low /* Wait for RDY pin to go low to indicate end of calibration cycle*/
Write 02 Hex to Serial Port /* Writes to Communications Register Setting Next Operation as Write to
Mode Register*/
Write 9174 Hex to Serial Port /* Writes to Mode Register Initiating Internal Zero-Scale Calibration for
0 V to +1.28 V Input Range*/
Wait for RDY Low /* Wait for RDY pin to go low to indicate end of calibration cycle*/
/* The part has now completed self-calibration and is in idle mode*/
1
This operation is not necessary if the default values of the Filter Register are the values used in the application.
Table XX. Pseudo-Code for Looping AD7731 Through Three Fully-Differential Channels
CHANNEL = 4 Hex /* Sets a Variable Called CHANNEL*/
CH_LOOP: MODE = 2177 Hex /* Sets a Variable Called MODE */
MODE = MODE AND CHANNEL /* Logical AND of Both Variables */
Write 02 Hex to Serial Port /* Writes to Communications Register Setting Next Operation as Write to
Mode Register*/
Write MODE to Serial Port /* Writes to Mode Register Setting Continuous Conversion Mode for 0V
to +1.28 V Input Range on Channel Determined by CHANNEL Variable*/
Wait for RDY Low /* Wait for RDY pin to go low to Indicate Output Update*/
Write 11 Hex to Serial Port /* Writes to Communications Register Setting Next Operation as Read
From Data Register*/
Read 24-Bit Data From Serial Port /* Read Conversion Result from AD7731’s Data Register*/
Increment CHANNEL /* Increments Channel Address*/
If CHANNEL = 7Hex Then Set CHANNEL = 4 Hex /* Resets Channel Address*/
Loop to CH_LOOP
REV. A