How can I reset the latched register (ICLxR and ICMxR) on input capture?

Hi, I try yo use the input capture on Rabbit 4000.
The idea is to count pulses of a radar for specific time.
I am using the Rabbit 4000.
I am using two input captures once as a counter and the other one as a capturer.
The idea is count pulses while the other input capture is activate. So, when the input capture is ON the second input capture start counting pulses of a radar until the first one stop.

I made it, but I have a problem when the first input capture is activated and there are no pulses on the radar. Because there is not reset on the count register, so it send by serial the last counted number.

I don´t know if you understand my problem. But I only need to reset the latched count of the input capture.


You need to configure a timer to reset the input capture counter and send that to a serial port. For radar you probably want to know the time between pulses. Without knowing the specifics of your application, it’s difficult to say what needs to be done.

Writing a 1 to bit 2 of the ICCSR register does the following:

Reset Input Capture 1 counter to all zeros and clears the rollover latch.
Writing a 1 to bit 3:

Reset Input Capture 2 counter to all zeros and clears the rollover latch.

To clear both channels:
WrPortI(ICCSR, NULL, 0x0C); // zero out counters

See samples\Rabbit4000\ic_test.c. Also, full details on input capture are in Chapter 21 of the Rabbit 4000 processor manual.