User guide

*Timer2Load = MED_FAST_LOAD;
*Timer1Control = (TimerEnable | // Enable the Timer
TimerPeriodic | // Periodic Timer producing interrupt
TimerPrescale8 ); // Set Maximum Prescale - 8 bits
*Timer2Control = (TimerEnable | // Enable the Timer
TimerPeriodic | // Periodic Timer producing interrupt
TimerPrescale8 ); // Set Maximum Prescale - 8 bits
*IRQEnableSet = IRQTimer1 | IRQTimer2; // Enable the counter timer interrupts
printf("Running...\n");
IntCT1 = 0; // Clear CT 1 Flag
IntCT2 = 0; // Clear CT 2 Flag
Count = 0;
while ( Count < 20 )
{
if (IntCT1 != 0) // Timer 1 Interrupt occurred
{
Count++;
printf("IntCT1\n");
IntCT1 = 0; // Reset the Timer 1 Interrupt Flag
}
if (IntCT2 != 0) // Timer 2 Interrupt occurred
{
Count++;
printf("IntCT2\n");
IntCT2 = 0; // Reset the Timer 2 Interrupt Flag
}
}
disable_IRQ();
}
Example 6-10 Sample int_handler.c code
/*
** Copyright (C) ARM Limited, 2000. All rights reserved.
*/
#include "stand_i.h"
#include "rpsarmul.h" /* EITHER: to use with the ARMulator */
/* #include "intgrt.h" */ /* OR: to use with the Integrator board */
/******************************************************************************
* IRQHandler *
* *
* This function handles IRQ interrupts. In this example, these may come from *
* Timer 1 or Timer 2. *
* *
* This handler simply clears the interrupt and sets corresponding flags. *
* These flags are then checked by the main application. *
* *
*******************************************************************************/
void __irq IRQ_Handler(void)
{
unsigned status;
status = *IRQStatus;
/* Deal with source of interrupt */
/* RMC source definitions used for CT1, CT2 */
if (status & IRQTimer1)
{
*Timer1Clear = 0;/* clear the interrupt */
IntCT1++; /* set the flag */
}
else if (status & IRQTimer2)
Writing Code for ROM
Copyright ?1999 2001 ARM Limited 6-20