On Wed, 7 Jan 2004 09:09:13 -0000, Alan B. Pearce wrote on Re: [PIC:] Pic as an i2c slave: >>>hang on a minute. Are you really telling us that the code in >>>Microchip Application Note AN734 doesn't work? >> >>I am saying that it does not work reliably (i.e. on every >>occurence) in my context, that is as an assembler routine >>inserted in my Basic application, with use of preamble and >>postamble routines to the effect of saving and restoring the >>PIC's registers and the compiler internal variables. > >OK, this is more info than you have given up till now. If you had said = this >at the start, you may have even avoided most of Olin's diatribe. Sorry, but the facts are the facts and this is precisely what I have said in previous message: Quote: "Despite much reading and testing in numerous attempts and some partial positive results, I am unable to have my own application work reliably; " Please reread the whole thread and particularly the messages I authored with the new understanding you now have of the situation and I am pretty confident that you will be prevented from granting me *any* responsability in what happened with that person. Please also remember that even as I have been speaking fluently english since the age of 12 (I am now 55), I learnt the language in the industrial suburbs north of London where, as a paying guest, I shared the life of modest but generous british workers; this may explain why my english has nothing to do with Oxford's or Cambridge dialects.=20 =46YI I also speak fluently, though far from perfectly, two other languages: Italian and Greek. This greatly increases reciprocal understanding of others, but also the statistics of misunderstanding 8-). By the way someone has just explained to me that the term "demand" (which is fully french by the way) has a strong meaning in english, whereas in french it just means "request", and a polite and humble at that. So we now have the beginning of an explanation of the rude and insulting "diatribe", as you call it (you know what a litotes is, don't you?).=20 Of course, it remains to be seen why Mister Lathrop used that term in the first place, but here we are leaving the terrain of philology and linguistics to enter that of psychiatry. I simply think he had unwillingly decided beforehand I was an arrogant moronic englishly illetirate frenchie (the times are hard for us you know 8-) and that my humble and polite request *had* to be an unacceptable demand.=20 Which you know by now (and probably knew by then) is not true...=20 There is more than one way to make a fool of oneself. Back on track... >>Would you care indicate whether yours was a large >>application (how busy the PIC was when not managing i2c), >>and whether the i2c was managed in the program's main loop >>or as a real interrupt service routine? > >It is done as a real interrupt service routine that puts the received = bytes >into a FIFO buffer. The code is exactly as in the application note with = two >modifications, one to correct the error that Bob reports below, and the >other to handle a status byte that I wanted the master to be able to = poll, >and is handled totally within the interrupt routine without dropping out= to >background code. =46ine and usable information. >> bsf SSPCON,CKP ; Release the clock. >> >>was missing. >> >>Problem is this instruction is present in the "Doi2cWrite" >>sub, which is called every time the slave is read by the >>master (states 3 and 4). So my question is "where is (or >>was) that instruction missing?". >> >>Also, if it is not missing in the version I have, why does >>it basically work, but unreliably? >> >>More mysteries... > >I suspect that the unreliability is for the reason that Bob states. I = took >Bobs statement literally, and put the instruction you note in the code = that >handles the end of transmission situation, where the one you are looking= at >is in the middle of the message handling. Just looking through the code = I >have, it looks like it goes at the beginning of I2CErr, where the NOP >instruction is. =46ine. You suggest adding the bsf SSPCON, CKP instruction there, don't you? If so this is new information to me, and none of my many previous testes tests took it into account, so this may be a solutions to my woes. I still have to fully understand why CKP should be set at that point, but of course I'll believe the gurus...=20 A code comment here says that we should never get to that state; having to add that instruction at that place implies that for the whole thing to consistantly succeed afterwards it first has to fail once and reach this uncontrolled state... Strange... Thanks anyway. I *also* had stressed that concern about AN734 correctness in previous messages. If you, or others for that matter, had given me that answer sooner, probably we would have avoided that kind of rough relations. There is a lesson there: do to yourself what you are inclined to impose on others... >If this does not fix the code I will send you my code, but it is a = module >designed around Olin's development environment, so is a linkable module. Please do, I'll keep that private. =46riendly, Robert * 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