I want to start a simple code with a negative going (high-to-low) pulse at a digital input. The Arduino will be an Uno or a Nano running at stock clock with a 5V supply. The code works as intended with a push-button switch but, in the actual application, it will be triggered by a pulse from another circuit.
What is the shortest pulse that will reliably trigger the action?
I don't think the pulse will be anywhere close to the shortest duration limit but it will be nice to know - for this and for future applications.
The interrupt will catch the pulse but there will be a few microsecs before it will be processed. Interrupts have 5 micros overhead plus the code in the IRQ. Reaction only begins in the IRQ but you can grab micros() which steps by 4.
If you are waiting for a return pulse you can poll with a 1 usec count loop and get a closer read.
Thanks for the further clarification. This is a simple operation that doesn't require high timing precision. Some milliseconds of delay or uncertainty will not make any difference. The starting signal is not even a sharp pulse. It's the exponential decay of an R-C network.
I did a test using two Uno R3s to verify what the shortest pulse an interrupt could detect was.
I used one Uno to generate a low going pulse every 100ms.
I used direct port manipulation, so that I could vary the pulse width in steps of 62.5ns.
I varied the pulse width by adding/removing NOPs and recompiling.
Here is the code that I used:
Thanks. That info will come in handy when I move up to more advanced applications. I'm just a novice with MCUs although I do have some designing experience with analog and fixed logic devices.