<?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>CodeWarrior for MCUのトピックProblems setting up SCI in CW</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Problems-setting-up-SCI-in-CW/m-p/205022#M7883</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;CW version - 5.9 build - 2830&lt;/DIV&gt;&lt;DIV&gt;MCU - m68mod9s12c32 using 9s12c dev board&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I'm trying to send commands to my LCD using SCI and I'm having trouble using it correctly.&amp;nbsp; i've tried using the processor expert, but it keeps complaining and throwing errors so I tried to set it up myself.&amp;nbsp; Heres the function i'm using.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV class="msg_source_code"&gt;&lt;DIV class="text_smallest"&gt;Code:&lt;/DIV&gt;&lt;PRE&gt;void send_LCD(unsigned char *array){&amp;nbsp; int count = 0;&amp;nbsp; int i;&amp;nbsp; int dummy = 0;&amp;nbsp; count = intlen(array);&amp;nbsp; for (i = 0; i &amp;lt; count+1; i++) {&amp;nbsp;&amp;nbsp;&amp;nbsp; while (SCISR1_TDRE == 1) {&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SCISR2 = 0x08;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dummy = SCISR1;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SCIDRL = array[i];&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&amp;nbsp;&amp;nbsp; SCICR2_TE = 0;&amp;nbsp; }&lt;/PRE&gt;&lt;/DIV&gt;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;array is a function of commands (254, 87, 1, 'Z') in this case.&amp;nbsp; I want to loop through and send each one once TDRE says that is ready to go.&amp;nbsp; I can't seem to get the loops to work properly, and of course, nothing happens to my LCD.&amp;nbsp; Any suggestions?&amp;nbsp; Thanks&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 25 Nov 2008 03:10:36 GMT</pubDate>
    <dc:creator>Kyle</dc:creator>
    <dc:date>2008-11-25T03:10:36Z</dc:date>
    <item>
      <title>Problems setting up SCI in CW</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Problems-setting-up-SCI-in-CW/m-p/205022#M7883</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;CW version - 5.9 build - 2830&lt;/DIV&gt;&lt;DIV&gt;MCU - m68mod9s12c32 using 9s12c dev board&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I'm trying to send commands to my LCD using SCI and I'm having trouble using it correctly.&amp;nbsp; i've tried using the processor expert, but it keeps complaining and throwing errors so I tried to set it up myself.&amp;nbsp; Heres the function i'm using.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV class="msg_source_code"&gt;&lt;DIV class="text_smallest"&gt;Code:&lt;/DIV&gt;&lt;PRE&gt;void send_LCD(unsigned char *array){&amp;nbsp; int count = 0;&amp;nbsp; int i;&amp;nbsp; int dummy = 0;&amp;nbsp; count = intlen(array);&amp;nbsp; for (i = 0; i &amp;lt; count+1; i++) {&amp;nbsp;&amp;nbsp;&amp;nbsp; while (SCISR1_TDRE == 1) {&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SCISR2 = 0x08;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dummy = SCISR1;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SCIDRL = array[i];&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&amp;nbsp;&amp;nbsp; SCICR2_TE = 0;&amp;nbsp; }&lt;/PRE&gt;&lt;/DIV&gt;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;array is a function of commands (254, 87, 1, 'Z') in this case.&amp;nbsp; I want to loop through and send each one once TDRE says that is ready to go.&amp;nbsp; I can't seem to get the loops to work properly, and of course, nothing happens to my LCD.&amp;nbsp; Any suggestions?&amp;nbsp; Thanks&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Nov 2008 03:10:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Problems-setting-up-SCI-in-CW/m-p/205022#M7883</guid>
      <dc:creator>Kyle</dc:creator>
      <dc:date>2008-11-25T03:10:36Z</dc:date>
    </item>
    <item>
      <title>Re: Problems setting up SCI in CW</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Problems-setting-up-SCI-in-CW/m-p/205023#M7884</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;The function "intlen" seems very preculiar to me. What does it do? I assume you use some sort of global variables to get it working. Why aren't you using a struct instead?&lt;BR /&gt;&lt;BR /&gt;Also, try to make dummy volatile. It is very likely that the compiler optimizes away the write to that variable, since the variable is never used.&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Nov 2008 18:22:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Problems-setting-up-SCI-in-CW/m-p/205023#M7884</guid>
      <dc:creator>Lundin</dc:creator>
      <dc:date>2008-11-25T18:22:26Z</dc:date>
    </item>
    <item>
      <title>Re: Problems setting up SCI in CW</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Problems-setting-up-SCI-in-CW/m-p/205024#M7885</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Hello Kyle,&lt;BR /&gt;&lt;BR /&gt;It seems that the intent of your code is to wait until the SCISR1_TDRE flag becomes set, and then continue to send the next character.&amp;nbsp; However, your code does not do this.&amp;nbsp; The following code should provide the proper wait process.&lt;BR /&gt;&lt;PRE&gt;for (i = 0; i &amp;lt; count+1; i++) {
   while (SCISR1_TDRE == 0);  // Wait for flag set
   SCISR2 = 0x08;
   (void)SCISR1;              // Read register
   SCIDRL = array[i];         // Send character
}
SCICR2_TE = 0;                // Disable send&lt;/PRE&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Mac&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Nov 2008 10:02:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Problems-setting-up-SCI-in-CW/m-p/205024#M7885</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2008-11-26T10:02:53Z</dc:date>
    </item>
  </channel>
</rss>

