Content originally posted in LPCWare by cesimkaol on Thu Jun 16 10:34:40 MST 2011
Standart code can be seen below.So when I remove SystemClockUpdate();
is it working correctly?
#include <cr_section_macros.h>
#include <NXP/crp.h>
// 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 "lpc17xx.h"
#include "type.h"
#include "pwm.h"
#define CHANNEL_NUM 1
extern volatile uint32_t match_counter1;
/******************************************************************************
** Main Function main()
******************************************************************************/
int main (void)
{
uint32_t cycle = PWM_CYCLE, offset = 0;
/* SystemClockUpdate() updates the SystemFrequency variable */
SystemClockUpdate();
if ( PWM_Init( CHANNEL_NUM, 0 ) != TRUE )
{
while( 1 ); /* fatal error */
}
PWM_Set( CHANNEL_NUM, cycle, offset );
PWM_Start( CHANNEL_NUM );
while ( 1 )
{
if ( match_counter1 != 0 )
{
match_counter1 = 0;
PWM_Set( CHANNEL_NUM, cycle, offset );
}
}
}