<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>8-bit MicrocontrollersのトピックRe: I2c Routines (in Assembly)</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/I2c-Routines-in-Assembly/m-p/138668#M5044</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi Curt,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Well, I really didn't want to bit-bang the interface, just figured&lt;/DIV&gt;&lt;DIV&gt;somebody had some 'get byte - put byte' routines in their&lt;/DIV&gt;&lt;DIV&gt;bag of tricks.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Looks like&amp;nbsp;most of&amp;nbsp;the Freescale Apnotes are written in C.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks,&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;Tim&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 29 Jun 2007 22:40:49 GMT</pubDate>
    <dc:creator>UtopiaTim</dc:creator>
    <dc:date>2007-06-29T22:40:49Z</dc:date>
    <item>
      <title>I2c Routines (in Assembly)</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/I2c-Routines-in-Assembly/m-p/138666#M5042</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;Hi Folks,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I'm using a QG8, and need to do some data transfer to one of Maxim's&lt;/DIV&gt;&lt;DIV&gt;digital pots via I2c.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Was wondering if anybody has some master routines for the QG8 written&lt;/DIV&gt;&lt;DIV&gt;in assembly.&amp;nbsp; I saw the ap note, but was done in C.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;(just trying to save some time).&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;Thanks!&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Tim&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Jun 2007 05:54:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/I2c-Routines-in-Assembly/m-p/138666#M5042</guid>
      <dc:creator>UtopiaTim</dc:creator>
      <dc:date>2007-06-29T05:54:02Z</dc:date>
    </item>
    <item>
      <title>Re: I2c Routines (in Assembly)</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/I2c-Routines-in-Assembly/m-p/138667#M5043</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;If you are needing to bit-bang the interface, try app note AN3304 and its companion for the RS08.&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Jun 2007 21:12:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/I2c-Routines-in-Assembly/m-p/138667#M5043</guid>
      <dc:creator>Curt</dc:creator>
      <dc:date>2007-06-29T21:12:50Z</dc:date>
    </item>
    <item>
      <title>Re: I2c Routines (in Assembly)</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/I2c-Routines-in-Assembly/m-p/138668#M5044</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi Curt,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Well, I really didn't want to bit-bang the interface, just figured&lt;/DIV&gt;&lt;DIV&gt;somebody had some 'get byte - put byte' routines in their&lt;/DIV&gt;&lt;DIV&gt;bag of tricks.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Looks like&amp;nbsp;most of&amp;nbsp;the Freescale Apnotes are written in C.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks,&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;Tim&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Jun 2007 22:40:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/I2c-Routines-in-Assembly/m-p/138668#M5044</guid>
      <dc:creator>UtopiaTim</dc:creator>
      <dc:date>2007-06-29T22:40:49Z</dc:date>
    </item>
    <item>
      <title>Re: I2c Routines (in Assembly)</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/I2c-Routines-in-Assembly/m-p/138669#M5045</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Hello Tim,&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Specifically what C code functions do you refer?&amp;nbsp; I suspect it shouldn't be too difficult to convert these to assembly routines, since most of the code is likely to involve writing and reading IIC registers.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;If you use full chip simulation of the C&amp;nbsp;code in the CW debugger, and examine each C instruction step by step, this will also show what assembly steps the compiler uses.&amp;nbsp; This may help if you are not familiar with C code.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Regards,&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Mac&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 30 Jun 2007 10:19:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/I2c-Routines-in-Assembly/m-p/138669#M5045</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2007-06-30T10:19:57Z</dc:date>
    </item>
    <item>
      <title>Re: I2c Routines (in Assembly)</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/I2c-Routines-in-Assembly/m-p/138670#M5046</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Thanks Bigmac,&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I'll try that. - didn't know the CW debugger would also show the assembly equivalents.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Tim&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Jul 2007 20:36:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/I2c-Routines-in-Assembly/m-p/138670#M5046</guid>
      <dc:creator>UtopiaTim</dc:creator>
      <dc:date>2007-07-02T20:36:55Z</dc:date>
    </item>
    <item>
      <title>Re: I2c Routines (in Assembly)</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/I2c-Routines-in-Assembly/m-p/138671#M5047</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;I have some '12' code that bit-bangs the I2C port. When I did a project, I was unsure if I'd use a chip variant that had the I2C hardware or not, so I hooked it up so that I could do it either way and wrote my routines in 12 assembly. Should be pretty easy to convert to 08 if you still need them.&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jul 2007 09:50:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/I2c-Routines-in-Assembly/m-p/138671#M5047</guid>
      <dc:creator>mke_et</dc:creator>
      <dc:date>2007-07-04T09:50:31Z</dc:date>
    </item>
    <item>
      <title>Re: I2c Routines (in Assembly)</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/I2c-Routines-in-Assembly/m-p/138672#M5048</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Hello Tim,&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Application note AN3291 provides C code for the use of the IIC module for a range of different MCUs, specifically to communicate with an IIC EEPROM device.&amp;nbsp; The C functions are shown in the attached file IIC_EEPROM.c.&amp;nbsp; The file IIC_EEPROM.asm is an attempt to do a similar thing in assembly.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Of course, the code would need to be altered to suit the digital pot device.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Regards,&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Mac&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Jul 2007 11:15:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/I2c-Routines-in-Assembly/m-p/138672#M5048</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2007-07-09T11:15:06Z</dc:date>
    </item>
    <item>
      <title>Re: I2c Routines (in Assembly)</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/I2c-Routines-in-Assembly/m-p/138673#M5049</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Thanks BigMac!&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I'll give em a try.&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;As it ends up, I have found an even cheaper part for the project, and&lt;/DIV&gt;&lt;DIV&gt;- darn the bad luck - it uses an SPI interface.&lt;IMG alt=":smileyhappy:" class="emoticon emoticon-smileyhappy" id="smileyhappy" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-happy.gif" title="Smiley Happy" /&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks again to all!!&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Tim&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 14 Jul 2007 02:26:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/I2c-Routines-in-Assembly/m-p/138673#M5049</guid>
      <dc:creator>UtopiaTim</dc:creator>
      <dc:date>2007-07-14T02:26:38Z</dc:date>
    </item>
    <item>
      <title>Re: I2c Routines (in Assembly)</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/I2c-Routines-in-Assembly/m-p/138674#M5050</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Hello Tim,&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;I don't call that bad luck!&amp;nbsp; The SPI (as a master) should be faster and much simpler to use than IIC.&amp;nbsp; Well, that's my opinion . . . perhaps others will differ.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Regards,&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Mac&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 14 Jul 2007 11:23:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/I2c-Routines-in-Assembly/m-p/138674#M5050</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2007-07-14T11:23:09Z</dc:date>
    </item>
    <item>
      <title>Re: I2c Routines (in Assembly) vs SPI</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/I2c-Routines-in-Assembly/m-p/138675#M5051</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;I do agree that a SPI is far less troublesome.&lt;BR /&gt;It's easy to use does not have a complicated protocol: you send, you receive !&lt;BR /&gt;&lt;BR /&gt;Alban.&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 15 Jul 2007 23:09:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/I2c-Routines-in-Assembly/m-p/138675#M5051</guid>
      <dc:creator>Alban</dc:creator>
      <dc:date>2007-07-15T23:09:51Z</dc:date>
    </item>
    <item>
      <title>Re: I2c Routines (in Assembly)</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/I2c-Routines-in-Assembly/m-p/138676#M5052</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hello Mac,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I've been struggling with trying to convert the C code from AN3291 and then I found your post.&amp;nbsp; You program worked fine, first try&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thank you.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I don't mean to seem greedy but did you also convert the read_block and write_block functions (Example 13) ?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Roger&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Oct 2008 21:48:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/I2c-Routines-in-Assembly/m-p/138676#M5052</guid>
      <dc:creator>RogerSchaefer</dc:creator>
      <dc:date>2008-10-16T21:48:30Z</dc:date>
    </item>
    <item>
      <title>Re: I2c Routines (in Assembly)</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/I2c-Routines-in-Assembly/m-p/138677#M5053</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hello Roger,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;The attached code attempts to implement block write and read sub-routines based on AN3291, but not using interrupts.&amp;nbsp; The code has not so far been tested.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Regards,&lt;/DIV&gt;&lt;DIV&gt;Mac&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Oct 2008 12:13:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/I2c-Routines-in-Assembly/m-p/138677#M5053</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2008-10-20T12:13:09Z</dc:date>
    </item>
    <item>
      <title>Re: I2c Routines (in Assembly)</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/I2c-Routines-in-Assembly/m-p/138678#M5054</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hello Mac,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks for sending the IIC block read and write; I'll test them.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Although I said in an eariler post that the IIC_write_byte worked, I find&amp;nbsp;the program hangs&amp;nbsp;if it is called more than once in quick succession.&amp;nbsp; The problem is the EEPROM will not respond to anything until a write is complete.&amp;nbsp; On the second write attempt your subroutine then hangs waiting for an ACK that never comes.&amp;nbsp; I can work around the problem by putting a wait loop greater than the EEPROM "Write Cycle Time" at the end of your subroutine.&amp;nbsp; However, the EEPROM data sheet says the proper way to handle this is with "Acknowledge Polling".&amp;nbsp; I haven't worked out how to do that with 9S08 IIC module.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Roger&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Oct 2008 22:49:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/I2c-Routines-in-Assembly/m-p/138678#M5054</guid>
      <dc:creator>RogerSchaefer</dc:creator>
      <dc:date>2008-10-20T22:49:50Z</dc:date>
    </item>
    <item>
      <title>Re: I2c Routines (in Assembly)</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/I2c-Routines-in-Assembly/m-p/138679#M5055</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;For anyone actually trying to use the C code in AN3291, the application note doesn't spell out that you actually have to setup IIC_SLAVE with the required control byte. If only using one device and you have the external address tied low, just change the line of code to&lt;BR /&gt;&lt;BR /&gt;const byte IIC_SLAVE = 0xA0;&lt;BR /&gt;&lt;BR /&gt;If the application note had have bothered to say this, it would have certainly saved me a couple of hours of fault finding, hooking up the DSO etc. As always, I post in the hope this saves someone else wasting time due to inadequate or poor documentation. Why they didn't put an actual working example in is beyond me, or just a line that explains what IIC_SLAVE is, or maybe call it IIC_SLAVE_ADDRESS so its remotely obvious.&lt;BR /&gt;&lt;BR /&gt;Also, not sure why, but I couldnt work out how to use the internal pullups on the IIC lines on the S08SH8 processor (not sure about others). Seems a bit pointless to me. Oh, and if you write to the port after setting up IIC, it seems to disable IIC or stop it from working. Didnt bother wasting time trying to find out what it was, I just init the IIC after writing to the ports.&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;Message Edited by CarlFST60L_3rd on &lt;SPAN class="date_text"&gt;2008-10-21&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;08:29 AM&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Oct 2008 14:25:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/I2c-Routines-in-Assembly/m-p/138679#M5055</guid>
      <dc:creator>CarlFST60L_3rd</dc:creator>
      <dc:date>2008-10-21T14:25:25Z</dc:date>
    </item>
    <item>
      <title>Re: I2c Routines (in Assembly)</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/I2c-Routines-in-Assembly/m-p/138680#M5056</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hello Roger,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;The application note AN3291 does not appear to implement acknowledge polling - but perhaps I missed it.&amp;nbsp; I agree that you will need to wait until the write process is complete before commencing a further EEPROM read or write.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Personally, I might consider generating a 5ms timeout period perhaps using TPM overflow interrupt, or possibly a TPM channel.&amp;nbsp; If the TPM overflow period is greater than 5ms, it may be possible to simply read the TPM count to determine whether timeout has occurred.&amp;nbsp; By using the TPM it should be possible to do other tasks (within the main loop), while waiting for the EEPROM to become ready.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Regards,&lt;/DIV&gt;&lt;DIV&gt;Mac&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Oct 2008 08:56:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/I2c-Routines-in-Assembly/m-p/138680#M5056</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2008-10-22T08:56:16Z</dc:date>
    </item>
    <item>
      <title>Re: I2c Routines (in Assembly)</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/I2c-Routines-in-Assembly/m-p/138681#M5057</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi Mac,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;No there was not anything in AN3291 about acknowledge polling.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;And I did set up a TPM based wait period at the end of the write routine and I suppose that is good enough.&amp;nbsp; A polling approach would be more stylish but I can't quite see how to do it.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Roger&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Oct 2008 09:07:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/I2c-Routines-in-Assembly/m-p/138681#M5057</guid>
      <dc:creator>RogerSchaefer</dc:creator>
      <dc:date>2008-10-22T09:07:47Z</dc:date>
    </item>
    <item>
      <title>Re: I2c Routines (in Assembly)</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/I2c-Routines-in-Assembly/m-p/138682#M5058</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hello Carl,&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;&lt;BLOCKQUOTE&gt;&lt;DIV&gt;&lt;HR /&gt;CarlFST60L_3rd wrote:&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;BR /&gt;Also, not sure why, but I couldnt work out how to use the internal pullups on the IIC lines on the S08SH8 processor (not sure about others). Seems a bit pointless to me. Oh, and if you write to the port after setting up IIC, it seems to disable IIC or stop it from working. Didnt bother wasting time trying to find out what it was, I just init the IIC after writing to the ports.&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;HR /&gt;&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;DIV&gt;The enabling or disabling of the internal pullups is&amp;nbsp;applicable when the port pins are used as GPIO.&amp;nbsp; In most cases, when a peripheral such as the IIC module is enabled, the normal pin functions will be over-ridden by the module.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Anyway, for correct IIC operation, the external pullup resistors will need to be of substantially lower value than provided by an internal pullup.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Regards,&lt;/DIV&gt;&lt;DIV&gt;Mac&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Oct 2008 09:13:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/I2c-Routines-in-Assembly/m-p/138682#M5058</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2008-10-22T09:13:39Z</dc:date>
    </item>
    <item>
      <title>Re: I2c Routines (in Assembly)</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/I2c-Routines-in-Assembly/m-p/138683#M5059</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hello Roger,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;If there is any potential for code to hang during normal operation, perhaps this needs to be specifically handled, in a more general sense, prior to COP timeout occurring.&amp;nbsp; For the case if the IIC, this would involve an error exit condition should the flag not become set&amp;nbsp;within a few microseconds.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;For example, the instruction -&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BRCLR&amp;nbsp; IICIF,IICS,*&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Wait until flag is set&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;might be replaced by the following code -&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; JSR&amp;nbsp;&amp;nbsp;&amp;nbsp; WAIT_IICIF&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Wait for IICF flag&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BCC&amp;nbsp;&amp;nbsp;&amp;nbsp; TIMEOUT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Error exit if timeout occurred&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;; WAIT FOR IICIF FLAG OR TIMEOUT&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;; On exit CF = 0 if timeout occurred&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;WAIT_IICF:&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LDA&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#20&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Timeout 180 cycles&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;WLOOP1:&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BRSET&amp;nbsp; IICIF,IICS,WEXIT ; Branch if flag is set (CF = 1)&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;DBNZA&amp;nbsp; WLOOP1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; 9-cycle loop&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;WEXIT:&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RTS&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;You might do a similar sub-routine for the RXACK flag, if necessary, and&amp;nbsp;the result&amp;nbsp;would probably be quite similar to the acknowledge polling process.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Regards,&lt;/DIV&gt;&lt;DIV&gt;Mac&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Oct 2008 10:10:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/I2c-Routines-in-Assembly/m-p/138683#M5059</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2008-10-22T10:10:43Z</dc:date>
    </item>
  </channel>
</rss>

