An74 – Cirrus Logic AN74 User Manual

Page 12

Advertising
background image

AN74

12

AN74Rev2

;****************************************************************
;* Routine - TOGGLE_SDO
;* Input

- none

;* Output - none
;* Description -

This routine reset the DRDY pin by toggling

;*

SCLK 8 times after SDO falls.

;

This routine polls SDO, waits for it to be asserted, then clears SDO

;

for next conversion by pulsing SCLK eight times after SDO falls

;

This functions prototype in C is: void toggle_sdo(void);

;****************************************************************
$DEBUG
USING 0

; Use register bank 0

TCOD

SEGMENT CODE

; Define Rout as a segment of code

PUBLIC TOGGLE_SDO

; Make subroutine public

RSEG TCOD

; Make code relocatable

TOGGLE_SDO:

MOV

R1,#08

; Setup counter

CLR

P1.1

; Clear SDI

JB

P1.2,$

; Poll SDO

loop:

SETB

P1.3

; Set SCLK

CLR

P1.3

; Clear SCLK

DJNZ

R1,loop

; Decrement byte, repeat loop if not zero

RET

; Exit Subroutine

END

Advertising