<?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>LPC Microcontrollers中的主题 Re: How to count external pulses with SCTimer?</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/How-to-count-external-pulses-with-SCTimer/m-p/571816#M18460</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by MarcVonWindscooting on Thu Jun 02 13:45:48 MST 2016&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: rsg&lt;/STRONG&gt;&lt;BR /&gt; I don't need all these states and transitions!&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you say so. Then you have my deep respect, because you obviously plan to use some fancy modwrap-math to calculate the speed totally asynchronous from the difference of the counts c1,c2 at two different times t1,t2, determined by some hardware timer 'T'.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; v = scale*(c1-c2) / (t1-t2)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;But wait...what are you planning to use as timer 'T' ? Don't say, the SCT! Because then it's no longer the 'simplest use' you're after&amp;nbsp; ;-)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(And for all other timers, I want to see your modwrap math, really!&amp;nbsp; 0:) &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Marc&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 20:12:47 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T20:12:47Z</dc:date>
    <item>
      <title>How to count external pulses with SCTimer?</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/How-to-count-external-pulses-with-SCTimer/m-p/571815#M18459</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by rsg on Tue May 31 13:37:48 MST 2016&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Ugh!&amp;nbsp; All I want to do is configure the SCT peripheral to count rising edges of a tach signal that is input on a pin.&amp;nbsp; I would like to read the count periodically to determine the RPM of a motor.&amp;nbsp; I don't need all these states and transitions!&amp;nbsp; As is often the case with fancy peripherals, it seems the simplest uses get no documentation!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So far, this is the extent of my code; the count never seems to change.&amp;nbsp; Any help would be greatly appreciated!&lt;/SPAN&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // enable clock to and reset peripheral
&amp;nbsp;&amp;nbsp;&amp;nbsp; Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_SCT);
&amp;nbsp;&amp;nbsp;&amp;nbsp; Chip_SYSCTL_PeriphReset(RESET_SCT);

&amp;nbsp;&amp;nbsp;&amp;nbsp; /* From the manual:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; * The SCT can be used as standard counter/timer with external capture
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; * inputs and match outputs without using the state logic. To operate the
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; * SCT without states, configure the SCT as follows:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *&amp;nbsp;&amp;nbsp; • Write zero to the STATE register (zero is the default).
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *&amp;nbsp;&amp;nbsp; • Write zero to the STATELD and STATEV fields in the EVCTRL registers
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for each event.
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *&amp;nbsp;&amp;nbsp; • Write 0x1 to the EVn_STATE register of each event. Writing 0x1
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; enables the event.
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; In effect, the event is allowed to occur in a single state which
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; never changes while the counter is running.
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; */
&amp;nbsp;&amp;nbsp;&amp;nbsp; Chip_SCT_Init(LPC_SCT);
&amp;nbsp;&amp;nbsp;&amp;nbsp; Chip_INMUX_SetSCTInMux(LPC_INMUX, SCT_INMUX_1, SCT_INP_IN1);
&amp;nbsp;&amp;nbsp;&amp;nbsp; LPC_SCT-&amp;gt;STATE_U = 0;
&amp;nbsp;&amp;nbsp;&amp;nbsp; LPC_SCT-&amp;gt;EV[0].CTRL &amp;amp;= 0xfff03fff;
&amp;nbsp;&amp;nbsp;&amp;nbsp; LPC_SCT-&amp;gt;EV[0].STATE = 1;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Chip_SCT_Config(LPC_SCT, 0x0415);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // 0000 0100 0001 0101
&amp;nbsp;&amp;nbsp;&amp;nbsp; Chip_SCT_SetControl(LPC_SCT, 0x0008);&amp;nbsp; // 0000 0000 0000 1000
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:12:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/How-to-count-external-pulses-with-SCTimer/m-p/571815#M18459</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:12:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to count external pulses with SCTimer?</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/How-to-count-external-pulses-with-SCTimer/m-p/571816#M18460</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by MarcVonWindscooting on Thu Jun 02 13:45:48 MST 2016&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: rsg&lt;/STRONG&gt;&lt;BR /&gt; I don't need all these states and transitions!&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you say so. Then you have my deep respect, because you obviously plan to use some fancy modwrap-math to calculate the speed totally asynchronous from the difference of the counts c1,c2 at two different times t1,t2, determined by some hardware timer 'T'.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; v = scale*(c1-c2) / (t1-t2)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;But wait...what are you planning to use as timer 'T' ? Don't say, the SCT! Because then it's no longer the 'simplest use' you're after&amp;nbsp; ;-)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(And for all other timers, I want to see your modwrap math, really!&amp;nbsp; 0:) &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Marc&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:12:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/How-to-count-external-pulses-with-SCTimer/m-p/571816#M18460</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:12:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to count external pulses with SCTimer?</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/How-to-count-external-pulses-with-SCTimer/m-p/571817#M18461</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by lpcmunich on Fri Jun 03 05:23:27 MST 2016&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi rsg,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Ofcourse you don't have to use state logic if you don't like or your application doesn't demand it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The SCT is very flexible peripheral, but that also means you need to configure it properly.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Looking at what you are trying to achive with few lines of code, would like to raise few flags/concerns.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;- Are you enabling clocks to Switch Matrix, GPIO &amp;amp; IOCON blocks? If not, please do so.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- Program PINASSIGN5 or PINASSIGN56 register for CTIN function assigment on a particular pin.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- I can cleary see that you are messing up with the Event Control Register, pay attention to bit positions 13-10. You would be better of with&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; LPC_SCT-&amp;gt;EV[0].CTRL&amp;nbsp; = (1 &amp;lt;&amp;lt; 10) | (2 &amp;lt;&amp;lt; 12);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // rising edge condition on a specified IO&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope it helps!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:12:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/How-to-count-external-pulses-with-SCTimer/m-p/571817#M18461</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:12:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to count external pulses with SCTimer?</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/How-to-count-external-pulses-with-SCTimer/m-p/571818#M18462</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 Jun 03 08:20:50 MST 2016&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;This is a very simple SCT sample for LPC15xx, which should be similar to LPC8xx&amp;nbsp; &lt;SPAN class="lia-unicode-emoji" title=":face_with_open_mouth:"&gt;&lt;LI-EMOJI id="lia_face-with-open-mouth" title=":face_with_open_mouth:"&gt;&lt;/LI-EMOJI&gt;&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;
//input capture PIO0_17
 Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 17, (IOCON_MODE_PULLDOWN));
 Chip_SCT_Init(LPC_SCT0);
