Cirrus-logic AN130 Manual do Utilizador

Consulte online ou descarregue Manual do Utilizador para Hardware Cirrus-logic AN130. Cirrus Logic AN130 User Manual Manual do Utilizador

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 16
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 0
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
Vista de página 0
1 2 3 4 5 6 ... 15 16

Resumo do Conteúdo

Página 1 - Application Note

1Copyright  Cirrus Logic, Inc. 1999(All Rights Reserved)P.O. Box 17847, Austin, Texas 78760(512) 445 7222 FAX: (512) 445 7581http://www.cirrus.comA

Página 2 - 3.1 Initialize

AN13010 AN130REV2MOVLW 0x05 ; Command to write CSRsBCF PORTA, CS ; select the ADCCALL send_byte ; send command byte to ADC;*** Setup CSR #1 - Setups 1

Página 3 - 3.4 Read/Write Gain Register

AN130AN130REV2 11;* Routine - convert;* Input - none;* Output - 24-bit Conversion Results in memory locations HIGHBYTE, MIDBYTE;* and LOWBYTE

Página 4 - 4. MAXIMUM SCLK RATE

AN13012 AN130REV2;* Routine - write_register;* Input - COMMAND, HIGHBYTE, MIDBYTE, LOWBYTE;* Output - none;* This subroutine writes to the internal re

Página 5 - 6. DEVELOPMENT TOOL

AN130AN130REV2 13;* Routine - send_byte;* Input - Byte stored in W register;* Output - none;* This subroutine sends a byte, one bit at a time, MSB fir

Página 6

AN13014 AN130REV2;* Routine - delay;* Input - Count in W register;* Output - none;* This subroutine delays by using a count value stored in register W

Página 7

• Notes •

Página 9

AN1302 AN130REV23. SOFTWARE DESCRIPTIONThis note presents algorithms to initialize thePIC16C84 and the CS5521/22/23/24/28, performcalibrations, modif

Página 10

AN130AN130REV2 3DP0 must always be logic 1 when reading and writ-ing the CSRs. To modify the Depth Pointer bits, theconfiguration register is read to

Página 11

AN1304 AN130REV23.5 Acquire ConversionTo acquire a conversion the subroutine convert iscalled. For single conversions on one physicalchannel, the MC

Página 12

AN130AN130REV2 5for a selectable clock polarity. However, many donot have the capability to select the clock’s phase.When using a microcontroller with

Página 13

AN1306 AN130REV28. APPENDIX: PIC16C84 MICROCODE TO INTERFACE TO THE CS5521/22/23/24/28;**************************************************************

Página 14

AN130AN130REV2 7;* Routine - main;* Input - none;* Output - none;* This is the entry point to the program, as well as the central loop. ;*************

Página 15 - • Notes •

AN1308 AN130REV2MOVLW 0xFF ; Load W for new delay countCALL delay ; Delay for Oscillator start-up 158msCALL delay ; Delay for Oscillator start-up 158m

Página 16

AN130AN130REV2 9;* Input - none;* Output - none;* This subroutine writes to and reads from the gain register on physical;* channel 1.;****************

Comentários a estes Manuais

Sem comentários