Main Site Documentation

Measuring time using internal timer(s) and interrupt


The LPC2387 (USBizi100 / FEZmini) and LPC2388 (USBizi144 / FEZdomino) each have 4 internal timer/counters that can be used to do all sorts of timing operations.
In my case I want to measure a pulse time using one of the capture inputs, generating an interrupt and then read the captured timer value. Did anybody here do anything with these timers?


You would have to try that using the Register Class which gives you access to the chips internal registers. Another, easier option is to use a interrupt capable input (each interrupt is timestamped). A lot has been said about this latter subject in the last few weeks so a few minutes with the search tool will likely turn up a lot of good information.


Yes, like Jeff said, use register access to configure the processor anyway you like.

You can also use the timestamp value returned from Interrupt Port. This option is better since you do not have to dig into the hardware datasheet. Plus your code will work on any NETMF device.


Thanks, I will try both idea’s. As this is a (more or less) realtime application, using register access might be better for me. But I will try the timestamp value on the xxx_OnInterrupt first.
I started out writing for the LPC21xx directly using a GNU C compiler. Now I’m really impressed how powerfull (and “easy”… :slight_smile: ) this micro-framework is. (Especially when writing to SD etc.)