<?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>topic Re: Clearing SCI Transmit Interrupt Flag in S12 / MagniV Microcontrollers</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Clearing-SCI-Transmit-Interrupt-Flag/m-p/139635#M2934</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;You're posting in the wrong group.&amp;nbsp; S12 is in the 16-bit MCU section.&amp;nbsp; Nevertheless ...&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;To stop TX interrupts from firing once you're done sending bytes, you neeed to turn off TX interrupts from within the TX ISR when you no longer have another&amp;nbsp;byte to send.&amp;nbsp; Re-enable TX interrupts when any byte is added to the TX queue (e.g., in your PutChar routine).&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Hope this helps.&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 12 Dec 2006 15:24:00 GMT</pubDate>
    <dc:creator>tonyp</dc:creator>
    <dc:date>2006-12-12T15:24:00Z</dc:date>
    <item>
      <title>Clearing SCI Transmit Interrupt Flag</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Clearing-SCI-Transmit-Interrupt-Flag/m-p/139634#M2933</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am using a MC9S12C64 and am trying to use the transmit interrupt to send each charcter out the serial port. However, I can not seem to clear the Interrupt flags. When I get an Interrupt for TDRE or TC, I read SCISR1 and then write to SCIDRL as sugegsted in the datasheet but the interrupts just continue indefinitley even after I am not longer sending data.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;From my understanding, TDRE is set one the transmit buffer is free. I write to the buffer for the next character. If no characters are to be sent I do not write to the data register.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This will cause TC interrupt since the TDRE flag is set and no data is being transmitted.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Now both TC and TDRE are set. The SCI interrupt will not continualy be called evern though no characters are being sent.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;How can you clear these flags so no interrupts occur after I have sent all my information?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks Shawn&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Dec 2006 12:24:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Clearing-SCI-Transmit-Interrupt-Flag/m-p/139634#M2933</guid>
      <dc:creator>slammers</dc:creator>
      <dc:date>2006-12-12T12:24:06Z</dc:date>
    </item>
    <item>
      <title>Re: Clearing SCI Transmit Interrupt Flag</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Clearing-SCI-Transmit-Interrupt-Flag/m-p/139635#M2934</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;You're posting in the wrong group.&amp;nbsp; S12 is in the 16-bit MCU section.&amp;nbsp; Nevertheless ...&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;To stop TX interrupts from firing once you're done sending bytes, you neeed to turn off TX interrupts from within the TX ISR when you no longer have another&amp;nbsp;byte to send.&amp;nbsp; Re-enable TX interrupts when any byte is added to the TX queue (e.g., in your PutChar routine).&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Hope this helps.&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Dec 2006 15:24:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Clearing-SCI-Transmit-Interrupt-Flag/m-p/139635#M2934</guid>
      <dc:creator>tonyp</dc:creator>
      <dc:date>2006-12-12T15:24:00Z</dc:date>
    </item>
    <item>
      <title>Re: Clearing SCI Transmit Interrupt Flag</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Clearing-SCI-Transmit-Interrupt-Flag/m-p/139636#M2935</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Shawn&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tonyp is right. The Tx interrupt is active whenever the output buffer is empty, which is true when nothing has been sent yet. The strategy is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FIRST WRITE (egs for UART 1):&lt;/P&gt;&lt;PRE&gt;
if (SCISR1_1 &amp;amp; TDRE) {&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;&amp;nbsp;&amp;nbsp; // tx not busy
&amp;nbsp;&amp;nbsp;&amp;nbsp; ucDummy = SCISR1_1;&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;&amp;nbsp; // read interrupt flags to ensure empty flag is reset when the character is written
&amp;nbsp;&amp;nbsp;&amp;nbsp; SCIDRL_1 = ucTxByte;&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; // send first byte
&amp;nbsp;&amp;nbsp;&amp;nbsp; SCICR2_1 |= (TIE);&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;&amp;nbsp;&amp;nbsp; // enable TX interrupt
}&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ON TX interrupts&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; if (SCISR1_1 &amp;amp; RDRF) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (more to send) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SCIDRL_1 = ucTxByte;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // send next byte
&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;&amp;nbsp; else {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SCICR2_1 &amp;amp;= ~(TIE);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // disable Tx interrupts
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark Butcher&lt;BR /&gt;&lt;A href="http://www.mjbc.ch/" rel="nofollow noopener noreferrer" target="_blank"&gt;www.mjbc.ch&lt;/A&gt; / &lt;A href="http://www.uTasker.com/" rel="nofollow noopener noreferrer" target="_blank"&gt;www.uTasker.com&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Dec 2006 23:47:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Clearing-SCI-Transmit-Interrupt-Flag/m-p/139636#M2935</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2006-12-12T23:47:21Z</dc:date>
    </item>
  </channel>
</rss>