//unified 32bit counter, SYNC all inputs, SCT0 input counter
 LPC_SCT0-&amp;gt;CONFIG =&amp;nbsp; SCT_CONFIG_32BIT_COUNTER | (1&amp;lt;&amp;lt;9) | SCT_CONFIG_CLKMODE_INCLK ;
 LPC_INMUX-&amp;gt;SCT0_INMUX[0] = SCT0_INMUX_PIO0_17;//SCT0_IN0 = 2 = P0IO_17
 LPC_SCT0-&amp;gt;CAPCTRL[1].U&amp;nbsp; = (SCT_EVT_1);//set capture control event
//event 1: capture rising
 LPC_SCT0-&amp;gt;EVENT[1].STATE = (SCT_EVT_1); // event happens in state
 LPC_SCT0-&amp;gt;EVENT[1].CTRL = (0)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp; // capture, not used
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (0 &amp;lt;&amp;lt; 5)&amp;nbsp; |&amp;nbsp; // OUTSEL[5]&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = selects input
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (0 &amp;lt;&amp;lt; 6)&amp;nbsp; |&amp;nbsp; // IOSEL[9:6]&amp;nbsp;&amp;nbsp;&amp;nbsp; = 0 select SCT0_IN0
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (1 &amp;lt;&amp;lt; 10) |&amp;nbsp; // IOCOND[11:10] = 1 rising
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (2 &amp;lt;&amp;lt; 12) |&amp;nbsp; // COMBMODE[13:12] = IO condition
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (1 &amp;lt;&amp;lt; 14) |&amp;nbsp; // STATELD[14]&amp;nbsp;&amp;nbsp; = STATEV is loaded
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (1 &amp;lt;&amp;lt; 15);&amp;nbsp;&amp;nbsp; // STATEV[19:15] = new state 1

 LPC_SCT0-&amp;gt;STATE =1;//start state
 LPC_SCT0-&amp;gt;EVFLAG = (SCT_EVT_1); //reset flags
 Chip_SCT_ClearControl(LPC_SCT0, SCT_CTRL_HALT_L | SCT_CTRL_HALT_H);//and start
}&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It's important to config the correct input and also that you don't change the state&amp;nbsp; &lt;SPAN class="lia-unicode-emoji" title=":winking_face:"&gt;&lt;LI-EMOJI id="lia_winking-face" title=":winking_face:"&gt;&lt;/LI-EMOJI&gt;&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:12:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/How-to-count-external-pulses-with-SCTimer/m-p/571818#M18462</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:12:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to count external pulses with SCTimer?</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/How-to-count-external-pulses-with-SCTimer/m-p/571819#M18463</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;bump&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 19 Jun 2016 01:12:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/How-to-count-external-pulses-with-SCTimer/m-p/571819#M18463</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-19T01:12:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to count external pulses with SCTimer?</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/How-to-count-external-pulses-with-SCTimer/m-p/571820#M18464</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.nxp.com/thread/417647"&gt;https://community.nxp.com/thread/417647&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Jan 2019 11:46:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/How-to-count-external-pulses-with-SCTimer/m-p/571820#M18464</guid>
      <dc:creator>athmesh_n</dc:creator>
      <dc:date>2019-01-17T11:46:50Z</dc:date>
    </item>
  </channel>
</rss>

