Cirrus Logic AN130 User Manual
Cirrus Logic Hardware
1
Copyright
Cirrus Logic, Inc. 1999
(All Rights Reserved)
P.O. Box 17847, Austin, Texas 78760
(512) 445 7222 FAX: (512) 445 7581
http://www.cirrus.com
AN130
Application Note
Interfacing the CS5521/22/23/24/28 to the PIC16C84
TABLE OF CONTENTS
1. INTRODUCTION ................................................... 1
2. ADC DIGITAL INTERFACE ................................... 1
3. SOFTWARE DESCRIPTION ................................. 2
3.1 Initialize ............................................................. 2
3.2 Write Channel Setup Registers ........................ 2
3.3 Self-Offset Calibration ....................................... 3
3.4 Read/Write Gain Register ................................. 3
3.5 Acquire Conversion .......................................... 4
4. MAXIMUM SCLK RATE ......................................... 4
5. SERIAL PERIPHERAL INTERFACE ..................... 4
6. DEVELOPMENT TOOL DESCRIPTION ................ 5
7. CONCLUSION ....................................................... 5
8. APPENDIX: PIC16C84 MICROCODE TO
INTERFACE TO THE CS5521/22/23/24/28 .......... 6
1. INTRODUCTION
This application note details the interface of Crys-
tal Semiconductor’s CS5521/22/23/24/28 Analog-
to-Digital Converter (ADC) to the Microchip
PIC16C84 microcontroller. This note takes the
reader through a simple example which demon-
strates how to communicate between the microcon-
troller and the ADC. All algorithms discussed are
included in Section 8. “APPENDIX: PIC16C84
Microcode to Interface to the
CS5521/22/23/24/28” on page 6.
2. ADC DIGITAL INTERFACE
The CS5521/22/23/24/28 interfaces to the
PIC16C84 through either a three-wire or a four-
wire interface. Figure 1 depicts the interface be-
tween the two devices. Though this software was
written to interface to Port A (RA) on the
PIC16C84 with a four-wire interface, the algo-
rithms can be easily modified to work with the
three-wire format.
The ADC’s serial port consists of four control
lines: CS, SCLK, SDI, and SDO.
CS, Chip Select, is the control line which enables
access to the serial port.
SCLK, Serial Clock, is the bit-clock which controls
the shifting of data to or from the ADC’s serial
port.
SDI, Serial Data In, is the data signal used to trans-
fer data from the PIC16C84 to the ADC.
SDO, Serial Data Out, is the data signal used to
transfer output data from the ADC to the
PIC16C84.
CS5521/22/23/24/28
PIC16C84
RA0
RA1
RA2
RA3
CS
SDI
SDO
SCLK
Figure 1. 3-Wire and 4-Wire Interfaces
CS5521/22/23/24/28
PIC16C84
RA1
RA2
RA3
CS
SDI
SDO
SCLK
3-Wire Interface
4-Wire Interface
NC (RA0)
NOV ‘99
AN130REV2
Document Outline
- AN130: Interfacing the CS5521/22/23/24/28 to the PIC16C84