<?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のトピックLPCOpen v2.13 example project periph_sct will not work as written - Fixed code included</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPCOpen-v2-13-example-project-periph-sct-will-not-work-as/m-p/577950#M19723</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by larryvc on Sun Dec 07 19:00:35 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Firstly I want to say that I think the SCT is an awesome peripheral.&amp;nbsp; I intend to use it to replace processor intensive software bit-banged pattern generators in a few of my devices.&amp;nbsp; But I do have some concerns with the quality of some of the example programs that are provided in LPCOpen.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Example program periph_sct in LPCOpen v2.13 for the LPC824 will not work as written because there is setup code missing.&amp;nbsp; The SCT interrupt will never happen without first enabling a state for event 0, starting (unhalting) the SCT counter, and setting event 0 as the limit for the counter.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is the working code, sct.c, with changes indicated in red:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV class="j-rte-table"&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca" style="border:1px solid black;background-color:#cacaca;border:1px solid black;background-color:#cacaca;background-color:#cacaca;border:1px solid black;"&gt; &lt;PRE&gt;
/*
 * @brief State Configurable Timer (SCT) example
 *
 * @note
 * Copyright(C) NXP Semiconductors, 2012
 * All rights reserved.
 *
 * @par
 * Software that is described herein is for illustrative purposes only
 * which provides customers with programming information regarding the
 * LPC products.&amp;nbsp; This software is supplied "AS IS" without any warranties of
 * any kind, and NXP Semiconductors and its licensor disclaim any and
 * all warranties, express or implied, including all implied warranties of
 * merchantability, fitness for a particular purpose and non-infringement of
 * intellectual property rights.&amp;nbsp; NXP Semiconductors assumes no responsibility
 * or liability for the use of the software, conveys no license or rights under any
 * patent, copyright, mask work right, or any other intellectual property rights in
 * or to any products. NXP Semiconductors reserves the right to make changes
 * in the software without notification. NXP Semiconductors also makes no
 * representation or warranty that such application will be suitable for the
 * specified use without further testing or modification.
 *
 * @par
 * Permission to use, copy, modify, and distribute this software and its
 * documentation is hereby granted, under NXP Semiconductors' and its
 * licensor's relevant copyrights in the software, without fee, provided that it
 * is used in conjunction with NXP Semiconductors microcontrollers.&amp;nbsp; This
 * copyright, permission, and disclaimer notice must appear in all copies of
 * this code.
 */

#include "board.h"

/*****************************************************************************
 * Private types/enumerations/variables
 ****************************************************************************/

#define TICKRATE_HZ (10)/* 10 ticks per second */

static volatile uint32_t ticks;

/*****************************************************************************
 * Public types/enumerations/variables
 ****************************************************************************/

/*****************************************************************************
 * Private functions
 ****************************************************************************/

/*****************************************************************************
 * Public functions
 ****************************************************************************/

/**
 * @briefHandle interrupt from SysTick timer
 * @returnNothing
 */
