Searching \ for 'I2C code explanation Provided sample' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page:
Search entire site for: 'I2C code explanation Provided sample'.

Truncated match.
PICList Thread
'I2C code explanation Provided sample'
1998\05\08@002221 by PHXSYS

picon face

The following is a code snip for I2C between a BS2 and another device. I am
new at this and trying to understand the code. It is not commented. I was
hoping someone could explain how this works. It seems to me it would be more
effective to use the shiftin/shiftout command? I am really having trouble with
the :

IF (bit_count & in_byte) then si2c_wbyte_do1

The "in_byte" is the value we want to write, but it is the "bit_count" that
is shifted to the right. Does this previous command mask the two variables and
"bit_count" is now the sum of those two variables after the mask?

Can someone make this code more efficient?


si2c_wbyte:             ' returns 1 if successful, 0 = NACK
                       ' in_byte is byte to be written
       low si2c_clk
       input si2c_data
       IF (bit_count & in_byte) then si2c_wbyte_do1
           low si2c_data
       input si2c_clk
       IF bit_count then si2c_wbyte_lp

   ' now test the acknowlege bit
   low si2c_clk
   input si2c_data
   input si2c_clk
   IF in1 then si2c_wbyte_ex

More... (looser matching)
- Last day of these posts
- In 1998 , 1999 only
- Today
- New search...