i need your help make timer A (and any type of INT )Work. i use the st72264 ,the indart-stx and the metrowerks compiler. i worte a small application that changes the state of RB port every time Timer A overflow. i encounter 2 issues : 1. the INT does not work 2. when i write TACR1 = TOIE ; asm RIM; i can not communicate with the Micro controller i get an error ''communication error between the indart and the target device'' what can be the reason for that ? i add the small application please advise: unsigned char i=1; unsigned char temp=0; unsigned char Data=0b10101010; void main(void) { PBDDR = 0xFF; PBOR = 0XFF; /* 16 bit timer */ TACR1 = TOIE ; TACR2 = Fcpu8; asm RIM; while(1) { } } interrupt 4 void TIMER_A_INT (void) { if (TASR & TOF)) /* the TOF flag is on */ { temp=TASR; /* for reading the TASR */ TACLR=0; /* clearing the TOF flag */ if (ValBit(Data,i)) PBDR=0xFF; else PBDR=0; i++; if (i==9) i=1; } } Adi.
There are two ways of declaring an interrupt function in metrowerks.
1. Using the #pragma TRAP_PROC, with this you have to declare hte INTERRUPT addresses in the prm file. 2. use interrupt 1 void trap() - this is set for the trap function. The advantage of this is no mods to the prm file have to be done. PS. it should be configured: interrupt 6 void TIMER_A_INT() for timer a interrupt. Regards sjo
and sjo your last line ''it should be configured: interrupt 6 void TIMER_A_INT() for timer a interrupt'' fix every thing to me cause in the datasheet i'm holding it is written that for timer A int the number is 4 !!. i have the august 2003 rev 1.7 . is it the last version ? am i right ? adi.
you have the latest datasheet, however metrowerks use interrupt 0 as reset, 1 as trap etc. this would make timer a interrupt 6. Its just that st don't count reset and trap.