An88 – Cirrus Logic AN88 User Manual

Page 3

Advertising
background image

AN88

AN88Rev2

3

data-state where it waits until data is read from its
serial port. To receive the data, read_register calls
receive_spi three times. Receive_spi is a subroutine
used to ‘bit-bang’ a byte of information from the
ADC to the PIC16F84. Similar to send_spi,
receive_spi acquires this information one bit at a
time MSB first. When the transfer is complete, the
variables highbyte, midbyte, and lowbyte contain
the CS5525/6/9’s 24-bit gain register.

Acquire Conversion

To acquire a conversion the subroutine convert is
called. Convert sends the command-byte 0x0C to
the converter. This instructs the converter to per-
form a single conversion. Then the Done Flag (DF)

bit in the configuration register is polled. When set,
DF indicates that a conversion was performed.
Once DF is set, the controller reads the conversion
data register to acquire the conversion.Figure 6 de-
picts how 16-bit and 20-bit conversion words are
stored in the microcontroller.

An alternate method can be used to acquire a con-
version. By setting the Port Flag bit (PF, the fifth
bit in the configuration register), SDO’s function is
modified to fall to logic 0 when a conversion is
complete (refer to Figure 5). By tying SDO to the
controller’s interrupt pin, conversions can be ac-
quired via an interrupt service routine.

Figure 3. Write-Cycle Timing

Figure 4. Read-Cycle Timing

Advertising