<?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>S12 / MagniV MicrocontrollersのトピックRe: Problem in using SCI.....sending a string</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Problem-in-using-SCI-sending-a-string/m-p/145826#M3943</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have to ask, you do have SCISR1 declared as volatile, otherwise the compiler may optimize to only read it once.&amp;nbsp; Have a look at the dissasembly.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just for grins put a timing delay of just over one byte time between each character send, see what happens.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Beyond that, reading the data sheet for the MC9S12C, it says that TDRE is 0 coming out of reset (non-empty) so this should stop your first character sending!&amp;nbsp; This is the opposite to the behaviour on the 08's.&amp;nbsp; I have rev 1.20 of the data sheet, I see the current on-line version still maintains that fact.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you are using Codewarrior, have you tried using the beans?&amp;nbsp; Saves all this low level stuff...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 11 Mar 2009 08:10:09 GMT</pubDate>
    <dc:creator>alexod</dc:creator>
    <dc:date>2009-03-11T08:10:09Z</dc:date>
    <item>
      <title>Problem in using SCI.....sending a string</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Problem-in-using-SCI-sending-a-string/m-p/145823#M3940</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a problem with using SCI interface. I am able to send one character but sending a string does not work. Perhaps anyone can tell me what is wrong.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I am using hyperterminal at my PC.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;DIV class="msg_source_code"&gt;&lt;DIV class="text_smallest"&gt;Code:&lt;/DIV&gt;&lt;PRE&gt;#define TX&amp;nbsp; 0x08
#define RX&amp;nbsp; 0x04
#define RIE 0x20

void InitSCI0(void){&amp;nbsp;&amp;nbsp; SCI0BDH= 0x00; // SCI Baud Rate Registers (SCIBDH and SCIBDL)&amp;nbsp;&amp;nbsp; // calculating the baud rate is: SCI baud rate = SCI&amp;nbsp;&amp;nbsp; // module clock / (16 x BR)&amp;nbsp;&amp;nbsp; SCI0BDL= 26; // SCI Baud Rate Registers (SCIBDH and SCHBDL)&amp;nbsp;&amp;nbsp; // Bit 7 6 5 4 3 2 1 0&amp;nbsp;&amp;nbsp; // SBR7 SBR6 SBR5 SBR4 SBR3 SBR2 SBR1 SBR0&amp;nbsp;&amp;nbsp; // 26 -&amp;gt; 19200 Baudrate at Bus Clock 8MHz
&amp;nbsp;&amp;nbsp; SCI0CR1= 0x00; // SCI Control Register 1 (SCICR1); 8N1&amp;nbsp;&amp;nbsp; SCI0CR2= 0x00; // SCI Control Register 2 (SCICR2)}void SetSCI0(char OnOff){&amp;nbsp;&amp;nbsp; SCI0CR2= OnOff; // SCI Control Register 2 (SCICR2)}void PutcharSCI0(unsigned char cPut){&amp;nbsp;&amp;nbsp; while( !(SCI0SR1 &amp;amp; 0x80) );&amp;nbsp;&amp;nbsp; SCI0DRL= cPut;}void PutStSCI0(unsigned char *strPut){&amp;nbsp;&amp;nbsp; while (*strPut != 0)&amp;nbsp;&amp;nbsp; {&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while ( !(SCI0SR1 &amp;amp; 0x80) );
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SCI0DRL = *strPut++;&amp;nbsp;&amp;nbsp; }}InitSCI0();SetSCI0(RX|TX);PutcharSCI0('3'); &amp;lt;- That works, sending one character&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Hyperterminal receives the 3
PutStSCI0("Send Text"); &amp;lt;- That does not work
&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Hyperterminal does not receive anything
&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; It stopps at this line: while(!(SCI0SR1 &amp;amp; 0x80));&lt;/PRE&gt;&lt;/DIV&gt;&lt;BR /&gt;&amp;nbsp;Has anybody an idea what could be wrong? I wonder why sending one character works but sending a string fails.&lt;BR /&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 08:47:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Problem-in-using-SCI-sending-a-string/m-p/145823#M3940</guid>
      <dc:creator>Piete</dc:creator>
      <dc:date>2020-10-29T08:47:10Z</dc:date>
    </item>
    <item>
      <title>Re: Problem in using SCI.....sending a string</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Problem-in-using-SCI-sending-a-string/m-p/145824#M3941</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;The code looks ok. I suspect that the problem might be the debugger destroying your status flags. SCI status flags are cleared by reading, so the debugger often clears them since it reads the memory map.&lt;BR /&gt;&lt;BR /&gt;Try to run the program without the BDM attached and see if it solves anything.&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Jan 2009 16:25:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Problem-in-using-SCI-sending-a-string/m-p/145824#M3941</guid>
      <dc:creator>Lundin</dc:creator>
      <dc:date>2009-01-23T16:25:46Z</dc:date>
    </item>
    <item>
      <title>Re: Problem in using SCI.....sending a string</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Problem-in-using-SCI-sending-a-string/m-p/145825#M3942</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;I tried it without the BDM but is is the same. It is possible to send one character. The terminal programm on the PC can receive the character. It is not possible to send a string.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Jan 2009 20:58:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Problem-in-using-SCI-sending-a-string/m-p/145825#M3942</guid>
      <dc:creator>Piete</dc:creator>
      <dc:date>2009-01-23T20:58:35Z</dc:date>
    </item>
    <item>
      <title>Re: Problem in using SCI.....sending a string</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Problem-in-using-SCI-sending-a-string/m-p/145826#M3943</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have to ask, you do have SCISR1 declared as volatile, otherwise the compiler may optimize to only read it once.&amp;nbsp; Have a look at the dissasembly.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just for grins put a timing delay of just over one byte time between each character send, see what happens.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Beyond that, reading the data sheet for the MC9S12C, it says that TDRE is 0 coming out of reset (non-empty) so this should stop your first character sending!&amp;nbsp; This is the opposite to the behaviour on the 08's.&amp;nbsp; I have rev 1.20 of the data sheet, I see the current on-line version still maintains that fact.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you are using Codewarrior, have you tried using the beans?&amp;nbsp; Saves all this low level stuff...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Mar 2009 08:10:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Problem-in-using-SCI-sending-a-string/m-p/145826#M3943</guid>
      <dc:creator>alexod</dc:creator>
      <dc:date>2009-03-11T08:10:09Z</dc:date>
    </item>
    <item>
      <title>Re: Problem in using SCI.....sending a string</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Problem-in-using-SCI-sending-a-string/m-p/145827#M3944</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you very much! It seems to work fine now. I do not know what was wrong! I started a new project to test sci and now it seems to work fine.&amp;nbsp; I really do not know what was wrong.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Mar 2009 20:06:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Problem-in-using-SCI-sending-a-string/m-p/145827#M3944</guid>
      <dc:creator>Piete</dc:creator>
      <dc:date>2009-03-13T20:06:52Z</dc:date>
    </item>
  </channel>
</rss>

