I²C mit 16f88 als Slave
Mittwoch, 23. Mai 2012
 
 

PIC Mikrocontroller Forum  |  PIC Mikrocontroller  |  Programmiersprache Assembler  |  Schnittstellen (Assembler)  |  I²C mit 16f88 als Slave « vorheriges nächstes »
Seiten: [1] Nach unten Drucken
Autor Thema: I²C mit 16f88 als Slave  (Gelesen 959 mal)
 
Herzog
Newbie
*
Offline Offline

Beiträge: 31


Profil anzeigen
« am: Februar 14, 2011, 10:22:04 »

Hallo
ich bin gerad dabei zwei Pic´s miteinander komunizieren zu lassen, dabei ist ein 16f88 der slave
nun meine frage:

ich hab in das Register SSPADD des 88er  diese adresse B'10101010' geschrieben.

wenn der master jetzt diese adresse über den Bus verschick springt der Pic ja in die Interrupt-routine und kontrolliert ob es auch wirklich vom I²C kommt "btfss   PIR1,SSPIF".
wann setzt der Pic das bit den nun auf eins? wenn die adresse übereinstimmt oder wenn die 7bit empfangen wurden und muss ich die adresse selbst kontrollieren oder macht das der Pic.

ich wühle mich gerade durch das Datenblatt des PIC16F88 aber ich weiß nicht genau was automatisch geschieht und was ich per software veranlassen muss.

vielen dank
Gespeichert
Bernd
Globaler Moderator
Hero Member
*****
Offline Offline

Beiträge: 3815



Profil anzeigen
« Antworten #1 am: Februar 15, 2011, 01:02:40 »

Aus dem Datenblatt:

Zitat
Once the SSP module has been enabled, it waits for a Start condition to occur. Following the Start condition, the eight bits are shifted into the SSPSR register. All incoming bits are sampled with the rising edge of the clock (SCL) line. The value of register SSPSR<7:1> is compared to the value of the SSPADD register. The address is compared on the falling edge of the eighth clock (SCL) pulse. If the addresses match and the BF and SSPOV bits are clear, the following events occur:
a)   The SSPSR register value is loaded into the SSPBUF register.
b)   The Buffer Full bit, BF, is set.
c)   An ACK pulse is generated.
d)   SSP Interrupt Flag bit, SSPIF (PIR1<3>), is set (interrupt is generated if enabled) – on the falling edge of the ninth SCL pulse.

Im Umkehrschluß bedeutet das, daß das Interrupt-Flag nicht gesetzt wird, wenn die Adresse nicht übereinstimmt.

Viele Grüße

Bernd
Gespeichert

Seiten: [1] Nach oben Drucken 
« vorheriges nächstes »
Gehe zu:  

Powered by MySQL Powered by PHP Made for Mozilla (Firefox) Made for Internet Explorer
Seite erstellt in 0.069 Sekunden mit 18 Zugriffen.
 
Top! Top!