English
Language : 

CS5501 Datasheet, PDF (38/54 Pages) Cirrus Logic – Non-aliasing, 16- & 20-bit A/D Converters
CS5501
8051
DRDY
CS
MODE
SCLK
SDATA
INT1
P1.1
P1.2
P1.3
Figure A6. MCS51 (8051) /CS5501 Serial Interface
Notes:
1. CS5501 in Synchronous External Clocking mode.
2. Interrupt driven I/O on 8051 (For polling, connect
DRDY to another port pin).
Assumptions:
1. INT1 external interrupt used.
2. Register bank 1, R6, R7 used to store data word,
R7 MSbyte.
3. EA enabled elsewhere.
CS5501 CS5503
CS5501/CS5503
Initial Code:
CS
SCLK
DATA
SPINIT:
EQU
EQU
EQU
CLR
SETB
SETB
SETB
CLR
SETB
P1.1
P1.2
P1.3
EX1
IT1
DATA
CS
SCLK
EX1
; Disable INT1
; Set INT1 for falling edge triggered
; Set DATA to be input pin
; CS = 1; deselect CS5501
; SCLK low
; Enable INT1 interrupt
Code to get word of data:
ORG 0003H
LJMP GETWD
; Interrupt vector
GETWD: PUSH PSW
; Save temp. copy
PUSH A
; Save temp. copy
MOV PSW,#08 ; Set register bank 1 active
MOV R6,#8
; number of bits in a byte
CLR CS
; CS = 0; select CS5501
MSBYTE:SETB SCLK
; Toggle SCLK high
MOV C,DATA
; Put bit of data into carry bit
CLR SCLK
; Toggle SCLK low; next data bit
RLC A
; Shift DATA bit into A register
DJNZ R6,MSBYTE ; Dec. R6, if not 0, get another bit
MOV R7,A
; Put MSbyte into R7
MOV R6,#8
; Reset R6 to number of bits in byte
LSBYTE: SETB SCLK
; Toggle SCLK high
MOV C,DATA
; Put bit of data into carry bit
CLR SCLK
; Toggle SCLK low; next data bit
RLC A
; Shift DATA bit into A register
DJNZ R6,LSBYTE ; Dec. R6, if not 0, get another bit
MOV R6,A
; Put LSbyte into R6
SETB CS
; CS = 1; deselect CS5501
POP A
; Restore original value
POP PSW
; Restore original value
RETI
CS5501
8051
SCLK
32
OSC
CS
MODE
SDATA
-5V
P1.2
RXD
Figure A7. MCS51 (8051) /CS5501 UART Interface
Notes:
1. CS5501 in Asynchronous (UART-like) mode.
2. 8051 in mode 2, with OSC = 12 MHz,
max baud = 375 kbps.
Assumptions:
1. P1.2 (port 1, bit 2) used as CS.
2. Using serial port mode 2, Baud rate = OSC/32.
3388
(Assumptions cont.)
3. Word received put in A (ACC) and B registers,
A = MSbyte.
4. No error checking done.
5. Equates used for peripheral names.
Initial Code:
SPINIT: SETB
SETB
MOV
CLR
RET
SMOD
; Set SMOD = 1, baud = OSC/32
P1.2
; CS = 1, inactive
SCON,#1001000B ; Enable serial port mode 2,
; receiver enabled, transmitter disabled
ES
; Disable serial port interrupts (polling)
;
Code to get word of data:
SP_IN:
CLR
JNB
CLR
MOV
JNB
CLR
MOV
SETB
RET
P1.2
RI,$
RI
A,SBUF
RI,$
RI
B,SBUF
P1.2
; CS = 0, active; select CS5501
; Wait for first byte
;
; Put most significant byte in A
; wait for second byte
;
; Put least significant byte in B
; CS = 1, inactive; deselect CS5501
;
DS31F54