<?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: LPC1769 SystickTimer in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1769-SystickTimer/m-p/525419#M8055</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by mc on Sun May 11 17:22:45 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi Sostomariano,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Your approach is correct. You can just use peripheral_systick example available in our LPCOpen plateform. It toggles port with an LED.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If you are using Keil or IAR IDE, you can download lpcopen package from below link&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.lpcware.com%2Fsystem%2Ffiles%2Flpcopen_2_10_keil_iar_nxp_lpcxpresso_1769.zip" rel="nofollow" target="_blank"&gt;http://www.lpcware.com/system/files/lpcopen_2_10_keil_iar_nxp_lpcxpresso_1769.zip&lt;/A&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For Xpressso IDE download package from&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.lpcware.com%2Fsystem%2Ffiles%2Flpcopen_2_10_lpcxpresso_nxp_lpcxpresso_1769.zip" rel="nofollow" target="_blank"&gt;http://www.lpcware.com/system/files/lpcopen_2_10_lpcxpresso_nxp_lpcxpresso_1769.zip&lt;/A&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 18:11:32 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T18:11:32Z</dc:date>
    <item>
      <title>LPC1769 SystickTimer</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1769-SystickTimer/m-p/525418#M8054</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by sostomariano on Fri May 09 20:11:34 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi there , im trying to make a simple program using Systick Timer. I want to make the Led (P0.22 ) to turn ON/OFF each 5 seconds. That means , 5 seconds ON -&amp;gt; 5 seconds OFF -&amp;gt; 5 seconds ON-&amp;gt;.....&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Im not quite sure I'm understanding how the systick works. I made a void Systick_Init(void) function to initialize the systick.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;void SystickInit(void)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;STRELOAD = (STCALIB)-1;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;STCURR = 0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ENABLE = 1;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;TICKINT = 1;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;CLKSOURCE = 1;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The thing is, i put a certain value in STRELOAD, and the lpc is going to decrease 1 unit each 10 ms , so if i put for example the value 500 in STRELOAD , it would take 5 seconds to reach the value 0 , and when it does the bit COUNTFLAG turns 1 and call the Handler function, is it that way how it works ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I made a .c file in which i put the function initializer and the Handler , which header files do i have to include ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;void Systick_Handler(void)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;if( COUNTFLAG == 1 )&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;COUNTFLAG = 0; // clear interrupt&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SetPin(0,22,~GetPin(0,22));&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:11:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1769-SystickTimer/m-p/525418#M8054</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:11:31Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1769 SystickTimer</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1769-SystickTimer/m-p/525419#M8055</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by mc on Sun May 11 17:22:45 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi Sostomariano,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Your approach is correct. You can just use peripheral_systick example available in our LPCOpen plateform. It toggles port with an LED.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If you are using Keil or IAR IDE, you can download lpcopen package from below link&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.lpcware.com%2Fsystem%2Ffiles%2Flpcopen_2_10_keil_iar_nxp_lpcxpresso_1769.zip" rel="nofollow" target="_blank"&gt;http://www.lpcware.com/system/files/lpcopen_2_10_keil_iar_nxp_lpcxpresso_1769.zip&lt;/A&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For Xpressso IDE download package from&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.lpcware.com%2Fsystem%2Ffiles%2Flpcopen_2_10_lpcxpresso_nxp_lpcxpresso_1769.zip" rel="nofollow" target="_blank"&gt;http://www.lpcware.com/system/files/lpcopen_2_10_lpcxpresso_nxp_lpcxpresso_1769.zip&lt;/A&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:11:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1769-SystickTimer/m-p/525419#M8055</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:11:32Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1769 SystickTimer</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1769-SystickTimer/m-p/525420#M8056</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by sostomariano on Fri May 30 11:38:24 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;The examples provided by Cmsis2 ( LPCX176x_cmsis2_systick ) are quite poor , not to be rude sorry . but the file systick_main.c, has no initialization . i mean it must be a function called systick_init or something like that in which you configure the aproppiate registers..&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is the code&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;// CMSIS headers required for setting up SysTick Timer
#include "LPC17xx.h"

#include &amp;lt;cr_section_macros.h&amp;gt;
#include &amp;lt;NXP/crp.h&amp;gt;

// Variable to store CRP value in. Will be placed automatically
// by the linker when "Enable Code Read Protect" selected.
// See crp.h header for more information
__CRP const unsigned int CRP_WORD = CRP_NO_CRP ;

#include "leds.h"

volatile uint32_t msTicks; // counter for 1ms SysTicks

// ****************
//&amp;nbsp; SysTick_Handler - just increment SysTick counter
void SysTick_Handler(void) {
&amp;nbsp; msTicks++;
}

// ****************
// systick_delay - creates a delay of the appropriate number of Systicks (happens every 1 ms)
__INLINE static void systick_delay (uint32_t delayTicks) {
&amp;nbsp; uint32_t currentTicks;

&amp;nbsp; currentTicks = msTicks;// read current tick counter
&amp;nbsp; // Now loop until required number of ticks passes.
&amp;nbsp; while ((msTicks - currentTicks) &amp;lt; delayTicks);
}

// ****************
int main(void) {

led2_init();// Setup GPIO for LED2
led2_on();// Turn LED2 on

// Setup SysTick Timer to interrupt at 1 msec intervals
if (SysTick_Config(SystemCoreClock / 1000)) { 
&amp;nbsp;&amp;nbsp;&amp;nbsp; while (1);&amp;nbsp; // Capture error
}


// Enter an infinite loop, just incrementing a counter and toggling leds every second
volatile static int i = 0 ;
while(1) {
i++;
&amp;nbsp;&amp;nbsp;&amp;nbsp; systick_delay (2000); // wait 2 seconds (2000ms)
&amp;nbsp;&amp;nbsp;&amp;nbsp; led2_invert();// Toggle state of LED2
}
return 0 ;
}&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:11:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1769-SystickTimer/m-p/525420#M8056</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:11:32Z</dc:date>
    </item>
  </channel>
</rss>

