Thanks, for your hepl, but it still don't work. I have already the same problem could you see the new program in order to say me if there is anithing wrong?
Try this code example. It's a ''C'' code but You can convert it in assembler. /* Definizione costanti */ #if(_freqOsc == 16 ) // < 16MHz > #define _oneMilli 1000 // costante timer free-running per ottenere il millisecondo #define _CC01 0b00001000 // divisore frequenza CPU (OSC/2) per il timer A o B a 1MHz #endif #if(_freqOsc == 8 ) // < 8MHz > #define _oneMilli 1000 // costante timer free-running per ottenere il millisecondo #define _CC01 0b00000000 // divisore frequenza CPU (OSC/2) per il timer A o B a 1MHz #endif /* Variabile WORD di supporto */ @tiny WORD Delay; // variabile per il ritardo di 1ms usata nell'interrupt timer /* Inizializzazione TIMER ''A'' */ TACR1 = 0x40; /* abilito l'interrupt out Compare su TIMER ''A''*/ TACR2 = _CC01; /* divisione del clock per il conteggio; Fcpu/x = 1MHz*/ /* Timer intarrupt handler */ @interrupt void one_milli(void) /* ROUTINE DI INTERRUPT TIMER ''A'' o ''B'' */ { if(ValBit(TASR,OCF1)) // ogni 1 millisecondo { Delay =(TAOC1HR< Delay += _oneMilli; // somma di nuovo il valore per ottenere il millisecondo TAOC1HR=(Delay>>8 ); // questa operazione effettua anche l'ack dell'interrupt TAOC1LR=Delay; // ... // Your code // } else TAOC2LR = 0x00;[ Questo Messaggio è stato Modificato da: sixtus il 03-09-2003 09:45 ]
Thanks for your help, but it still do'nt work, now I've a different problem, now it's too slowly, it spend 120ms to do the interrupt which I wanted to do in 1ms, could you look in the program what is wrong now?
Thanks for your help, but it still continue with the same problem (after I put the led of output compare 2 in 'ON' I can't put it in 'OFF') , could you say me if there is anything which could be wrong?