Each dark gray rectangle shows a single register's content in two different ways. Most of the space is taken up with pull-down menus and a few hex input fields that display bit fields within the register, MSB to LSB. 8 bits are displayed per row with the bits aligned in numbered columns. At right is the combined hex code corresponding to values selected for the individual bit fields.
Changing either the hex code or the bit fields updates the other. Press Enter to accept changes to the hex code.
Registers that can't be broken into separate fields are shown for completeness, even though not much can be done with them.
In the actual AD7731, registers are programmed by first setting the Register Select bits in the Communications Register (CR2:0). In this tool, however, each register can be changed directly without first selecting it in the CR.
Similarly, one of three pair of calibration offset / gain registers is addressed by setting the Channel Select bits in the Mode Register (MR2:0). The active pair is highlighted in pink.
To set up the clock register, first choose an update rate and set the Filter Selection bits and MCLK frequency accordingly. The Filter Selection bits can be automatically configured by setting the desired Update Rate or -3dB point, however, the frequencies are quantized and you may need to adjust the MCLK frequency to get the exact update rate or cutoff frequency desired. See data sheet.
By default, reading and writing register pseudocode is, like the real AD7731, a two-step process: the Comm register must first be set up to select a target for the next read or write. After a register has been configured to your liking, select it in the Comm register and click "W". The selected register is now highlighted in yellow (and the channel in pink). To complete the cycle, click on the enabled "W" or "R". This will also clear the Register Select bits which must be manually reset for each access. Please note that the multiple read settings are nonfunctional - an ordinary read will be performed instead.
Both operations append pseudo-code instructions to a ticker of instructions at the bottom right of the applet. "writeSerial( val, length )" is an abstract subroutine that takes the quantity "val" and sends "length" bits of it serially to the AD7731, MSB first. The code list can be copied and pasted into another application (on most platforms).
Checking "Auto" above the Code output window puts code generation into a second mode, enabling all registers and automatically prepending the appropriate Comm register write when "W" or "R" for any register is clicked. Please note that in this mode the register select bits in the Comm register are ignored.
The ideal (low frequency, low noise/distortion, perfectly calibrated) digitized value for a given input voltage can be obtained by entering a voltage in the field to the right of the data register "R" button. Either a 5.0V or 2.5V VREF (= V(REF+) - V(REF-)) may be selected, but the input voltage is always relative to the reference. Please note: this calculator is not a simulator and so, for example, changing the calibration registers will not change the calculated digital value.
Documentation is available for each field simply by selecting it and is shown in the Help text area at the bottom of the Applet. Use the scroll bar to scroll down through the text.