<?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: MC9S08QE128 Array Size. in 8-bit Microcontrollers</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/MC9S08QE128-Array-Size/m-p/192118#M14804</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi Bigmac,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks for your help.&amp;nbsp; I did try the continuous mode but I was not getting what I think I should.&amp;nbsp; So I tried the single conversion method.&amp;nbsp; I changed the while loop into an if statement and it seemed to work for me.&amp;nbsp; With the conversion starting after each read.&amp;nbsp; Perhaps I'll try the continous mode and use the while loop as you suggeted.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I looked at the true time window and the clock indicates that it is at about 4MHz.&amp;nbsp; So I assume that is what I'm working with.&amp;nbsp; This does seem to confirm with the SCI module that I am using and the number of cycle I am getting from the ADC readout.&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thank you again for your help.&amp;nbsp; I hope to get further help from you in the future.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;FWFan&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Oct 2008 03:14:27 GMT</pubDate>
    <dc:creator>FWFan</dc:creator>
    <dc:date>2008-10-15T03:14:27Z</dc:date>
    <item>
      <title>MC9S08QE128 Array Size.</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/MC9S08QE128-Array-Size/m-p/192110#M14796</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi All,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I'm trying to store about 1024 bytes of ADC readings.&lt;/DIV&gt;&lt;DIV&gt;I am only successful at storing 256 at the most.&lt;/DIV&gt;&lt;DIV&gt;I've tried changing the stack size but still no luck.&lt;/DIV&gt;&lt;DIV&gt;Do you have any advice?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I've included my main.c and prm files.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thank you,&lt;/DIV&gt;&lt;DIV&gt;FWFan&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Oct 2008 13:39:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/MC9S08QE128-Array-Size/m-p/192110#M14796</guid>
      <dc:creator>FWFan</dc:creator>
      <dc:date>2008-10-07T13:39:26Z</dc:date>
    </item>
    <item>
      <title>Re: MC9S08QE128 Array Size.</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/MC9S08QE128-Array-Size/m-p/192111#M14797</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;A number of issues.&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE&gt;&lt;PRE&gt;&lt;FONT color="#ff0000"&gt;volatile byte adcLow[ArraySize] @0x00000080;&lt;/FONT&gt;
