piclist 2000\06\05\113406a >
Thread: SSP I2C Problems
face BY : Achim Vollhardt email (remove spam text)

Hi Les,
it seems that your I2C-sending routine lacks of polling of the BusyFlag
which will be cleared, when the transmission of the 8 bits is complete.

I2C_in and I2Cout are small subroutines that only change the direction
of the SDA Pin as acknowledging won't work with SDA configured as
The byte supposed for transmission has to be delivered in W.

;************************* Send routine I2C-Bus : send_I2C
       banksel PIR1
       bcf     PIR1,SSPIF

       banksel SSPBUF
       movwf   SSPBUF

       banksel SSPSTAT
i2ctx                           ; I2C send in process
       btfsc   SSPSTAT,BF
       goto    i2ctx

       call    I2C_in

       banksel PIR1
i2cnoack                        ; I2C frame complete
       btfss   PIR1,SSPIF
       goto    i2cnoack

       call    I2C_out

       banksel SSPCON2
       btfss   SSPCON2,ACKSTAT
       retlw   0               ; ACK
       retlw   1               ; no ACK

Les wrote:
{Quote hidden}

   Achim Vollhardt
   Universitaet Zuerich
   Physik Institut, 36J36
   Winterthurerstrasse 190
   CH-8057 Zuerich

   tel: 0041-1-6355771

   email: KILLspamavollharspam_OUTspamKILLspamphysik.unizh.ch

<393BC854.8370477C@physik.unizh.ch> 7bit

See also: www.piclist.com/techref/i2cs.htm?key=i2c
Reply You must be a member of the piclist mailing list (not only a www.piclist.com member) to post to the piclist. This form requires JavaScript and a browser/email client that can handle form mailto: posts.
Subject (change) SSP I2C Problems

month overview.

new search...