| ??? 12/31/05 19:06 Read: times |
#106301 - Hold flags Responding to: ???'s previous message |
Robert Bailey said:
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. CH and CCF/CF flags are altered even while the PCA ISR is processing them. This fact makes your logic more complicated. Therefore, fix these parameter to a variable at the entrance of the ISR. Tsuneo
unsigned char bdata ccon_hold; // assign CCON holder to bdata area for performance
sbit cf_hold = ccon_hold^7;
sbit ccf4_hold = ccon_hold^4;
sbit ccf3_hold = ccon_hold^3;
sbit ccf2_hold = ccon_hold^2;
sbit ccf1_hold = ccon_hold^1;
sbit ccf0_hold = ccon_hold^0;
void PCA_ISR(void) interrupt 6 using 1
{
ccon_hold = CCON; // hold flags
if (ccf0_hold) { // handle module 0
PCA0Long.C[3] = CCAP0L; // hold capture
PCA0Long.C[2] = CCAP0H;
PCA0Long.I[0] = PCA_Extension;
if (cf_hold && (CCAP0H & 0x80) == 0) // rollover occurred before capture
PCA0Long.I[0]++;
CCF0 = 0;
}
...
if (cf_hold) { // on rollover, increment extended byte(s)
PCA_Extension++;
CF = 0;
}
} |
| 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 |



