<?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: CW6.0 Coding Problems in Classic/Legacy CodeWarrior</title>
    <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/CW6-0-Coding-Problems/m-p/142996#M1522</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;I use "unsigned char sci_count" to track the number of bytes in a rotary buffer.&amp;nbsp; The function "get_sci_buffer_status" returns the value of sci_count to the calling routine.&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;unsigned char sci_count = 0x00;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;// buffer count&lt;BR /&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;unsigned char get_sci_buffer_status() {&lt;BR /&gt;&amp;nbsp;return(sci_count);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// return # of data bytes in buffer&lt;BR /&gt;}&lt;BR /&gt;&lt;/DIV&gt;&lt;DIV&gt;I am at a loss to understand why the return might be unprintable.&amp;nbsp; Any help understanding this problem is greatly appreciated.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Spencer&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 14 Aug 2007 21:34:06 GMT</pubDate>
    <dc:creator>admin</dc:creator>
    <dc:date>2007-08-14T21:34:06Z</dc:date>
    <item>
      <title>CW6.0 Coding Problems</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/CW6-0-Coding-Problems/m-p/142994#M1520</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;I am trying to implement a routine to assign the count of a&amp;nbsp;rotary buffer count to an array element.&amp;nbsp; The array element, command_buffer[1] is defined as an unsigned char and the function, get_sci_buffer_status returns an unsigned char.&amp;nbsp; However, the assignment does not appear to work.&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;As the code below shows, I am trying to output the array element immediately after assignment.&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Each time the CASE is called, the 'A' is sent out the SCI port, however, the "count" is never sent out.&amp;nbsp; If I swap position of the 2 SCI outputs, I don't get anything on the SCI port.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I have also tried to output the contents of command_buffer[1] directly with the same results as above.&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I do not understand why this assignment does not work.&amp;nbsp; Any suggestions will be greatly appreciated.&amp;nbsp; Code fragment is shown below.&amp;nbsp; Also, I do not have access to the monitor to debug this correctly.&amp;nbsp;&amp;nbsp;That is why I am using the SCI&amp;nbsp;to output variables.&amp;nbsp; &amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;CODE FRAGMENT&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;// returns 0 if no data in sci_buffer else retuns data count in buffer&lt;BR /&gt;&amp;nbsp;&amp;nbsp;case CMD_GET_SCI_STATUS: {&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;unsigned char count = get_sci_buffer_status();&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;command_buffer[1] = get_sci_buffer_status();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// this is the line I need to work, the rest is debug&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (SCS1 &amp;amp; SCS1_SCTE_MASK) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;SCDR = 'A';&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;while (~(SCC1&amp;amp; SCS1_SCTE_MASK));&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (SCS1 &amp;amp; SCS1_SCTE_MASK) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;SCDR = count;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;return (1);&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;}&lt;BR /&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Aug 2007 19:02:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/CW6-0-Coding-Problems/m-p/142994#M1520</guid>
      <dc:creator>admin</dc:creator>
      <dc:date>2007-08-14T19:02:17Z</dc:date>
    </item>
    <item>
      <title>Re: CW6.0 Coding Problems</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/CW6-0-Coding-Problems/m-p/142995#M1521</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;What have you got connected to the SCI?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;If your count does not equate to a visible ASCII character you would not expect to see anything using a terminal application.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Maybe you need to convert&amp;nbsp;the count into a string before you write it?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;That seems more likely than a basic failure in your compiler!&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Paul.&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Aug 2007 21:06:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/CW6-0-Coding-Problems/m-p/142995#M1521</guid>
      <dc:creator>mccPaul</dc:creator>
      <dc:date>2007-08-14T21:06:06Z</dc:date>
    </item>
    <item>
      <title>Re: CW6.0 Coding Problems</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/CW6-0-Coding-Problems/m-p/142996#M1522</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;I use "unsigned char sci_count" to track the number of bytes in a rotary buffer.&amp;nbsp; The function "get_sci_buffer_status" returns the value of sci_count to the calling routine.&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;unsigned char sci_count = 0x00;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;// buffer count&lt;BR /&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;unsigned char get_sci_buffer_status() {&lt;BR /&gt;&amp;nbsp;return(sci_count);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// return # of data bytes in buffer&lt;BR /&gt;}&lt;BR /&gt;&lt;/DIV&gt;&lt;DIV&gt;I am at a loss to understand why the return might be unprintable.&amp;nbsp; Any help understanding this problem is greatly appreciated.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Spencer&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Aug 2007 21:34:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/CW6-0-Coding-Problems/m-p/142996#M1522</guid>
      <dc:creator>admin</dc:creator>
      <dc:date>2007-08-14T21:34:06Z</dc:date>
    </item>
    <item>
      <title>Re: CW6.0 Coding Problems</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/CW6-0-Coding-Problems/m-p/142997#M1523</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi Spencer,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;As Paul already mentioned...&lt;/DIV&gt;&lt;DIV&gt;You are sending the raw cound value out the serial port, should you not be converting this value to ASCII before you send it?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Aug 2007 04:51:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/CW6-0-Coding-Problems/m-p/142997#M1523</guid>
      <dc:creator>peg</dc:creator>
      <dc:date>2007-08-15T04:51:55Z</dc:date>
    </item>
    <item>
      <title>Re: CW6.0 Coding Problems</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/CW6-0-Coding-Problems/m-p/142998#M1524</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Thanks for the suggestions.&amp;nbsp; That was indeed my problem.&amp;nbsp; I converted the data to a printable char and now I can see something on the SCI port.&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Aug 2007 04:56:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/CW6-0-Coding-Problems/m-p/142998#M1524</guid>
      <dc:creator>admin</dc:creator>
      <dc:date>2007-08-15T04:56:12Z</dc:date>
    </item>
  </channel>
</rss>