&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;Why put start of array in Page0?&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE&gt;&lt;PRE&gt;&lt;FONT color="#ff0000"&gt;void interrupt VectorNumber_Vadc ADC_ISR(void) {&lt;/FONT&gt;&lt;FONT color="#ff0000"&gt;
&lt;/FONT&gt; &lt;FONT color="#6633FF"&gt; byte i;&lt;/FONT&gt;&lt;FONT color="#ff0000"&gt;
&lt;/FONT&gt; &lt;FONT color="#ff0000"&gt; byte ADCResult[ArraySize];&lt;/FONT&gt;
&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;This array should be static or declared outside of the interrupt function.&lt;BR /&gt;&lt;BR /&gt;BUT your problem is almost certainly that the array index you use is defined as a byte which has a range of 0..255, ie 256 !&lt;BR /&gt;&lt;PRE&gt;&lt;FONT color="#ff0000"&gt;     ADCResult[i] = ADCRL;&lt;/FONT&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 09:44:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/MC9S08QE128-Array-Size/m-p/192111#M14797</guid>
      <dc:creator>stevep</dc:creator>
      <dc:date>2020-10-29T09:44:18Z</dc:date>
    </item>
    <item>
      <title>Re: MC9S08QE128 Array Size.</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/MC9S08QE128-Array-Size/m-p/192112#M14798</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hello,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;In addition to the problems already outlined, I would suspect that the operation of the ISR code will not be as you intend.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Since you have decided to use interrupts for the ADC operation, I might normally expect that only a single ADC reading would be processed during each pass through the ISR.&amp;nbsp; If more than one reading is processed, this will slow the operation because of the wait, within the ISR,&amp;nbsp;until the next reading is ready.&amp;nbsp; So there would be no benefit to use interrupts over polling.&amp;nbsp; I notice that the present code does not wait for completion of each reading beyond the first.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I wonder at the purpose of the array &lt;FONT face="Courier New"&gt;ADCResult[].&lt;/FONT&gt;&lt;FONT face="Arial"&gt;&amp;nbsp; It does not seem to achieve anything since it does not&amp;nbsp;appear to be read read by any of the code.&amp;nbsp; If the variable were declared static, it would not be visible outside of the ISR, so perhaps it should be&amp;nbsp;global.&amp;nbsp; In either case, it would no longer occupy the stack, so the stack size might be reduced from its current 4K size.&amp;nbsp; This would provide more RAM capacity for the large global/static arrays.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Regards,&lt;/DIV&gt;&lt;DIV&gt;Mac&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Oct 2008 20:33:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/MC9S08QE128-Array-Size/m-p/192112#M14798</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2008-10-07T20:33:24Z</dc:date>
    </item>
    <item>
      <title>Re: MC9S08QE128 Array Size.</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/MC9S08QE128-Array-Size/m-p/192113#M14799</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi Guys,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thank you for the quick replies.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Steve:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I originally declared adcLow[ArraySize] as a global so I can see the values in RAM.&lt;BR /&gt;But I think I can take that out now.&amp;nbsp; I also do not know about Page memory.&lt;BR /&gt;How does that work?&amp;nbsp; I tried a long time to understand that concept but still in the dark.&lt;/DIV&gt;&lt;DIV&gt;Thanks for noticing byte i, you're right, that blew by me.&amp;nbsp; I originally tested for only 128 bytes.&lt;BR /&gt;I do not understand about static declaration though.&amp;nbsp; I can also try putting the array in the main&lt;BR /&gt;section later.&lt;/DIV&gt;&lt;DIV&gt;Thanks a lot for your help.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;BigMac:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I'm trying to get a snapshot of my bandpass filter output.&lt;/DIV&gt;&lt;DIV&gt;I can see from the data that I'm getting three images of the sine wave.&lt;/DIV&gt;&lt;DIV&gt;I don't know if this is correct because according to my calculation, I should&lt;/DIV&gt;&lt;DIV&gt;be receiving over 600 data points for a complete period.&amp;nbsp; I'm assuming a 8 MHz divide down to 4 MHz.&lt;/DIV&gt;&lt;DIV&gt;As for the ADCResult array, I will try to do some simple DSP later.&amp;nbsp; Even feed it&lt;/DIV&gt;&lt;DIV&gt;to my FPGA board later.&amp;nbsp; Right now, I'm just trying to see if I can get the samples correctly.&lt;/DIV&gt;&lt;DIV&gt;I'm still trying to understand how globals and locals work with this micro.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thank you very much.&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Oct 2008 05:19:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/MC9S08QE128-Array-Size/m-p/192113#M14799</guid>
      <dc:creator>FWFan</dc:creator>
      <dc:date>2008-10-08T05:19:52Z</dc:date>
    </item>
    <item>
      <title>Re: MC9S08QE128 Array Size.</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/MC9S08QE128-Array-Size/m-p/192114#M14800</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi Bigmac,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Can you deduce from the ADC initial code that the bus clock is 4 MHz?&amp;nbsp; That is my assumption from the data sheet along with my settings.&amp;nbsp; However, I am getting&amp;nbsp;repeated sine waves instead of one sine wave with 606 samples.&amp;nbsp; My sine wave should have a period of 3.03 ms.&amp;nbsp; From the datasheet, I should&lt;/DIV&gt;&lt;DIV&gt;get 606 samples to represent one period.&amp;nbsp; I have tried single conversion before, but I was getting 128 bytes of the same value.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Are you saying I should do one sample and wait, and then trigger again every 5 us?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thank you.&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Oct 2008 14:09:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/MC9S08QE128-Array-Size/m-p/192114#M14800</guid>
      <dc:creator>FWFan</dc:creator>
      <dc:date>2008-10-08T14:09:04Z</dc:date>
    </item>
    <item>
      <title>Re: MC9S08QE128 Array Size.</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/MC9S08QE128-Array-Size/m-p/192115#M14801</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Hello,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Using the POR default settings for the ICS module, the untrimmed bus frequency should lie somewhere within the range 4-5 MHz.&amp;nbsp; Your current settings for the ADC will give an ADC clock 2-2.5 MHz.&amp;nbsp; For continuous conversion mode, the first conversion will take 85 bus cycles (17.0- 21.3 us), and subsequent conversions 74 bus cycles (14.8-17.5 us).&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;You are a long way from your intended sampling rate of 5 us.&amp;nbsp; Using the short sampling interval would reduce the number of bus cycles to 45 or 34 cycles.&amp;nbsp; However, it is possible that this may not be sufficient cycles to process each reading, even using polling.&amp;nbsp; If you were to double the bus frequency, whilst keeping the same ADC clock frequency, the minimum bus cycles available for processing each reading would increase to 68 cycles.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;For polling operation within main(), you will need to wait until each&amp;nbsp;conversion is completed before reading the conversion value.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;word i;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;...&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;for (i = 0; i &amp;lt; ArraySize; i++) {&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp; while (!ADCSC1_COCO);&amp;nbsp; // Wait until conversion complete&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp; ADCResult[i] = ADCRL;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;}&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Regards,&lt;/DIV&gt;&lt;DIV&gt;Mac&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;Message Edited by bigmac on &lt;SPAN class="date_text"&gt;2008-10-09&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;04:27 AM&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Oct 2008 01:26:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/MC9S08QE128-Array-Size/m-p/192115#M14801</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2008-10-09T01:26:02Z</dc:date>
    </item>
    <item>
      <title>Re: MC9S08QE128 Array Size.</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/MC9S08QE128-Array-Size/m-p/192116#M14802</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi Bigmac,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks for your help.&amp;nbsp; I wasn't sure how my clock was working.&amp;nbsp; My signal is only 336 Hz, so I don't really need something too quick.&amp;nbsp; 2 Mhz should do it, assuming that is the sampling rate.&amp;nbsp; I did tried out your code but didn't get it to work.&amp;nbsp; I did not see any sample at all.&amp;nbsp; Do you think I need to add the code in the for loop to start the conversion every time?&amp;nbsp; Since this is a single conversion?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I do have a puzzle though about the clock.&amp;nbsp; I tried out the SCI at 9600 bps and it worked.&amp;nbsp; But this was done at the assumption that the clock is at 8 MHz.&amp;nbsp; What do you think?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thank you for your help.&lt;/DIV&gt;&lt;DIV&gt;FWFan&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Oct 2008 23:11:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/MC9S08QE128-Array-Size/m-p/192116#M14802</guid>
      <dc:creator>FWFan</dc:creator>
      <dc:date>2008-10-09T23:11:13Z</dc:date>
    </item>
    <item>
      <title>Re: MC9S08QE128 Array Size.</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/MC9S08QE128-Array-Size/m-p/192117#M14803</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hello FWFan,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I had previously assumed that you were using continuous conversion mode, since this is what your posted code seemed to indicate.&amp;nbsp; Using single conversion mode, you would need to initiate the conversion on each circuit of the for loop.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;The bus frequency will depend on how you have actually set up the ICS module.&amp;nbsp; The frequency range that I previously stated assumed that the power-up default settings was used.&amp;nbsp; For reliable SCI operation using the internal reference, the reference would need to be trimmed to a specific frequency.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Regards,&lt;/DIV&gt;&lt;DIV&gt;Mac&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Oct 2008 09:04:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/MC9S08QE128-Array-Size/m-p/192117#M14803</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2008-10-14T09:04:33Z</dc:date>
    </item>
    <item>
      <title>Re: MC9S08QE128 Array Size.</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/MC9S08QE128-Array-Size/m-p/192118#M14804</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi Bigmac,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks for your help.&amp;nbsp; I did try the continuous mode but I was not getting what I think I should.&amp;nbsp; So I tried the single conversion method.&amp;nbsp; I changed the while loop into an if statement and it seemed to work for me.&amp;nbsp; With the conversion starting after each read.&amp;nbsp; Perhaps I'll try the continous mode and use the while loop as you suggeted.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I looked at the true time window and the clock indicates that it is at about 4MHz.&amp;nbsp; So I assume that is what I'm working with.&amp;nbsp; This does seem to confirm with the SCI module that I am using and the number of cycle I am getting from the ADC readout.&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thank you again for your help.&amp;nbsp; I hope to get further help from you in the future.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;FWFan&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Oct 2008 03:14:27 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/MC9S08QE128-Array-Size/m-p/192118#M14804</guid>
      <dc:creator>FWFan</dc:creator>
      <dc:date>2008-10-15T03:14:27Z</dc:date>
    </item>
  </channel>
</rss>

