AN114 Xicor, AN114 Datasheet - Page 9

no-image

AN114

Manufacturer Part Number
AN114
Description
Interfacing the X9408/X9418 XDCP to 8051 Microcontrollers
Manufacturer
Xicor
Datasheet

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
AN1149FHKEBV
Manufacturer:
PANASONIC/松下
Quantity:
20 000
; NAME: clock
; FUNCTION: Issues a LOW-HIGH-LOW clock pulse of sufficient duration
;
; INPUTS: NONE
; OUTPUTS: C
; CALLS: NONE
; AFFECTED: SCL, C
;
;-----------------------------------------------------------------------------
clock:
;-----------------------------------------------------------------------------
;
; NAME: get_byte
; FUNCTION: Receives 8 bits from SDA (MSB to LSB) and sends 1 bit to SDA
; INPUTS: NONE
; OUTPUTS: DATA_BYTE
; CALLS: clock, send_bit
; AFFECTED: COUNT, SDA, A, DATA_BYTE
;
;-----------------------------------------------------------------------------
get_byte:
get_loop:
;-----------------------------------------------------------------------------
;
; NAME: start_cond (Start Condition)
; FUNCTION: Issues an I2C bus start condition
; INPUTS: NONE
; OUTPUTS: NONE
; CALLS: NONE
; AFFECTED: SDA, SCL
;
;-----------------------------------------------------------------------------
start_cond:
REV 1.1 11/12/02
& reads SDA during the high phase, just in case its needed
nop
setb
nop
nop
nop
mov
clr
ret
setb
mov
call
rlc
djnz
mov
clr
call
ret
setb
setb
nop
nop
nop
nop
clr
nop
nop
nop
nop
SCL
c,SDA
SCL
SDA
COUNT,#8
clock
a
COUNT,get_loop
DATA_BYTE,a
a
send_bit
SDA
SCL
SDA
; Let SDA Set-up
; Pull SCL HIGH and hold
; Move SDA bit into carry flag
; Pull SCL LOW
; Receiver shouldn't drive SDA low
; Set Loop count to 8 repetitions
; Clock in the current bit
; Reconstruct byte using left shifts
; Store retrieved Byte for user
; A <- LOW (Sending a 0)
; Send an acknowledge
; Pull SDA HIGH and allow set-up
; Pull SCL HIGH and hold
;Pull SDA LOW (SCL=HIGH) and hold
Application Note
www.xicor.com
AN 114
9 of 12

Related parts for AN114