On Thu, 8 Jan 2004 13:15:04 -0000, Alan B. Pearce wrote on Re: [PIC:] Pic as an i2c slave: >Attached is the I2C module that I derived from the AN734 application = Note. Thanks again for this code, Alan; you did what my initial humble request to the Piclist implied, i.e. you sent me some working code, the very first I have seen that had been corrected for the error in Microchip's application note. This has allowed me to correct my routines; they work reliably now with either of my i2c interfaces. Now that I know what was missing and where, things look as if that mystery could have been easy to solve; as you know by now, it was not easy for me, nor was it obviously for many people who have tried to work their way out of AN734 and miserably failed: as a testimony of this, some people (from this list) even sent me code that had not been corrected, saying "this works for me"... Even the people that wrote my excellent compiler have a non working example on their site.=20 I want to thank all those on this list and on the PicBasic list who tried to help or even did help in a friendly, ccoperative, and dare I say altruist manner, namely: Gordon Hardman, Dennis Saputelli, Ron Mistaki, Paul James E., Richard Kendrick, Alan B. Pearce, Russell McMahon, Bob Axtell, Bob Blick, Martin B=FChler, Michael Rigby-Jones, Jan-Erik Soderholm, John N. Power, Josh Koffman.=20 I hope I forgot noone. I think it is important that the information on how to implement an i2c slave with a PIC be available in the future; consequently I have written a page that presents the working routines in my switching power supply application as an example that could be modified to suit other needs. =46or this same application, which uses a Dallas Semiconductors DS1820 onewire sensor and a PID algorithm to regulate the temperature of a CCD camera's Peltier-cooled sensor, I have written reusable routines that allow detecting the presence of the sensor, getting its temperature with the highest level of resolution it allows, and displaying in one of two units (Celsius and Farenheit) or one of two scales (Kelvin and Rankine).=20 These routines answer frequently asked questions on how to store then display signed values using positive integer arithmetics, by using offsetting and scaling techniques. They are available for download from the following URL: http://astrosurf.com/soubie/microcontroleurs.htm With minor restrictions (see on download page), they may freely be used in any context, including "for profit". * Xrobert.soubie@free.frX (veuillez supprimer les "X") * http://www.astrosurf.com/soubie * Au royaume des aveugles, les borgnes sont mal vus... - P.Dac -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads