<html>
<head>
</head>
<body>
I don't ever intend on sustaining that rate of input for more than eight
character bursts. <br>
<br>
Last night I did some of the optimizations already within the PIC, removing
all the unnecessary 1us delays in the device driver used to alleviate the
original problems -- shifting errors in the PLA -- which were now unnecessary
as I had developed an error detection algorithm that looks at a single byte.
By removing these delays, I was able to reduce the time to 370us. Additionally,
this also reduced the number of errors from 5-15 errors per 65K data transfers
down to 1 error per 500K errors.<br>
<br>
Thanks a lot for your advice and I will keep it in mind as I develop the
project further.<br>
<br>
Joel Sherrill wrote:<br>
<blockquote type="cite" cite="mid:3CA0817A.F7F443A2@OARcorp.com">
  <pre wrap=""><br>Angelo Fraietta wrote:<br></pre>
  <blockquote type="cite">
    <pre wrap="">I have to make a correction on those previous calculations. I did not<br>read the settings on my CRO correctly. The actual values are 1 message<br>every 450 us, (not 4 us) and 1 every 500us.  So I am actually at the<br>extremes. The maximum transfer I could expect from a MIDI device would<br>be one byte every 320 us (10 bits per byte). So not setting the event<br>(as Chris Johns suggested) does save me a valuable 50us.<br></pre>
    </blockquote>
    <pre wrap=""><!----><br>Aren't you down to the point of counting instructions? :)  450 usecs<br>isn't<br>a lot of time/instructions.  Having spend a good portion of my early<br>career<br>on smart serial controllers, I have some hard won advice.  If you<br>actually <br>intend to sustain getting a byte every 320 usecs, then you have to<br>ensure<br>that your processing per-byte is less than that.  A good first step is<br>to write down the entire sequence of code executed for each byte.  Then<br>focus on which parts are unnecessary or not optimal for your case.  Eric <br>Norum did this for EPICS and the resulting work sped up mutexes and<br>counting<br>semaphores.  I did a similar effort for the GNU Ada run-time "self"<br>routine and it showed a 5% improvement in system idle time for me<br>optimizing out about 60 instructions.  You are at the point where <br>making sure the path you execute is minimal is important.<br><br></pre>
    <blockquote type="cite">
      <pre wrap="">Angelo Fraietta wrote:<br><br></pre>
      <blockquote type="cite">
        <pre wrap="">After some exhaustive testing I have come up with some figures that<br>represent data exchange rates between the Pic microcontroller and<br>the 386 using a PLA as an interface on an ISA bus using an interrupt<br>driven I/O read/write paradigm.<br><br>What I have done is make the Pic and the 386 communicate with each<br>other, each triggering an interrupt with the other, causing it to<br>write to the other device.<br><br>With the RTEMS event being triggered every  interrupt I have a<br>constant exchange rate of 1 message each way every 5 us.<br><br>Triggering the event only if the receive queue is empty gives me an<br>exchange rate of 1 Message every 4 us. I am saving 1 us by not<br>sending the unnecessary event.<br><br>The big factor in this test, however, is this method that I used to<br>check the exchange rates completely blows the 1 message every  650<br>us measurement I previously made away, thus proving that the<br>interrupt rate will more than adeq
uately sustain an input Midi<br>stream running at maximum transfer rate (31.25kbs, which is about 3<br>bytes per ms)<br><br>Angelo Fraietta wrote:<br><br></pre>
        <blockquote type="cite">
          <pre wrap="">You are right. Sending the event if the queue was not originally<br>empty when the ISR came is not necessary. I was already looping<br>the task until the queue was empty; I was, however, sending the<br>event regardless -- which is actually wasting CPU cycles. Thanks<br>for the tip? I'll see what I can get the interval down to by not<br>sending an unnecessary event.<br><br>Chris Johns wrote:<br><br></pre>
          <blockquote type="cite">
            <pre wrap="">Angelo Fraietta wrote:<br><br></pre>
            <blockquote type="cite">
              <pre wrap=""> Within the ISR I am doing the following:<br> Reading a 16 bit word from an I/O address<br> Decoding and adding that word onto a queue that is emptied out<br> by a<br> running task<br> Checking a second queue for data that needs to be transmitted<br> Transmitting a word to the I/O card.<br> Setting an event that causes the running task to empty the<br> queue.<br><br></pre>
              </blockquote>
              <pre wrap="">I would only send the event if the queue is empty and have the<br>task loop<br>until the queue is empty.<br><br><br></pre>
              </blockquote>
              <pre wrap="">--<br>Angelo Fraietta<br>PO Box 859<br>Hamilton NSW 2303<br>Home Page<br><a class="moz-txt-link-freetext" href="http://www.users.bigpond.com/angelo_f/">http://www.users.bigpond.com/angelo_f/</a><br>There are those who seek knowledge for the sake of knowledge - that is CURIOSITY<br>There are those who seek knowledge to be known by others - that is VANITY<br>There are those who seek knowledge in order to serve - that is LOVE<br>    Bernard of Clairvaux (1090 - 1153)<br><br><br></pre>
              </blockquote>
              <pre wrap="">--<br>Angelo Fraietta<br>PO Box 859<br>Hamilton NSW 2303<br>Home Page<br><a class="moz-txt-link-freetext" href="http://www.users.bigpond.com/angelo_f/">http://www.users.bigpond.com/angelo_f/</a><br>There are those who seek knowledge for the sake of knowledge - that is CURIOSITY<br>There are those who seek knowledge to be known by others - that is VANITY<br>There are those who seek knowledge in order to serve - that is LOVE<br>    Bernard of Clairvaux (1090 - 1153)<br><br><br></pre>
              </blockquote>
              <pre wrap="">--<br>Angelo Fraietta<br><br>PO Box 859<br>Hamilton NSW 2303<br><br>Home Page<br><br><a class="moz-txt-link-freetext" href="http://www.users.bigpond.com/angelo_f/">http://www.users.bigpond.com/angelo_f/</a><br><br>There are those who seek knowledge for the sake of knowledge - that is CURIOSITY<br>There are those who seek knowledge to be known by others - that is VANITY<br>There are those who seek knowledge in order to serve - that is LOVE<br>    Bernard of Clairvaux (1090 - 1153)<br></pre>
              </blockquote>
              <pre wrap=""><!----><br></pre>
              </blockquote>
              <br>
              <pre class="moz-signature" cols="$mailwrapcol">-- 
Angelo Fraietta

PO Box 859
Hamilton NSW 2303

Home Page


<a class="moz-txt-link-freetext" href="http://www.users.bigpond.com/angelo_f/">http://www.users.bigpond.com/angelo_f/</a>

There are those who seek knowledge for the sake of knowledge - that is CURIOSITY
There are those who seek knowledge to be known by others - that is VANITY
There are those who seek knowledge in order to serve - that is LOVE
    Bernard of Clairvaux (1090 - 1153)</pre>
              <br>
              </body>
              </html>