Das ist der Quellcode, mit dem wir versuchten, das IC anzusprechen
MOV slaveadress,# 01000000b
MOV daten,# 10101010b
START: CALL startc
MOV a,slaveadress
CALL send
nop
nop
MOV A,daten
CALL stop
JMP START
;***********************************************************************
*
; Ports Used for I2C Communication
;***********************************************************************
*
sda equ P1.7
scl equ P1.6
slaveadress equ 30h
daten equ 31h
;***********************************************************************
*
; Start Condition for I2C Communication
;***********************************************************************
*
startc: clr scl
setb sda
nop
nop
setb scl
nop
nop
clr sda
ret
;***********************************************************************
*
; Stop Condition For I2C Bus
;***********************************************************************
*
stop:
nop
nop
clr sda
setb scl
nop
nop
setb sda
nop
nop
clr scl
ret
;***********************************************************************
*
; Sending Data to slave on I2C bus
; with Acknowledgement
;***********************************************************************
*
send:
mov r7,#08
back:
clr scl
nop
nop
nop
rlc a
mov sda,c
setb scl
nop
nop
nop
clr scl
nop
nop
nop
djnz r7,back
setb sda
setb scl
nop
nop
nop
nop
clr scl
nop
nop
nop
ret
;***********************************************************************
*
; Receiving Data from slave on I2C bus
; with Acknowledgement
;***********************************************************************
*
recv:
mov r7,#08
back2:
setb sda
setb scl
nop
nop
nop
mov c,sda
rlc a
clr scl
nop
nop
nop
djnz r7,back2
setb sda
clr scl
nop
nop
nop
clr sda
setb scl
nop
nop
nop
clr scl
nop
nop
nop
mov @r0,a
inc r0
ret
END