Beispiel #1
0
void timer_iproc(int sigval) {
     
        //increment the pulse counter
  		pulse_counter++;
  		
  		//when pulse counter hits ten (one second)
		if(pulse_counter == 10)
        {
			clock_increment(system_clock, 0);
			clock_increment(wall_clock, 1);
			pulse_counter = 0;
		}
}
Beispiel #2
0
void timer_iproc(int sigval) {
     
        printf("\nClock Signal Received.   Incrememting pulse counter from %i ", pulse_counter);
        //increment the pulse counter
  		pulse_counter++;
        printf("to %i ...\n", pulse_counter);  		
  		//when pulse counter hits ten (one second)
		if(pulse_counter == 10)
        {
			clock_increment(system_clock, 0);
			clock_increment(wall_clock, 1);
			pulse_counter = 0;
		}
}
Beispiel #3
0
int main(void)
{
	SystemInit();
	GLCD_Init();
	clock_init();

#ifndef BUSY_WAIT
	timer0_init();
#endif /* ifndef BUSY_WAIT */
	
	while(1)
	{
		GLCD_Clear(White);
		GLCD_DisplayString(0, 0, 1, (unsigned char*) clock.text);
		
		// Delay by 1000 milliseconds
#ifdef BUSY_WAIT
		delay_busy_wait(1000);
		clock_increment();
		clock_print();
#else
		// incrementing clock done within interrupt handlers
		clock_print();
#endif /* ifdef BUSY_WAIT */		
	}
}
Beispiel #4
0
void TIMER0_IRQHandler (void)
{
    if((LPC_TIM0->IR & 0x01) == 0x01) // if MR0 interrupt
    {
        LPC_TIM0->IR |= 1 << 0; // Clear MR0 interrupt flag
		clock_increment();
    }
}					 
Beispiel #5
0
void high_isr(void){

	/* TIMER 0 INTERRUPT HANDLING */
	// T0IF generates the interrupt for the internal clock
	// TMR0 expires every 125 ms
	if (INTCONbits.TMR0IF) {
		WriteTimer0(TMR0_VAL);
		clock_increment();
		if (clock_get_seconds()==0){
			check_timer_table = 1;
		}
		
		INTCONbits.TMR0IF = 0;
	}


	/* USART RX INTERRUPT HANDLING */
	if (PIR1bits.RCIF==1){
		process_uart(ReadUSART());
		PIR1bits.RCIF = 0;
	}

	return;
}