I2C-Bus und PCF 8574

Gast #482770
Lesenswert?

Hallo, wir versuchen mit dem uP C-509 über I2C-Bus den Baustein PCF 8574 
anzusteuern und zu beschreiben. Das Datenblatt besagt, dass die 
Mindestbetriebsspannung 2.5V sein muss, damit das IC nicht rückgesetzt 
wird. An allen I/O-Ports werden dann logische 1 ausgegeben, so wie bei 
unserem IC. Wir aber geben eine Spannung von 5V auf das IC. Was machen 
wir falsch?

MFG Patrick
Gast #482816
Lesenswert?

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
Gast #482834
Lesenswert?

Ohne jetzt zu wissen, was eigentlich nicht geht, fällt mir nur

slaveadress equ 30h

auf. Wenn das die I2C-Slaveadresse des Buasteins sein soll, fühlt sich 
da weder ein 8574 noch ein 8574A angesprochen. Der 8547 braucht 40h 
(wenn die drei Adressbits auf Null gelötet wurden), ein 8547 A reagiert 
bei gleicher Verschaltung auf 70h.

Näheres dazu findet sich im Datenblatt.

Oliver

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren