<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Assembler and pulse width</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/42356/assembler-and-pulse-width</link><description> I need to measure a pulse with that is almost faster then C can process with the hardware I&amp;#39;m using, so I think. I&amp;#39;m only getting a count of 26 on a pulse width, Witch has been good for the last four years. Now I need a count of at least 50 to try and</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: Assembler and pulse width</title><link>https://community.arm.com/thread/134390?ContentTypeID=1</link><pubDate>Fri, 04 Jun 2004 18:48:26 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:2f3b1fac-15c1-4d0f-b18f-e8e8acbc3deb</guid><dc:creator>erik  malund</dc:creator><description>&lt;p&gt;&lt;i&gt;I would be interested in knowing the part number of a processor that can increment a count when a pin is held low at or as close to once per clock cycle.&lt;/i&gt;&lt;br /&gt;
Any processor with a PCA e.g. hilips P89C66x and P89C51Rx2 and even, the lowly &amp;lt;$1 P89LPC932 where a similar is called a CCA.&lt;br /&gt;
&lt;br /&gt;
Erik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Assembler and pulse width</title><link>https://community.arm.com/thread/122403?ContentTypeID=1</link><pubDate>Fri, 04 Jun 2004 18:39:07 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:6be56ab6-040a-4b33-a063-804ce0f6d593</guid><dc:creator>A Kellogg</dc:creator><description>&lt;p&gt;I would be interested in knowing the part number of a processor that can increment a count when a pin is held low at or as close to once per clock cycle.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Assembler and pulse width</title><link>https://community.arm.com/thread/110905?ContentTypeID=1</link><pubDate>Fri, 04 Jun 2004 16:26:04 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:f337c486-960c-4dad-8754-ec22125da711</guid><dc:creator>Drew Davis</dc:creator><description>&lt;p&gt;I think if you take a look at the generated code, you&amp;#39;ll see there is very little overhead for that particular sequence of C.&lt;br /&gt;
&lt;br /&gt;
Note that the timer count is all performed in hardware.   No matter what language you use, you won&amp;#39;t see more counts between timer start and stop.  For that matter, if C were slowing you down, you would possibly get more counts due to a delay in disabling the timer after detecting the final edge.  Switching to assembler would reduce the count.&lt;br /&gt;
&lt;br /&gt;
You don&amp;#39;t mention your particular variant, but a lot of 8051 variants these days operate with less than 12 clocks/instruction, and usually have some extra bits somewhere to control a prescalar for the timers.  You might be able to program your timer to increment more frequently than once every 12 clocks.  Check the data sheet description of your timer hardware carefully.&lt;br /&gt;
&lt;br /&gt;
If not, the other solution is what Eric suggested: a faster XTAL frequency will make the timer count faster (among other things) and produce a larger count for the same amount of time.  Or find a variant with more sophisticated edge- and pulse- timing hardware built in.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Assembler and pulse width</title><link>https://community.arm.com/thread/96356?ContentTypeID=1</link><pubDate>Fri, 04 Jun 2004 15:18:36 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:c2ea68f5-2f0a-416e-8a50-2c7b5cb25e2c</guid><dc:creator>erik  malund</dc:creator><description>&lt;p&gt;two solutions&lt;br /&gt;
a) increase your xtal freq (make sure the chip can handle it)&lt;br /&gt;
b) use a derivative with a PCA&lt;br /&gt;
&lt;br /&gt;
Erik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Assembler and pulse width</title><link>https://community.arm.com/thread/72531?ContentTypeID=1</link><pubDate>Fri, 04 Jun 2004 14:53:47 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:a274f085-09ce-4e01-8bd0-b4e0de216e52</guid><dc:creator>glenn thacker</dc:creator><description>&lt;p&gt;This is the pulse width part of the code&lt;br /&gt;
&lt;pre&gt;
int count;

TMOD = (TMOD &amp;amp; 0xF0) | 0x05; //setup counter


  TL0 = 0; // Clear the timer low registers (freq to fast, TH0 not used)
  count = 0; //clear the count
  TR0 = 1; // start the counter.

  while (!INT0)
  while (INT0)

  TR0 = 0; // stop the counter.

  count =  TL0; //copy TL0 to count
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Assembler and pulse width</title><link>https://community.arm.com/thread/42324?ContentTypeID=1</link><pubDate>Fri, 04 Jun 2004 14:23:49 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:c0d69525-9580-4380-acae-1c5cd73cc106</guid><dc:creator>erik  malund</dc:creator><description>&lt;p&gt;&lt;i&gt;to try and fine-tune my process&lt;/i&gt;&lt;br /&gt;
it would be easy to comment if you would show your code&lt;br /&gt;
&lt;br /&gt;
Erik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>