void __irq timers_isr0 ( void)
{
if ( T0CR2 != StoreA )
{
StoreA = T0CR2;
countA++;
T0IR |= 0x40;
}
if ( T0CR3 != StoreB )
{
StoreB = T0CR3;
countB++;
T0IR |= 0x80;
}
T0TCR |= 0x02;//ResetCounter
T0TCR &= 0xFD;
VICVectAddr = 0x00;
}
int main (void)
{
PINSEL0 = 0x00000000;
PINSEL1 = 0x0A000000;
// Enable Debug Port
PINSEL2 |= 0x00000034;
// Do Not Remove
// configure timer 0
T0CTCR = 0x08 ; // bit 00001000
T0TC = 0; /* Set Timer 0 Counter*/
T0PR = 0; /* Set Prescaler */
T0CCR = 0x00000D40;
T0MCR = 0x00;
T0MR0 = 0x01;
T0MR1 = 0x00;
T0MR2 = 0x00;
T0MR3 = 0x00;
T0TCR = 0x01; /* Start Timer*/
VICIntSelect = 0x00; /* */
VICVectCntl1 = 0x20 | 0x04; /* */
VICVectAddr1 = (unsigned) timers_isr0; /**/
VICIntEnable = 1 << 0x04; /* */
T0IR |= 0xFF;
while (1);
} // timers_init
|