This is a multi-part message in MIME format. ------_=_NextPart_001_01C3D423.FFB1B11B Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable hi i once used a 16f872 as i2c slave. look at the c code attached: i2chw is the i2c slave code. iic2lcd is the main code, just to show how routines of i2chw are called. this approach is based on a microchip application note (assembler) with = some modifications. let me know if this works for you. tino >-----Original Message----- >From: Robert Soubie [mailto:robert.soubie@FREE.FR] >Sent: Monday, January 05, 2004 10:43 PM >To: PICLIST@MITVMA.MIT.EDU >Subject: [PIC:] Pic as an i2c slave > >Happy new year, Bonne ann=E9e nouvelle, > >Has anyone written a working (tested and testable) >application programmed either in asm, Basic or C where the >PIC would be used as an i2c slave? > >Despite much reading and testing in numerous attempts and >some partial positive results, I am unable to have my own >application work reliably; > >Specifically some calls from the master, a PC using two >different i2C interfaces, are not "seen"; I do not have the >least idea of why... > >I program in Basic and use interrupt routines on a 16F876 >that save compiler's internal variables, and I have >explored, with no great success, the two main routes, >i.e. either all exchanges are processed in the same routine >starting at the first interrupt occurence (receiving a >command byte and two parameters, processing then resending >two result bytes) or as an alternatively I have implemented >a state machine as per AN734x. > >The processing logics have been tested for all the >occurences where the interrupts are "seen" and processed, >i.e. 3 out of four times; they work ok. > >Thanks in advance for any help, for I do not know what to >try next... I know I am looking for something that is far >for obvious, as the paucity of information on the net >testifies... > >* 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#nomail Going offline? Don't AutoReply us! >email listserv@mitvma.mit.edu with SET PICList DIGEST in the body -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu ------_=_NextPart_001_01C3D423.FFB1B11B Content-Type: application/octet-stream; name="iic2lcd.h" Content-Transfer-Encoding: base64 Content-Description: iic2lcd.h Content-Disposition: attachment; filename="iic2lcd.h" DQovL3Jlc2VydmVkIGZvciBpY2Q6DQoNCi8vIFBJQzE2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yYWN0ZXIgZGV0ZWN0aW9uIGluZGlj YXRpb24NCg0KLy9kYXRhIG1lbW9yaWVzDQoNCmNoYXIgUExfQVJUSVNUWzMyXTsNCmNoYXIgUExf VElUTEVbMzJdOw0KY2hhciBQTF9CSVRSQVRFOw0KY2hhciBQTF9USU1FWzJdOw0KY2hhciBQTF9U UkFDS1syXTsNCmNoYXIgUExfU1RBVEU7DQoNCnZvaWQgVHJhbnNmZXIoY2hhciB0eXBlLCBjaGFy IHBvc2l0aW9uLCBjaGFyIGRhdGEpOw0KLy8tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0NCi8vIHRyYW5zZmVycyBkYXRh IGZyb20gaTJjIGJ1ZmZlciB0byBkYXRhIGJ1ZmZlcg0KLy8tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0NCg0Kdm9pZCBD bGVhckJ1ZihjaGFyIHR5cGUpOw0KLy8tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0NCi8vIGNsZWFyIGFwcHJvcHJpYXRl IGRhdGFidWZmZXINCi8vLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tDQo= ------_=_NextPart_001_01C3D423.FFB1B11B Content-Type: application/octet-stream; name="i2chw.c" Content-Transfer-Encoding: base64 Content-Description: i2chw.c Content-Disposition: attachment; filename="i2chw.c" I2luY2x1ZGUgImkyY2h3LmgiDQojaW5jbHVkZSAiaWljMmxjZC5oIg0KDQoNCg0Kdm9pZCBJMmNo d0luaXQodm9pZCkgew0KDQovLy0tLS0tLS0tLS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NCn0NCg0KDQo= ------_=_NextPart_001_01C3D423.FFB1B11B Content-Type: application/octet-stream; name="i2chw.h" Content-Transfer-Encoding: base64 Content-Description: i2chw.h Content-Disposition: attachment; filename="i2chw.h" DQovLy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLQ0KLy9Db25zdGFudCBEZWZpbml0aW9ucw0KLy8tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0N Cg0KI2RlZmluZQkgTk9ERV9BRERSCTB4NDQJLy8gSTJDIGFkZHJlc3Mgb2YgdGhpcyBub2RlDQoJ CQkJLy8gQ2hhbmdlIHRoaXMgdmFsdWUgdG8gYWRkcmVzcyB0aGF0DQoJCQkJLy8geW91IHdpc2gg dG8gdXNlLg0KLy8tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0NCi8vIEJ1ZmZlciBMZW5ndGggRGVmaW5pdGlvbg0KLy8t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0NCg0KI2RlZmluZQkgUlhfQlVGX0xFTgk4CS8vIExlbmd0aCBvZiByZWNlaXZl IGJ1ZmZlcg0KDQovLy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KLy8gVmFyaWFibGUgZGVjbGFyYXRpb25zDQovLy0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tL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