Cirrus-logic AN89 Bedienungsanleitung Seite 9

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 12
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 8
AN89
AN89Rev2 9
**************************************************************************************
* Routine - read_register
* Input - COMMANDBYTE
* Output - HIGHBYTE, MIDBYTE, LOWBYTE
*
* This subroutine reads an internal register of the ADC.
**************************************************************************************
read_register LDA COMMANDBYTE ; Load ACCA with COMMANDBYTE
JSR send_spi ; transfer byte
JSR receive_spi ; receive byte
STA HIGHBYTE ; Move ACCA with HIGHBYTE
JSR receive_spi ; receive byte
STA MIDBYTE ; Move ACCA with MIDBYTE
JSR receive_spi ; receive byte
STA LOWBYTE ; Move ACCA with LOWBYTE
RTS ; Exit Subroutine
**************************************************************************************
* Routine - send_spi
* Input - Byte to be transmitted is placed in ACCA
* Output - none
*
* This subroutine sends a byte to the ADC.
**************************************************************************************
send_spi: STA SPDR ; Move ACCA to SPDR
wait0 BRCLR SPIF,SPSR,wait0 ; Loop until byte is transmitted
RTS ; Exit Subroutine
**************************************************************************************
* Routine - receive_spi
* Input - none
* Output - Byte received is placed in ACCA
* This subroutine receives a byte from the ADC.
**************************************************************************************
receive_spi: CLRA ; Load ACCA register with Zero
STA SPDR ; Initiate a transfer of all Zero’s
wait1 BRCLR SPIF,SPSR,wait1 ; Reset Flag SPIF bit
LDA SPDR ; Move SPDR to ACCA
RTS ; Exit Subroutine
Seitenansicht 8
1 2 3 4 5 6 7 8 9 10 11 12

Kommentare zu diesen Handbüchern

Keine Kommentare