I'm using philips 89c51RC+ MCU. And set timer 2 in capture mode. But I didn't get capture TL2 and TH2 values into RCAP2L/H registers. I'm using following code to initialize Timer2 and reading registers:
void initialize_timer2() { unsigned int tl,th; // Timer #2 to run 16 bit counter mode T2MOD = 0x02; T2CON = 0x0D; // clear 8 bit counter registers TH2 = 0; TL2 = 0; // Turn on timer 2 (start counting...) T2 = 1; //Captures will occur on negative transitions at T2EX (p1.1). (And that thing working well in my circuit...) // Print a stream th = RCAP2H<<8; tl = RCAP2L + th; printf("Captured value:% d\n\r",tl); }