AN114 Xicor, AN114 Datasheet - Page 8

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
case5:
stop_gen:
;-----------------------------------------------------------------------------
;
; NAME: send_byte
; FUNCTION: Sends 8 bits (from MSB to LSB) to SDA and reads 1 bit from SDA
; INPUTS: A
; OUTPUTS: NONE
; CALLS: send_bit, get_bit
; AFFECTED: COUNT, TEMP, A
;
;-----------------------------------------------------------------------------
send_byte:
bit_loop:
next_bit:
;-----------------------------------------------------------------------------
;
; NAME: send_bit
; FUNCTION: Places a bit on SDA and initiates a clock pulse on SCL
; INPUTS: A
; OUTPUTS: NONE
; CALLS: clock
; AFFECTED: SDA
;
;-----------------------------------------------------------------------------
send_bit:
sent_zero:
;-----------------------------------------------------------------------------
;
REV 1.1 11/12/02
call
call
jmp
call
call
call
ret
mov
mov
mov
anl
call
mov
rl
mov
djnz
setb
call
ret
clr
jz
setb
call
ret
stop_cond
polling
stop_gen
stop_cond
polling
stop_cond
COUNT,#8
TEMP,a
a,TEMP
a,#10000000b ; Mask for MSB (Most Significant Bit)
send_bit
a,TEMP
a
TEMP,a
COUNT,bit_loop
SDA
clock
SDA
sent_zero
SDA
clock
; Initiate a clock pulse
; Issue a stop condition
; Begin Acknowledge Polling
; Issue a stop condition
; Begin Acknowledge Polling
; I2C Transmission Over!
; Set loop for 8 repetitions
; store as shifted byte (no shift)
; Retrieve last saved shifted byte
; Place this bit on SDA
; Retrieve last saved shifted byte
; Rotate all bits 1 position left
; Store this updated shifted byte
; let SDA go high after 8th bit
; When all 8 bits done, read SDA line
; (ACKnowledge pulse)
; Pull SDA Low
; Should SDA really be LOW?
; If Not, pull SDA HIGH
Application Note
www.xicor.com
AN 114
8 of 12

Related parts for AN114