<?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: Clock cycles estimation in 8-bit Microcontrollers</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Clock-cycles-estimation/m-p/156116#M8944</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Hi JMD,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;You didn't say which MCU you were working with but just about all MCU data sheets have a section that says what the bus cycles are for each instruction.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Download the MCU data sheet and you should find what you are looking for.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Hope this helps,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Rodo&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 15 May 2008 22:10:21 GMT</pubDate>
    <dc:creator>Rodo55</dc:creator>
    <dc:date>2008-05-15T22:10:21Z</dc:date>
    <item>
      <title>Clock cycles estimation</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Clock-cycles-estimation/m-p/156115#M8943</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;I would like to have a file including the estimation of the execution cycles of some functions. I have several options:&lt;/DIV&gt;&lt;DIV&gt;-By using debug options, I can toggle pins that my application is not using after entering and before exiting, in order to measure with a scope the time a function lasts;&lt;/DIV&gt;&lt;DIV&gt;-Through the Hiware debugger, I could look at the cycle counter and calculate the number of cycles,&lt;/DIV&gt;&lt;DIV&gt;-Look into some files generated by the compiler and look for information related to the cycles in order to calculate these cycles.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I know that it is a bit difficult since it depends on factor like the number of iteration that a for structure could have, but I am wondering how to estimate these number of cycles.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Which is your recommendation?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thank you and best regards!&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 May 2008 18:28:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Clock-cycles-estimation/m-p/156115#M8943</guid>
      <dc:creator>jmd</dc:creator>
      <dc:date>2008-05-15T18:28:24Z</dc:date>
    </item>
    <item>
      <title>Re: Clock cycles estimation</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Clock-cycles-estimation/m-p/156116#M8944</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Hi JMD,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;You didn't say which MCU you were working with but just about all MCU data sheets have a section that says what the bus cycles are for each instruction.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Download the MCU data sheet and you should find what you are looking for.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Hope this helps,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Rodo&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 May 2008 22:10:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Clock-cycles-estimation/m-p/156116#M8944</guid>
      <dc:creator>Rodo55</dc:creator>
      <dc:date>2008-05-15T22:10:21Z</dc:date>
    </item>
    <item>
      <title>Re: Clock cycles estimation</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Clock-cycles-estimation/m-p/156117#M8945</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;I know that you can find the clock cycles consumption of each different instruction in the datasheet. What I am looking for is&amp;nbsp;a quick mechanism for estimating the clock cycles consumption that a long function could have. This way, I can make some calculations in order to know the CPU load.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Regarding the cicrocontroller, I am currently working with an AW60 micro, but my question is general. I am wondering if the Codewarrior includes an option in order to generate a log file or something similar that I can use to estimate the CPU consumption.&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 May 2008 22:39:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Clock-cycles-estimation/m-p/156117#M8945</guid>
      <dc:creator>jmd</dc:creator>
      <dc:date>2008-05-15T22:39:51Z</dc:date>
    </item>
    <item>
      <title>Re: Clock cycles estimation</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Clock-cycles-estimation/m-p/156118#M8946</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;&lt;BLOCKQUOTE&gt;&lt;DIV&gt;&lt;HR /&gt;jmd wrote:&lt;BR /&gt;&lt;DIV&gt;Regarding the cicrocontroller, I am currently working with an AW60 micro, but my question is general. I am wondering if the Codewarrior includes an option in order to generate a log file or something similar that I can use to estimate the CPU consumption.&lt;/DIV&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;It doesn't have any such feature that I am aware of.&amp;nbsp; Of the options given in your first post, I would almost always perfer using a pin on the microcontroller.&amp;nbsp; I usually have at least 1 status LED on a board and I often use this in the developement process to find the length of time routines take, the loading due to ISRs and anything else timing related.&amp;nbsp; It will add a minimum of&amp;nbsp;time to a routine, and the amount of time added is&amp;nbsp;known.&amp;nbsp; For a quick estimate I just disassmble the code to get a look at the assembly lines generated from each line of C.&amp;nbsp; In the end, I don't know of much anything much easier than toggling a pin and using a scope.&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 May 2008 23:40:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Clock-cycles-estimation/m-p/156118#M8946</guid>
      <dc:creator>allawtterb</dc:creator>
      <dc:date>2008-05-15T23:40:57Z</dc:date>
    </item>
    <item>
      <title>Re: Clock cycles estimation</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Clock-cycles-estimation/m-p/156119#M8947</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;If you use the "disassemble" function on the right click menu it will list the number of cycles for each instruction.&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 May 2008 00:00:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Clock-cycles-estimation/m-p/156119#M8947</guid>
      <dc:creator>JimDon</dc:creator>
      <dc:date>2008-05-16T00:00:47Z</dc:date>
    </item>
    <item>
      <title>Re: Clock cycles estimation</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Clock-cycles-estimation/m-p/156120#M8948</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&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;  0000 a7f9     [2] &amp;lt;-- cylces            AIS   #-7   17:     volatile  byte marker=0;  0002 95       [2]             TSX     0003 7f       [4]             CLR   ,X   18:        19:     volatile word data=0xaaaa;  0004 45aaaa   [3]             LDHX  #-21846  0007 9eff02   [5]             STHX  2,SP   20:     volatile word data2=0x5555;  000a 455555   [3]             LDHX  #21845  000d 9eff04   [5]             STHX  4,SP   21:     volatile word data3=0xcccc;  0010 45cccc   [3]             LDHX  #-13108  0013 9eff06   [5]             STHX  6,SP   22:          23:     ReturnAddress = (word) &amp;amp;marker;   0016 95       [2]             TSX     0017 960000   [5]             STHX  ReturnAddress   24:     ReturnAddress = *((word*) (&amp;amp;marker +OFFSET));  001a 9efe04   [5]             LDHX  4,SP  001d 960000   [5]             STHX  ReturnAddress   25:     ReturnAddress =(word) GetMyCaller;  0020 450000   [3]             LDHX  @GetMyCaller  0023 960000   [5]             STHX  ReturnAddress   26:         27:  }  0026 a707     [2]             AIS   #7  0028 81       [6]             RTS      28:     29: &lt;/PRE&gt;&lt;/DIV&gt;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 09:00:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Clock-cycles-estimation/m-p/156120#M8948</guid>
      <dc:creator>JimDon</dc:creator>
      <dc:date>2020-10-29T09:00:12Z</dc:date>
    </item>
  </channel>
</rss>

