Пример #1
0
static void prvSetupTimerInterrupt( void )
{
	/* Set the watchdog up to generate a periodic tick. */
	WDG_ECITConfig( DISABLE );
	WDG_CntOnOffConfig( DISABLE );
	WDG_PeriodValueConfig( portMICROS_PER_SECOND / configTICK_RATE_HZ );

	/* Setup the tick interrupt in the EIC. */
	EIC_IRQChannelPriorityConfig( WDG_IRQChannel, 1 );
	EIC_IRQChannelConfig( WDG_IRQChannel, ENABLE );
	EIC_IRQConfig( ENABLE );
	WDG_ECITConfig( ENABLE );

	/* Start the timer - interrupts are actually disabled at this point so
	it is safe to do this here. */
	WDG_CntOnOffConfig( ENABLE );
}
Пример #2
0
void WaitMs(int msVal)
{
	WDG->CR = 0x00;
	while (msVal > 1024)
	{
		WDG_PeriodValueConfig(1024000);
		msVal -= 1024;

		WDG_CntOnOffConfig(ENABLE);	
		while(!(WDG->SR & 0x1));
		WDG->SR = 0x0000;
		WDG_CntOnOffConfig(DISABLE);
	}
	
	WDG_PeriodValueConfig(msVal*1000);
	WDG_CntOnOffConfig(ENABLE);	
	while(!(WDG->SR & 0x1));
	WDG->SR = 0x0000;
	WDG_CntOnOffConfig(DISABLE);

}