beautypg.com

Cirrus Logic AN118 User Manual

Cirrus Logic Hardware

background image

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

AN118

Application Note

Interfacing the CS5521/22/23/24/28 to the 80C51

TABLE OF CONTENTS

1. INTRODUCTION ................................................... 1
2. ADC DIGITAL INTERFACE ................................... 1
3. SOFTWARE DESCRIPTION ................................. 1

3.1 Main Program Loop .......................................... 2
3.2 Initialize ............................................................. 2
3.3 Transfer Data To/From ADC ............................. 3
3.4 Transfer Data To/From PC ............................... 3
3.5 Decoding PC Commands ................................. 5
3.6 Sample Index .................................................... 6
3.7 Test Modes ....................................................... 6

4. MAXIMUM SCLK RATE ......................................... 8
5. DEVELOPMENT TOOL DESCRIPTION ................ 8
6. CONCLUSION ....................................................... 8
7. APPENDIX: 80C51 MICROCONTROLLER CODE 9

1. INTRODUCTION

This application note details the interface of Crys-
tal Semiconductor’s CS5521/22/23/24/28 Analog-
to-Digital Converter (ADC) to an 80C51 micro-
controller. It includes the complete code written for
the CDB5521/22/23/24/28 Evaluation Board,
which also interfaces the 80C51 to a PC. All algo-
rithms discussed are included in Section 7. “Ap-
pendix: 80C51 Microcontroller Code” on page 9.

2. ADC DIGITAL INTERFACE

The CS5521/22/23/24/28 interfaces to the 80C51
through either a three-wire or a four-wire interface.
Figure 1 depicts the interface between the two de-
vices. This software was written to interface to Port
1 (P1) on the 80C51 with either type of interface.
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 80C51 to the ADC.

SDO, Serial Data Out, is the data signal used to
transfer output data from the ADC to the 80C51.

3. SOFTWARE DESCRIPTION

This note details all of the algorithms contained in
the CDB5521/22/23/24/28 Evaluation Board soft-
ware. The software is written for the 80C51 micro-
controller on the evaluation board. The more
important communication algorithms are written in

CS5521/22/23/24/28

80C51

P1.0

P1.1

P1.2

P1.3

CS

SDI

SDO

SCLK

Figure 1. 3-Wire and 4-Wire Interfaces

CS5521/22/23/24/28

80C51

P1.0 (logic 0)

P1.1

P1.2

P1.3

CS

SDI

SDO

SCLK

NOV ‘99

AN118REV2