Bob, still not having too much luck.. what values of pullup resistors for 100KHz operation? I'm using 10K ones at the moment. Your code: don't think it makes much difference, but SSPSTAT is in bank 1 not bank0. The values you loaded into SSPADD aren't correct (if you use the formula) - but again, don't know if this would make a difference... Jim ----- Original Message ----- From: Bob Corkery To: Sent: 19 October 1999 20:06 Subject: Re: Question on SSPCON in 16F877, I2C Master > ;set up I2C Port > bsf STATUS,RP0 ;Bank 1 > movlw 0x60 > movwf SSPCON2 > ; movlw 0x03 ;400KHz @ 4MHz Clock > movlw 0x0A ;100KHz @ 4MHz Clock > movwf SSPADD > bcf STATUS,RP0 ;Bank 0 > clrf SSPSTAT > movlw 0x28 > movwf SSPCON > bsf SSPCON,SSPEN > > > ; > ; I2C Master Write to Dallas DS1803 > ; > WriteI2C: > bcf STATUS,RP0 ;Bank 0 > bcf PIR1,SSPIF > bsf STATUS,RP0 ;Bank 1 > bsf SSPCON2,SEN ;send Start bit > bcf STATUS,RP0 ;Bank 0 > mw1 btfss PIR1,SSPIF > goto mw1 > > movlw 0x50 ;send control byte, identify the correct DS1803 > movwf SSPBUF > bcf PIR1,SSPIF > mw2 btfss PIR1,SSPIF ;wait for ACK > goto mw2 > > movf Data1,0 ;send command byte; ie Write Pot1 > movwf SSPBUF > bcf PIR1,SSPIF > mw3 btfss PIR1,SSPIF ;wait for ACK > goto mw3 > > movf Data2,0 ;send data byte > movwf SSPBUF > bcf PIR1,SSPIF > mw4 btfss PIR1,SSPIF ;wait for ACK > goto mw4 > > bcf PIR1,SSPIF > bsf STATUS,RP0 ;Bank 1 > bsf SSPCON2,PEN ;Send Stop bit > bcf STATUS,RP0 ;Bank 0 > mw5 btfss PIR1,SSPIF > goto mw5 > return > > ______________________________ Reply Separator _________________________________ > Subject: Question on SSPCON in 16F877 > Author: Jim Main at Internet > Date: 10/19/1999 6:47 PM > > > I'm trying to get a 16F877 to talk to a 24LC02B - so far without much > success... > > In SSPCON, the bottom 4 bits set up the I2C mode. I've tried 1000 - where > clock = Fosc/(4*(SSPADD+1)) & couldn't get it to work. > > Does anyone know what I2C firmware controlled master mode is (& what speed > it would run at & whether it's clock dependant) > > & what does "slave idle" mean in the context of the above. > > Has anyone got I2C master mode working on the '877?? > > Jim > --- >