??? 12/29/05 18:33 Read: times |
#106181 - Still trying. Responding to: ???'s previous message |
I thought all routines in a module would default to the same bank. At any rate, I removed the "using" and the problem remains.
I am running 3 captures, the problem occurrs even when only receiving pulses into one PCA channel. I can't change the PCA clock, since I need to be able to read different frequencies simultaneously. The PCA is not highest priority, since I am also performing high baudrate serial. The code I sent you was trimmed (I removed stuff unrelated to the problem) The complete module is below. I simplified the logic slightly and added a bunch of CF checks after I read some posts of yours on another board...... (something about clearing a CCF flag clearing a CF flag) The idea is that when servicing the Capture ISR, if the MSB of the capture is greather than CH, a rollover has occurred after the capture, but before the ISR was serviced. Since we have serviced any CF flag, we just need to adjust the PCA extension value used for this capture. code here: // PCA.C #include <reg51f.h> #include <ssi.h> #include <extern.h> void PCA(void) interrupt 6 { if(CCF0) PerformPCA0(); // if(CCF1) PerformPCA1(); // if(CCF2) PerformPCA2(); // if(CCF3) PerformPCA3(); // if(CCF4) PerformPCA4(); // if(CF) PerformPCA_Overflow(); } // end PCA void PerformPCA0(void) // Split { PCA0Val.C[1] = CCAP0L; PCA0Val.C[0] = CCAP0H; PCA0Val.I += Cal_MainTimeBaseAdjust; CCAP0L = PCA0Val.C[1]; CCAP0H = PCA0Val.C[0]; OS_Task_1ms(); if(CF) PerformPCA_Overflow(); CCF0=0; }// end PCA0 void PerformPCA1(void) { if(!CEX1) { if(PhotoBlankingTimer == 0) { Photo_Sensed = MainTimeBase; Photo_Split = 0; //Main PhotoBlankingTimer = Cal_PhotoBlankTime; Serout_LaptimePacingDelay = 0; // force a laptime block NewPhotoRecd = 1; } } else { PCA_FalseTrip++; } if(CF) PerformPCA_Overflow(); CCF1=0; }// end PCA1 void PerformPCA2(void) { if(CEX2) { RPM1_Period = RPM1_Ctr; RPM1_Ctr = 0; PCA1LongOld.L = PCA1Long.L; PCA1Long.C[3] = CCAP2L; PCA1Long.C[2] = CCAP2H; if(CF) PerformPCA_Overflow(); if(PCA1Long.C[2] > CH) // rollover occurred after pulse received, but before ISR { PCA1Long.I[0] = PCA_Extension-1; } else { PCA1Long.I[0] = PCA_Extension; } PCA1LongDelta.L = PCA1Long.L - PCA1LongOld.L; NewRPM1Recd = 1; } else { PCA_FalseTrip++; } if(CF) PerformPCA_Overflow(); CCF2=0; } void PerformPCA3(void) //RPM3 input { if(CEX3) { RPM2_Period = RPM2_Ctr; RPM2_Ctr = 0; PCA2LongOld.L = PCA2Long.L; PCA2Long.C[3] = CCAP3L; PCA2Long.C[2] = CCAP3H; if(CF) PerformPCA_Overflow(); if(PCA2Long.C[2] > CH) // rollover occurred after pulse received { PCA2Long.I[0] = PCA_Extension-1; } else { PCA2Long.I[0] = PCA_Extension; } PCA2LongDelta.L = PCA2Long.L - PCA2LongOld.L; NewRPM2Recd = 1; } else { PCA_FalseTrip++; } if(CF) PerformPCA_Overflow(); CCF3=0; }// end PCA3 void PerformPCA4(void) // RPM1 input { if(CEX4) { RPM0_Period = RPM0_Ctr; RPM0_Ctr = 0; PCA0LongOld.L = PCA0Long.L; PCA0Long.C[3] = CCAP4L; PCA0Long.C[2] = CCAP4H; if(CF) PerformPCA_Overflow(); if(PCA0Long.C[2] > CH) // rollover occurred after pulse received { PCA0Long.I[0] = PCA_Extension-1; } else { PCA0Long.I[0] = PCA_Extension; } PCA0LongDelta.L = PCA0Long.L - PCA0LongOld.L; NewRPM0Recd = 1; } else { PCA_FalseTrip++; } if(CF) PerformPCA_Overflow(); CCF4=0; }// end PCA4 void PerformPCA_Overflow(void) { CF=0; PCA_Extension++; } |
Topic | Author | Date |
PCA extension | 01/01/70 00:00 | |
is this what you mean | 01/01/70 00:00 | |
a major boo-boo | 01/01/70 00:00 | |
Still trying. | 01/01/70 00:00 | |
Use Tags | 01/01/70 00:00 | |
tags? | 01/01/70 00:00 | |
Look Below | 01/01/70 00:00 | |
that will make it erratic any time | 01/01/70 00:00 | |
Is there any way.....? | 01/01/70 00:00 | |
everything depends | 01/01/70 00:00 | |
Hm, sounding like there is no clean fix | 01/01/70 00:00 | |
Hold flags | 01/01/70 00:00 | |
I fixed it, sort of......![]() | 01/01/70 00:00 | |
Compiler | 01/01/70 00:00 | |
should not be t he problem | 01/01/70 00:00 | |
sketching an idea | 01/01/70 00:00 |