void SysTick_Handler(void)
{
++ticks;
[color=#f00]//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Board_LED_Toggle(1);&amp;nbsp; // Get rid of this as it messes up the SCT_IRQHandler display[/color]
[/color]}

/**
 * @briefHandle interrupt from State Configurable Timer
 * @returnNothing
 */
void SCT_IRQHandler(void)
{
if (ticks % 2) {
Board_LED_Toggle(2);
}
else {
Board_LED_Toggle(0);
}

[color=#f00]/* Clear the SCT Event 0 Interrupt */[/color]
Chip_SCT_ClearEventFlag(LPC_SCT, SCT_EVT_0);
}

/**
 * @briefApplication main program
 * @returnNothing (This function will not return)
 */
int main(void)
{
[color=#f00]uint8_t result;

[/color]/* Generic Initialization */

 SystemCoreClockUpdate();
Board_Init();

[color=#f00]/* Enable SysTick Timer */&amp;nbsp; // Check that we are passing a valid value, endless loop if not
result = SysTick_Config(SystemCoreClock / TICKRATE_HZ);
while (result == 1);&amp;nbsp; // error - reload value not possible
[/color]
/* Custom Initialization */

[color=#f00]/* Initialize the SCT clock and reset the SCT */
//Chip_SCT_Init(LPC_SCT);&amp;nbsp; // Get rid of this call, use the inline functions within the call
Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_SCT);
Chip_SYSCTL_PeriphReset(RESET_SCT);
[/color]
/* Configure the SCT counter as a unified (32 bit) counter using the bus clock */
Chip_SCT_Config(LPC_SCT, SCT_CONFIG_32BIT_COUNTER | SCT_CONFIG_CLKMODE_BUSCLK);

[color=#f00]/* The match/capture REGMODE defaults to match mode */
/* No REGMODE changes are needed for this program&amp;nbsp;&amp;nbsp; */
[/color]
/* Set the match count for match register 0 */
Chip_SCT_SetMatchCount(LPC_SCT, SCT_MATCH_0, SystemCoreClock / TICKRATE_HZ);

[color=#f00]/* Set the match reload value for match reload register 0*/[/color]
Chip_SCT_SetMatchReload(LPC_SCT, SCT_MATCH_0, SystemCoreClock / TICKRATE_HZ);

[color=#f00]/* Event 0 only happens on a match condition */
LPC_SCT-&amp;gt;EVENT[0].CTRL = (1 &amp;lt;&amp;lt; 12);

/* Event 0 only happens in state 0 */
LPC_SCT-&amp;gt;EVENT[0].STATE = 0x00000001;

/* Event 0 is used as the counter limit */
LPC_SCT-&amp;gt;LIMIT = 0x00000001;

/* Enable flag to request an interrupt for Event 0 */
[/color]Chip_SCT_EnableEventInt(LPC_SCT, SCT_EVT_0);

[color=#f00]/* Enable the interrupt for the SCT */
[/color]NVIC_EnableIRQ(SCT_IRQn);

[color=#f00]/* Start the SCT counter by clearing Halt_L in the SCT control register */
Chip_SCT_ClearControl(LPC_SCT, SCT_CTRL_HALT_L);

[/color]while (1) {
[color=#f00]//&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; Board_LED_Toggle(0);&amp;nbsp; // Get rid of this as it messes up the SCT_IRQHandler display
[/color]__WFI();
}

return 0;
}
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;P&gt;&lt;STRONG&gt;Original Attachment has been moved to: &lt;A _jive_internal="true" href="https://community.nxp.com/docs/DOC-337939" rel="nofollow noopener noreferrer" target="_blank"&gt;sct_2.c.zip&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 20:20:33 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T20:20:33Z</dc:date>
    <item>
      <title>LPCOpen v2.13 example project periph_sct will not work as written - Fixed code included</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPCOpen-v2-13-example-project-periph-sct-will-not-work-as/m-p/577950#M19723</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by larryvc on Sun Dec 07 19:00:35 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Firstly I want to say that I think the SCT is an awesome peripheral.&amp;nbsp; I intend to use it to replace processor intensive software bit-banged pattern generators in a few of my devices.&amp;nbsp; But I do have some concerns with the quality of some of the example programs that are provided in LPCOpen.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Example program periph_sct in LPCOpen v2.13 for the LPC824 will not work as written because there is setup code missing.&amp;nbsp; The SCT interrupt will never happen without first enabling a state for event 0, starting (unhalting) the SCT counter, and setting event 0 as the limit for the counter.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is the working code, sct.c, with changes indicated in red:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV class="j-rte-table"&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca" style="border:1px solid black;background-color:#cacaca;border:1px solid black;background-color:#cacaca;background-color:#cacaca;border:1px solid black;"&gt; &lt;PRE&gt;
/*
 * @brief State Configurable Timer (SCT) example
 *
 * @note
 * Copyright(C) NXP Semiconductors, 2012
 * All rights reserved.
 *
 * @par
 * Software that is described herein is for illustrative purposes only
 * which provides customers with programming information regarding the
 * LPC products.&amp;nbsp; This software is supplied "AS IS" without any warranties of
 * any kind, and NXP Semiconductors and its licensor disclaim any and
 * all warranties, express or implied, including all implied warranties of
 * merchantability, fitness for a particular purpose and non-infringement of
 * intellectual property rights.&amp;nbsp; NXP Semiconductors assumes no responsibility
 * or liability for the use of the software, conveys no license or rights under any
 * patent, copyright, mask work right, or any other intellectual property rights in
 * or to any products. NXP Semiconductors reserves the right to make changes
 * in the software without notification. NXP Semiconductors also makes no
 * representation or warranty that such application will be suitable for the
 * specified use without further testing or modification.
 *
 * @par
 * Permission to use, copy, modify, and distribute this software and its
 * documentation is hereby granted, under NXP Semiconductors' and its
 * licensor's relevant copyrights in the software, without fee, provided that it
 * is used in conjunction with NXP Semiconductors microcontrollers.&amp;nbsp; This
 * copyright, permission, and disclaimer notice must appear in all copies of
 * this code.
 */

#include "board.h"

/*****************************************************************************
 * Private types/enumerations/variables
 ****************************************************************************/

#define TICKRATE_HZ (10)/* 10 ticks per second */

static volatile uint32_t ticks;

/*****************************************************************************
 * Public types/enumerations/variables
 ****************************************************************************/

/*****************************************************************************
 * Private functions
 ****************************************************************************/

/*****************************************************************************
 * Public functions
 ****************************************************************************/

/**
 * @briefHandle interrupt from SysTick timer
 * @returnNothing
 */
void SysTick_Handler(void)
{
++ticks;
[color=#f00]//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Board_LED_Toggle(1);&amp;nbsp; // Get rid of this as it messes up the SCT_IRQHandler display[/color]
[/color]}

/**
 * @briefHandle interrupt from State Configurable Timer
 * @returnNothing
 */
void SCT_IRQHandler(void)
{
if (ticks % 2) {
Board_LED_Toggle(2);
}
else {
Board_LED_Toggle(0);
}

[color=#f00]/* Clear the SCT Event 0 Interrupt */[/color]
Chip_SCT_ClearEventFlag(LPC_SCT, SCT_EVT_0);
}

/**
 * @briefApplication main program
 * @returnNothing (This function will not return)
 */
int main(void)
{
[color=#f00]uint8_t result;

[/color]/* Generic Initialization */

 SystemCoreClockUpdate();
Board_Init();

[color=#f00]/* Enable SysTick Timer */&amp;nbsp; // Check that we are passing a valid value, endless loop if not
result = SysTick_Config(SystemCoreClock / TICKRATE_HZ);
while (result == 1);&amp;nbsp; // error - reload value not possible
[/color]
/* Custom Initialization */

[color=#f00]/* Initialize the SCT clock and reset the SCT */
//Chip_SCT_Init(LPC_SCT);&amp;nbsp; // Get rid of this call, use the inline functions within the call
Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_SCT);
Chip_SYSCTL_PeriphReset(RESET_SCT);
[/color]
/* Configure the SCT counter as a unified (32 bit) counter using the bus clock */
Chip_SCT_Config(LPC_SCT, SCT_CONFIG_32BIT_COUNTER | SCT_CONFIG_CLKMODE_BUSCLK);

[color=#f00]/* The match/capture REGMODE defaults to match mode */
/* No REGMODE changes are needed for this program&amp;nbsp;&amp;nbsp; */
[/color]
/* Set the match count for match register 0 */
Chip_SCT_SetMatchCount(LPC_SCT, SCT_MATCH_0, SystemCoreClock / TICKRATE_HZ);

[color=#f00]/* Set the match reload value for match reload register 0*/[/color]
Chip_SCT_SetMatchReload(LPC_SCT, SCT_MATCH_0, SystemCoreClock / TICKRATE_HZ);

[color=#f00]/* Event 0 only happens on a match condition */
LPC_SCT-&amp;gt;EVENT[0].CTRL = (1 &amp;lt;&amp;lt; 12);

/* Event 0 only happens in state 0 */
LPC_SCT-&amp;gt;EVENT[0].STATE = 0x00000001;

/* Event 0 is used as the counter limit */
LPC_SCT-&amp;gt;LIMIT = 0x00000001;

/* Enable flag to request an interrupt for Event 0 */
[/color]Chip_SCT_EnableEventInt(LPC_SCT, SCT_EVT_0);

[color=#f00]/* Enable the interrupt for the SCT */
[/color]NVIC_EnableIRQ(SCT_IRQn);

[color=#f00]/* Start the SCT counter by clearing Halt_L in the SCT control register */
Chip_SCT_ClearControl(LPC_SCT, SCT_CTRL_HALT_L);

[/color]while (1) {
[color=#f00]//&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; Board_LED_Toggle(0);&amp;nbsp; // Get rid of this as it messes up the SCT_IRQHandler display
[/color]__WFI();
}

return 0;
}
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;P&gt;&lt;STRONG&gt;Original Attachment has been moved to: &lt;A _jive_internal="true" href="https://community.nxp.com/docs/DOC-337939" rel="nofollow noopener noreferrer" target="_blank"&gt;sct_2.c.zip&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:20:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPCOpen-v2-13-example-project-periph-sct-will-not-work-as/m-p/577950#M19723</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:20:33Z</dc:date>
    </item>
    <item>
      <title>Re: LPCOpen v2.13 example project periph_sct will not work as written - Fixed code included</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPCOpen-v2-13-example-project-periph-sct-will-not-work-as/m-p/577951#M19724</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by larryvc on Mon Dec 08 21:58:05 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;UPDATE: I have updated the code above as it was missing this&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;
/* Event 0 is used as the counter limit */
LPC_SCT-&amp;gt;LIMIT = 0x00000001;
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The code now functions as it should.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:20:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPCOpen-v2-13-example-project-periph-sct-will-not-work-as/m-p/577951#M19724</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:20:34Z</dc:date>
    </item>
    <item>
      <title>Re: LPCOpen v2.13 example project periph_sct will not work as written - Fixed code included</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPCOpen-v2-13-example-project-periph-sct-will-not-work-as/m-p/577952#M19725</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by larryvc on Tue Dec 09 11:13:22 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Of course you can also omit the extra write to the SCT limit event register&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;
/* Event 0 is used as the counter limit */
LPC_SCT-&amp;gt;LIMIT = 0x00000001;
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;by setting auto limit in the SCT configuration register&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;
/* Configure the SCT counter as a unified (32 bit) counter using the bus clock and auto limit */
Chip_SCT_Config(LPC_SCT, SCT_CONFIG_32BIT_COUNTER | SCT_CONFIG_CLKMODE_BUSCLK | SCT_CONFIG_AUTOLIMIT_L);
&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:20:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPCOpen-v2-13-example-project-periph-sct-will-not-work-as/m-p/577952#M19725</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:20:35Z</dc:date>
    </item>
    <item>
      <title>Re: LPCOpen v2.13 example project periph_sct will not work as written - Fixed code included</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPCOpen-v2-13-example-project-periph-sct-will-not-work-as/m-p/577953#M19726</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by larryvc on Tue Dec 09 11:50:39 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;NXP, It would be nice to see a more comprehensive set of register defines and inline functions for setting up the SCT registers in LPCOpen v2.13 project lpc_chip_82x&amp;nbsp; file sct_8xx.h.&amp;nbsp; I find it a bit sparse and lacking in detail, though I did write my own inline functions and accompanying enums for setting the event state and event control registers.&amp;nbsp; I followed the format of sct_8xx.h and added these to an include file sct.h in my workspace.&amp;nbsp; By no means is this perfect, but it gives you an idea as to what I am asking for. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;File sct.h:&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;
enum states {STATE0, STATE1, STATE2, STATE3, STATE4, STATE5, STATE6, STATE7};
enum combmode {OR, MATCH, IO, AND};

/**
 * SCT Event State register values enum
 */
typedef enum CHIP_SCT_EVENT_STATE {
SCT_EVENT_STATE0 = 0,/*!&amp;lt; SCT Event State register 0 */
SCT_EVENT_STATE1 = 1,/*!&amp;lt; SCT Event State register 1 */
SCT_EVENT_STATE2 = 2,/*!&amp;lt; SCT Event State register 2 */
SCT_EVENT_STATE3 = 3,/*!&amp;lt; SCT Event State register 3 */
SCT_EVENT_STATE4 = 4,/*!&amp;lt; SCT Event State register 4 */
SCT_EVENT_STATE5 = 5,/*!&amp;lt; SCT Event State register 5 */
SCT_EVENT_STATE6 = 6,/*!&amp;lt; SCT Event State register 6 */
SCT_EVENT_STATE7 = 7,/*!&amp;lt; SCT Event State register 7 */
} CHIP_SCT_EVENT_STATE_T;

/**
 * @briefSet event states in the State Configurable Timer
 * @parampSCT: The base of SCT peripheral on the chip
 * @paramn: Event state register
 * @paramvalue: single or ORed state values
 * @returnNothing
 */
STATIC INLINE void Chip_SCT_SetEventState(LPC_SCT_T *pSCT, CHIP_SCT_EVENT_STATE_T n, uint32_t value)
{
pSCT-&amp;gt;EVENT[n].STATE = value;
}

/**
 * SCT Event Control register values enum
 */
typedef enum CHIP_SCT_EVENT_CTRL {
SCT_EVENT_CTRL0 = 0,/*!&amp;lt; SCT Event Control register 0 */
SCT_EVENT_CTRL1 = 1,/*!&amp;lt; SCT Event Control register 1 */
SCT_EVENT_CTRL2 = 2,/*!&amp;lt; SCT Event Control register 2 */
SCT_EVENT_CTRL3 = 3,/*!&amp;lt; SCT Event Control register 3 */
SCT_EVENT_CTRL4 = 4,/*!&amp;lt; SCT Event Control register 4 */
SCT_EVENT_CTRL5 = 5,/*!&amp;lt; SCT Event Control register 5 */
SCT_EVENT_CTRL6 = 6,/*!&amp;lt; SCT Event Control register 6 */
SCT_EVENT_CTRL7 = 7,/*!&amp;lt; SCT Event Control register 7 */
} CHIP_SCT_EVENT_CTRL_T;

/*
 * @brief Macro defines for SCT event control register
 */
#define SCT_EVENT_CTRL_CTRL_MATCHSEL(x)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (((x) &amp;amp; 0x0F) &amp;lt;&amp;lt; 0)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*!&amp;lt; Select match register */
#define SCT_EVENT_CTRL_HEVENT(x)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (((x) &amp;amp; 0x01) &amp;lt;&amp;lt; 4)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*!&amp;lt; Select L/H counter */
#define SCT_EVENT_CTRL_OUTSEL(x)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (((x) &amp;amp; 0x01) &amp;lt;&amp;lt; 5)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*!&amp;lt; Input/output select&amp;nbsp; */
#define SCT_EVENT_CTRL_IOSEL(x)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (((x) &amp;amp; 0x0F) &amp;lt;&amp;lt; 6)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*!&amp;lt; Select I/O signal number */
#define SCT_EVENT_CTRL_IOCOND(x)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (((x) &amp;amp; 0x03) &amp;lt;&amp;lt; 10)&amp;nbsp;&amp;nbsp;&amp;nbsp; /*!&amp;lt; Select I/O condition */
#define SCT_EVENT_CTRL_COMBMODE(x)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (((x) &amp;amp; 0x03) &amp;lt;&amp;lt; 12)&amp;nbsp;&amp;nbsp;&amp;nbsp; /*!&amp;lt; Select match and/or I/O condition */
#define SCT_EVENT_CTRL_STATELD(x)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (((x) &amp;amp; 0x01) &amp;lt;&amp;lt; 14)&amp;nbsp;&amp;nbsp;&amp;nbsp; /*!&amp;lt; Control how STATEV modifies the state */
#define SCT_EVENT_CTRL_STATELD(x)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (((x) &amp;amp; 0x01) &amp;lt;&amp;lt; 14)&amp;nbsp;&amp;nbsp;&amp;nbsp; /*!&amp;lt; Control how STATEV modifies the state */
#define SCT_EVENT_CTRL_MATCHMEM&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; 20)&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;lt; MATCHMEM */
#define SCT_EVENT_CTRL_DIRECTION(x)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (((x) &amp;amp; 0x03) &amp;lt;&amp;lt; 21)&amp;nbsp;&amp;nbsp;&amp;nbsp; /*!&amp;lt; Direction qualifier for event generation */

#define SCT_STATE(x)&amp;nbsp;&amp;nbsp;&amp;nbsp; (1 &amp;lt;&amp;lt; ((x) &amp;amp; 0XFF))

/**
 * @briefSet event control values in the State Configurable Timer
 * @parampSCT: The base of SCT peripheral on the chip
 * @paramn: Event control register
 * @paramvalue: single or ORed control values
 * @returnNothing
 */
STATIC INLINE void Chip_SCT_SetEventControl(LPC_SCT_T *pSCT, CHIP_SCT_EVENT_CTRL_T n, uint32_t value)
{
pSCT-&amp;gt;EVENT[n].CTRL = value;
}

&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Those functions are called in the following manner:&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;
/* Event 0 only happens in state 0 */
Chip_SCT_SetEventState(LPC_SCT, SCT_EVENT_STATE0, SCT_STATE(STATE0));

/* Event 0 only happens on a match condition */
Chip_SCT_SetEventControl(LPC_SCT, SCT_EVENT_CTRL0, SCT_EVENT_CTRL_COMBMODE(MATCH));

&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:20:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPCOpen-v2-13-example-project-periph-sct-will-not-work-as/m-p/577953#M19726</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:20:35Z</dc:date>
    </item>
    <item>
      <title>Re: LPCOpen v2.13 example project periph_sct will not work as written - Fixed code included</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPCOpen-v2-13-example-project-periph-sct-will-not-work-as/m-p/577954#M19727</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by larryvc on Tue Dec 09 17:54:11 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I would like to add that I think that the cst_8xx.h file should use register names that are in sync with the register names in the user manual.&amp;nbsp; For example, there is the use of EVn and the use of Event for the EVn registers.&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;
#define SCT_EVn_STATE_RESERVED&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (~3)
#define SCT_EVn_CTRL_RESERVED&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (0xff800000)
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&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;
uint16_t RESERVED8[32 - CONFIG_SCT_nRG];/*!&amp;lt; ...-0x2FE reserved */
__IO struct {/*!&amp;lt; 0x300-0x3FC&amp;nbsp; SCTEVENT&lt;I&gt;.STATE / SCTEVENT&lt;I&gt;.CTRL*/
uint32_t STATE;/*!&amp;lt; Event State Register */
uint32_t CTRL;/*!&amp;lt; Event Control Register */
} EVENT[CONFIG_SCT_nEV];
&lt;/I&gt;&lt;/I&gt;&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Consistency would make things a bit easier for us developers.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This has been brought up before in an earlier &lt;/SPAN&gt;&lt;A href="http://http://www.lpcware.com/content/forum/need-better-sct-examples#comment-1131422" rel="nofollow noopener noreferrer" target="_blank"&gt;post&lt;/A&gt;&lt;SPAN&gt;, over a year ago, that was answered by NXP_Paul, concerning the header file used in the SCT Cookbook.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you can't change the user manuals, then is there any chance of getting the SCT header files fixed?&amp;nbsp; You really should fix one or the other.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:20:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPCOpen-v2-13-example-project-periph-sct-will-not-work-as/m-p/577954#M19727</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:20:36Z</dc:date>
    </item>
    <item>
      <title>Re: LPCOpen v2.13 example project periph_sct will not work as written - Fixed code included</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPCOpen-v2-13-example-project-periph-sct-will-not-work-as/m-p/577955#M19728</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by NXP_Support on Thu Dec 11 09:11:00 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi Larry,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you for your very good feedback.&amp;nbsp; I will try to coordinate the feedback with the code authors.&amp;nbsp; We run into some of these problems due to needing to use register names before the documentation is ready.&amp;nbsp; I have logged your feedback for the SW teams - it will be picked up in the next release cycle.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Best regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;-NXP Support&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:20:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPCOpen-v2-13-example-project-periph-sct-will-not-work-as/m-p/577955#M19728</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:20:36Z</dc:date>
    </item>
    <item>
      <title>Re: LPCOpen v2.13 example project periph_sct will not work as written - Fixed code included</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPCOpen-v2-13-example-project-periph-sct-will-not-work-as/m-p/577956#M19729</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by larryvc on Thu Dec 11 13:21:13 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you NXP_Support.&amp;nbsp; Really looking forward to seeing the improvements in the next releases.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;LPCOpen has for the most part been getting much better, although I still prefer to use direct writes to the hardware registers.&amp;nbsp; Makes for lean and mean code.&amp;nbsp; Using the inline functions achieves pretty much the same result though and I can use them as they do simplify the coding quite a bit.&amp;nbsp; Pun intended.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:20:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPCOpen-v2-13-example-project-periph-sct-will-not-work-as/m-p/577956#M19729</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:20:37Z</dc:date>
    </item>
    <item>
      <title>Re: LPCOpen v2.13 example project periph_sct will not work as written - Fixed code included</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPCOpen-v2-13-example-project-periph-sct-will-not-work-as/m-p/577957#M19730</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by NXP_Support on Thu Dec 11 16:22:00 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi Larry,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Good news and not so good...;-)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;An LPCOpen update for the LPC8xx family is about to be released. (that is the good news)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Unfortunately your recommendations are not completely addressed in this release (the not so good news).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The SCT examples were fixed.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;We usually do have a comprehensive set of register defines but, as you have pointed out, the SCT support was not as comprehensive as it should have been. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Same problem caused the mis-match of names (which has occurred other times as well due to late changes by the documentation folks).&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Best regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;-NXP Support&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:20:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPCOpen-v2-13-example-project-periph-sct-will-not-work-as/m-p/577957#M19730</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:20:38Z</dc:date>
    </item>
    <item>
      <title>Re: LPCOpen v2.13 example project periph_sct will not work as written - Fixed code included</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPCOpen-v2-13-example-project-periph-sct-will-not-work-as/m-p/577958#M19731</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by larryvc on Thu Dec 11 21:36:57 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I like the good news, and as far as the bad news goes, I did say "in the next releases".&amp;nbsp; I'm sure LPCOpen will continue to get better.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Larry&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:20:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPCOpen-v2-13-example-project-periph-sct-will-not-work-as/m-p/577958#M19731</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:20:38Z</dc:date>
    </item>
    <item>
      <title>Re: LPCOpen v2.13 example project periph_sct will not work as written - Fixed code included</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPCOpen-v2-13-example-project-periph-sct-will-not-work-as/m-p/577959#M19732</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by acv on Fri Jan 09 11:35:02 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;NXP just released an update to the 824 that has the SCT update.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;ACV&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:20:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPCOpen-v2-13-example-project-periph-sct-will-not-work-as/m-p/577959#M19732</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:20:39Z</dc:date>
    </item>
    <item>
      <title>Re: LPCOpen v2.13 example project periph_sct will not work as written - Fixed code included</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPCOpen-v2-13-example-project-periph-sct-will-not-work-as/m-p/577960#M19733</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by JoelEkstein on Tue Jan 26 06:26:44 MST 2016&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Not worrying on any&lt;/SPAN&gt;&lt;A href="http://http://protect-o.com/"&gt; warranty&lt;/A&gt;&lt;SPAN&gt; now. Thanks for this advice.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:20:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPCOpen-v2-13-example-project-periph-sct-will-not-work-as/m-p/577960#M19733</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:20:39Z</dc:date>
    </item>
  </channel>
</rss>

