Manual
Table Of Contents
- AN118: Interfacing the CS5521/22/23/24/28 to the 80C51
- TABLE OF CONTENTS
 - 1. INTRODUCTION
 - 2. ADC DIGITAL INTERFACE
 - 3. SOFTWARE DESCRIPTION
 - 4. MAXIMUM SCLK RATE
 - 5. DEVELOPMENT TOOL DESCRIPTION
 - 6. CONCLUSION
 - 7. APPENDIX: 80C51 MICROCONTROLLER CODE
 
 

AN118
AN118REV2 27
/**************************************************************/
/* Routine - Delay     */
/* Input - none  */
/* Output - none  */
/* Description - This routine is used as a LED delay routine  */
/**************************************************************/
void Delay(void) {
data int j;
for (j=0; j<10000; j++)
for (j=0; j<10000; j++);
}
;****************************************************************
;* Routine - RECEIVE_BYTE
;* Input - none
;* Output - Byte received is placed in R7
;* Description - This subroutine receives 1 byte from converter 
;****************************************************************
; The function prototype is: char RECEIVE_BYTE(void); 
$DEBUG
USING 0  ; Use register bank 0
TCOD SEGMENT CODE  ; Define ROUT as a segment of code
PUBLIC RECEIVE_BYTE ; Make subroutine global
RSEG TCOD ; Make code relocatable  
RECEIVE_BYTE:  
MOV  R1,#08 ; Set count to 8 to receive byte
LOOP: ; Receive the byte
MOV  C,P1.2  ; Move bit to carry
RLC  A ; Rotate A in preparation for next bit
SETB P1.3 ; Set SCLK
CLR P1.3 ; Clear SCLK
DJNZ R1,LOOP ; Decrement byte, repeat loop if not zero
MOV R7,A  ; Byte to be return is placed in R7
RET  ; Exit subroutine
END 










