??? 10/29/04 13:00 Read: times |
#79999 - RE: Prog.CounterArray irq problem Responding to: ???'s previous message |
hi,
1) isr time is apprx. 10 mikrosec. Inc. value = 100 mikrosec. EA = 0... How can this situation occur? There are some posibilites. As people say: "there is many a slip between the cup and the lip". For example: 1. In your code, before EA is actually cleared there are two commands: JNB CCF0,?C0001 CLR CCF0 CLR EAEach one gives a chance for high-priority interrupt be executed at this place when match already occured. As result PCA ISR losts time. 2. High priority interrupt may occur before match has been detected. By other words, match occures when high priority interrupt service routine is executed. Indeed, after program comes back from high priority ISR, it jumps to PCA ISR. But if high priority interrupt takes many time to be executed then this jump will be "too late". My suggestions: if you need calculate time between two events then just use any timer (PCA or T0,T1 etc). Inside a timer ISR just increase a variable. Let say, - take timer 0; - configure it for 16-bit timer mode; - if extended resolution is needed then use additional variable, something like unsigned char ticks;- inside timer 0 ISR: if (ticks < 255) ticks++; - stop timer 0 and clear TH0,TL0 before measurement. - run timer and then "some actions" - stop timer - check its TH0,TL0 and variable ticks if used. If ticks == 255 then it means that time out occured. You may use unsigned int then (= Have I to disable ECCFn, when i perfom CCAP0 increasing or no? No, you may disable only one of the next bits: - Global interrupt disable (EA=0). This disables all ISRs to be executed. - PCA interrupt disable (EC=0). This disables all interrupts of PCA (all modules + overflow). - PCA module interrupt disable (ECCFn=0). This disables only ISR of selected module. Moreover, you may not disable any interrupts if PCA interrupt has highest priority. Try such configuration, maybe it helps. Regards, Oleg |
Topic | Author | Date |
Prog.CounterArray irq problem | 01/01/70 00:00 | |
RE: Prog.CounterArray irq problem | 01/01/70 00:00 | |
RE: Prog.CounterArray irq problem | 01/01/70 00:00 | |
RE: Prog.CounterArray irq problem | 01/01/70 00:00 | |
RE: Prog.CounterArray irq problem | 01/01/70 00:00 | |
RE: Prog.CounterArray irq problem | 01/01/70 00:00 | |
RE: Prog.CounterArray irq problem | 01/01/70 00:00 | |
RE: Prog.CounterArray irq problem | 01/01/70 00:00 | |
RE: Prog.CounterArray irq problem | 01/01/70 00:00 | |
RE: Prog.CounterArray irq problem | 01/01/70 00:00 | |
RE: Prog.CounterArray irq problem | 01/01/70 00:00 | |
RE: Prog.CounterArray irq problem | 01/01/70 00:00 | |
RE: Prog.CounterArray irq problem | 01/01/70 00:00 | |
RE: Prog.CounterArray irq problem | 01/01/70 00:00 | |
RE: Prog.CounterArray irq problem![]() | 01/01/70 00:00 |