<?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: SCTimer in LPC11U68 in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/SCTimer-in-LPC11U68/m-p/547934#M13554</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by R2D2 on Fri Dec 12 03:28:22 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: mattiad&lt;/STRONG&gt;&lt;BR /&gt;My idea would be: every 100ms my timer gives me an interrupt. During this interrupt I read values contained in the counter registesr...&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; :quest: &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Why do you count?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;SCT is able to do a lot of useful things for. If you capture A with SCT0 this cycle time is useful to calculate the speed.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If you use another SCT0 capture input for B you get the direction (&amp;lt; (cycle time)/2 or &amp;gt;(cycle time)/2)&amp;nbsp; :) &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 19:48:07 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T19:48:07Z</dc:date>
    <item>
      <title>SCTimer in LPC11U68</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SCTimer-in-LPC11U68/m-p/547931#M13551</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by mattiad on Thu Dec 11 01:33:07 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Dear All,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would like to use my micro LPC11u68, 100 pins configuration, in order to&amp;nbsp; check the speed of a quadrature ecoder.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Essentially I need to count the rising and falling edges of two separate signals A &amp;amp; B, typical of the encoder.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;One solution is to generate and interrupt every edge and increase a counter, but these implies that every XX us I have to occupy some resources to the micro.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The ideal solution is to have a register which increases stand alone once an event&amp;nbsp; (rising and falling edges) occours. This would be perfect for me because every 100ms I'd check the value of the register, whitout "stressing" the micro too much.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;It seems that with SCTimer (chapter 18 of UM10732) it is possible but, since I'm an inexperienced beginner I don't understand exactly how to make it possible.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Has someone already tried this?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Do you have any suggestion?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you in advance&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:48:05 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SCTimer-in-LPC11U68/m-p/547931#M13551</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:48:05Z</dc:date>
    </item>
    <item>
      <title>Re: SCTimer in LPC11U68</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SCTimer-in-LPC11U68/m-p/547932#M13552</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by The Dude on Thu Dec 11 12:25:00 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I don't know of any examples but maybe this will help you out. Please note that I just&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;dreamed this up so it is up to you to verify whether it meets your exact needs.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This idea is based on the SCTs being able to be clocked on the positive or negative&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;of inputs to the SCTs not on both edges. I chose positive edges but you could probably&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;do one on the positive and one on the negative if there was an advantage in that.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Since the A and B inputs should be 90 degrees out of phase you might be able to use&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;that to your advantage in calculating the speed and only clocking on one edge.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If this works out it would be great if you could post the code on a BLOG.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Good luck&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The Dude&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Configuration ================&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1. Set SCT0 to be clocked off of your input A (positive edge). See page 338 of 608.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CLKMODE = 0x02&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2. Set SCT1 to be clocked off of your input B (positive edge). See page 338 of 608.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CLKMODE = 0x02&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;3. Configure another timer to interrupt and output a pulse every 100 ms.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;4. Connect this timer output to an input to SCT0 and SCT1. I think you&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; will have to do this externally on your PCB.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;5. Configure the SCT0 and SCT1 counter to capture the count values&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; when the timer output/SCT inputs go high and reload the counters to 0. You should&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; probably sync this input to the respective SCT clock.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;6. Create an ISR that reads the SCT0 and SCT1 timer capture registers when the timer interrupt occurs&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; and writes these values to a couple variables.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Operation&amp;nbsp; ================&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1. When you receive the timer interrupt you have the two values.&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:48:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SCTimer-in-LPC11U68/m-p/547932#M13552</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:48:06Z</dc:date>
    </item>
    <item>
      <title>Re: SCTimer in LPC11U68</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SCTimer-in-LPC11U68/m-p/547933#M13553</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by mattiad on Fri Dec 12 01:15:29 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you very much for your clear answer!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I just have a doubt: is it necessary to do steps 4 and five?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My idea would be: every 100ms my timer gives me an interrupt. During this interrupt I read values contained in the counter registesr and then I clear these registers (page 343 of 609).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Best Regards&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:48:07 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SCTimer-in-LPC11U68/m-p/547933#M13553</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:48:07Z</dc:date>
    </item>
    <item>
      <title>Re: SCTimer in LPC11U68</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SCTimer-in-LPC11U68/m-p/547934#M13554</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by R2D2 on Fri Dec 12 03:28:22 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: mattiad&lt;/STRONG&gt;&lt;BR /&gt;My idea would be: every 100ms my timer gives me an interrupt. During this interrupt I read values contained in the counter registesr...&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; :quest: &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Why do you count?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;SCT is able to do a lot of useful things for. If you capture A with SCT0 this cycle time is useful to calculate the speed.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If you use another SCT0 capture input for B you get the direction (&amp;lt; (cycle time)/2 or &amp;gt;(cycle time)/2)&amp;nbsp; :) &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:48:07 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SCTimer-in-LPC11U68/m-p/547934#M13554</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:48:07Z</dc:date>
    </item>
    <item>
      <title>Re: SCTimer in LPC11U68</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SCTimer-in-LPC11U68/m-p/547935#M13555</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by mattiad on Fri Dec 12 04:11:45 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi R2D2 and thank you for your answer and suggestion!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I want to read the counter register becauser I count the number of rising edges every 100ms and with this value I calculate the angular speed.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Do you have a better idea to realize this?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The second step that I need to do is, as you say, calculating the direction.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Since I have this kind of input (fig1) my idea is:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;- at rising edge of A I check the status of B: if B=0 I increase the counter register else i decrease the counter register. In this case I know the speed and also the direction.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Do you have alternative suggestions which allows me to obtain this datas without using the CPU every rising edge?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Best Regards!!!!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Mattia&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:48:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SCTimer-in-LPC11U68/m-p/547935#M13555</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:48:08Z</dc:date>
    </item>
    <item>
      <title>Re: SCTimer in LPC11U68</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SCTimer-in-LPC11U68/m-p/547936#M13556</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by R2D2 on Fri Dec 12 04:24:20 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: mattiad&lt;/STRONG&gt;&lt;BR /&gt;I want to read the counter register becauser I count the number of rising edges every 100ms and with this value I calculate the angular speed.&lt;BR /&gt;Do you have a better idea to realize this?&lt;BR /&gt;&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Didn't I describe it?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Just capture both signals. Set your SCT event to reset counter after very A cycle.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Then you get a complete A cycle capture time and a B capture time within this cycle (to get the direction).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;No interrupt required... &lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:48:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SCTimer-in-LPC11U68/m-p/547936#M13556</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:48:08Z</dc:date>
    </item>
    <item>
      <title>Re: SCTimer in LPC11U68</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SCTimer-in-LPC11U68/m-p/547937#M13557</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by mattiad on Fri Dec 12 05:46:21 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi R2D2,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;sorry but I'm new with micro programming and I don't understand&amp;nbsp; your explaination.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Maybe do you have a portion of the code to take as an example.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: &lt;/STRONG&gt;&lt;BR /&gt;Then you get a complete A cycle capture time and a B capture time within this cycle (to get the direction).&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In this case I check the direction just one time on a number of cycle. If, unluckly, in that moment I have some virations on the structure in which my encoder is inserted, I could find an inverted direction and consider it valid for the cycle.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Increasing or decreasing a register every rising edge allows me to ""filter"" this problemi dued to vibrations.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Best Regards&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:48:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SCTimer-in-LPC11U68/m-p/547937#M13557</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:48:09Z</dc:date>
    </item>
    <item>
      <title>Re: SCTimer in LPC11U68</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SCTimer-in-LPC11U68/m-p/547938#M13558</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by LabRat on Sat Dec 13 19:23:15 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: mattiad&lt;/STRONG&gt;&lt;BR /&gt;I would like to use my micro LPC11u68, 100 pins configuration, in order to&amp;nbsp; check the speed of a quadrature ecoder.&lt;BR /&gt;...&lt;BR /&gt;Do you have any suggestion?&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Yes, use a LPC15xx with QEI&amp;nbsp; :) &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:48:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SCTimer-in-LPC11U68/m-p/547938#M13558</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:48:09Z</dc:date>
    </item>
    <item>
      <title>Re: SCTimer in LPC11U68</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SCTimer-in-LPC11U68/m-p/547939#M13559</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by The Dude on Wed Dec 17 08:37:21 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Using a part like the LPC15xx is likely the best solution to your problem.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:48:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SCTimer-in-LPC11U68/m-p/547939#M13559</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:48:10Z</dc:date>
    </item>
  </channel>
</rss>

