Electronics > Projects, Designs, and Technical Stuff
Measuring time span very precise
<< < (10/16) > >>
HendriXML:
There's something missing in my list of things to consider.
At high (near xffff) captured counters  it might be possible to add a high word that is new (and has an overflow in it). This would be the case if the overflow interrupt executes before the capture interrupt but after the capture has happened. I don't know whether that's actually possible. But i think the only way to counter attack that situation is to delay the increment of the high word of the counter.
magic:
This scenario shouldn't be possible.

When interrupts are enabled and multiple IRQs are waiting for execution, the one with lower number will be executed first. In all AVRs I have seen, input capture comes before overflow. Check the list of interrupt vectors in mega2560 datasheet to confirm.
Kleinstein:
Not using repeated reads and no interrupts still leaved the task to decide if a new capture and an overflow occur in the same loop to decide if capture data are before or after the overflow. So the repeated reading still need to catch and separate the specific case of capture just before overflow. It is not much more than avoiding the µC internal interrupt handling and do essentially the same tasks under software control.
Usually the hardware interrupts should be faster, when watching for more than 1 signal.
HendriXML:
That would be great. I don't know whether the following is possible. Have a compare A and a compare B event set up. One increments HiWordA, one HiWordB.
Which HiWord to take is dependent on the captured counter value. That is shown below the X axis. This solution doesn't use the overflow flag anymore.
I know the compare A and B stuff can work, but can they work together with capture events?
Kleinstein:
The system with 2 counters for software extension should also work. The counter used for large ICP values could still use the overflow interrupt.
Compare A and B work together with input capture - unless used as the counter upper limit, the ICP function is always active - there is no specific way to turn it off (except using the register as upper limit). One normally just does not look at the ICP registers.
Navigation
Message Index
Next page
Previous page
There was an error while thanking
Thanking...

Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod